https://github.com/amazingandyyy/blockchain-in-node
This is an afternoon-project, a blockchain built in node, supporting PoW.
https://github.com/amazingandyyy/blockchain-in-node
amazingandyyy blockchain chain chaincode javascript nodejs
Last synced: 3 months ago
JSON representation
This is an afternoon-project, a blockchain built in node, supporting PoW.
- Host: GitHub
- URL: https://github.com/amazingandyyy/blockchain-in-node
- Owner: amazingandyyy
- License: mit
- Created: 2018-03-21T00:25:59.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T07:46:12.000Z (almost 8 years ago)
- Last Synced: 2025-05-05T19:54:19.017Z (9 months ago)
- Topics: amazingandyyy, blockchain, chain, chaincode, javascript, nodejs
- Language: JavaScript
- Homepage: http://amazingandyyy.com/blockchain-in-node/
- Size: 64.5 KB
- Stars: 21
- Watchers: 2
- Forks: 16
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# blockchain-in-node [](https://travis-ci.org/amazingandyyy/blockchain-in-node)
This is an afternoon-project, a blockchain built in node, supporting PoW.
### Why Node
Node itself is a more beautiful, flexible and powerful language for internet project, again, I want to show my love to js.
### Why a Blockchain from scratch
When it comes to blockchain, most developers only learn **how to do Dapp** with ethereum, neo, or other existing infrastructure-completed project... They are fine, but using them will only let you know what you can do with them, as a result, you cannot really get the idea what you can do with blockchain itself, and what you can apply the blockchain mindset to other software projects. I think there is a better way to understand blockchain itself - to build a chain from scratch
## This is a lovely demo for
- A general Idea of how Blocks, Chain, Mining, Nodes, Transaction work with each others.
- How to do them in Node
- How to resolve basic conflicts in blockchain
- How to use sha256 to do PoW(Proof of Work)
- Not a demo for
- signatures
- address
- production setup
- making you a blockchain expert
## Run it on your machine
```
$ npm clone https://github.com/amazingandyyy/blockchain-in-node.git
$ npm i
$ npm run dev // default on port 3000
$ npm run nodes // default on port 3000
$ npm run nodes 3000 // listening on port 3000
$ npm run nodes 3001 // listening on port 3001
$ npm run nodes 3002 // listening on port 3002
```
## HTTP Endpoints
```
GET /blockchain // see the link-list itself
POST /blockchain/mine // find the next special hash
POST /blockchain/body // add new data to the chain
GET /blockchain/nodes // get a list of all nodes
GET /blockchain/nodes/resolve // fetch the longest chain
POST /blockchain/nodes/register // add nodes urls
```
### There are many can be done:
Please feel free to [fork](https://github.com/amazingandyyy/blockchain-in-node#fork-destination-box), clone or send me [PR](https://github.com/amazingandyyy/blockchain-in-node/pulls)
- use `socket` instead of http, to broadcast state
- implement signature, public key, private key, user address system
- proof of work and rewarding system
- new PoW algorithm
- location based sharding?
- hide IPs / make it private!?
- PoS, or other dBFT methods
- dockernized, easy to run a node
- interactive wrappers, helper libraries(python, golang, java)...
### Author
Andy Chen([amazingandyyy](https://github.com/amazingandyyy))
### LICENSE
[MIT](https://github.com/amazingandyyy/blockchain-in-node/blob/master/LICENSE)
[](https://github.com/standard/standard)