This is an afternoon-project, a blockchain built in node, supporting PoW.
This is an afternoon-project, a blockchain built in node, supporting PoW.
Node itself is a more beautiful, flexible and powerful language for internet project, again, I want to show my love to js.
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
$ npm clone https://github.com/amazingandyyy/blockchain-in-node.git
$ npm i
$ npm run dev // default on port 3000
<!-- to run more nodes -->
$ 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
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
Please feel free to fork, clone or send me PR
socket
instead of http, to broadcast stateAndy Chen(amazingandyyy)