minimal blockchain ever.
Assist you to develop blockchain core easily.
2018 OSS Grand Developers Challenge Award
Based on the following code: lhartikk/naivechain
As Blockchain-based service grew, so need of open source which assists developing blockchain core was drived. Although there are some open source projects like Bitcoin and Ethereum, those are difficult to learn to use.
You can gently solve the above problems by using
one-chain
, simple implementation of blockchain core.
The one-chain is modularized by function—network, core, transaction, wallet, etc.— to achieve clarity.
Also, detail comments and documents are provided for studying and easy reusing.
Most of the code is written in a pseudo-code style to provide understanding by other language developers.
- Node.js v8.11.3 (>=4.3.2)
- cURL 7.55.1 or Postman v6.4.4
npm install
npm start
$env:HTTP_PORT=3002
or
export HTTP_PORT=3002
$env:P2P_PORT=6002
or
export P2P_PORT=6002
optionally
$env:PEERS="ws://127.0.0.1:6001"
or
export PEERS="ws://127.0.0.1:6001"
npm start
$env:HTTP_PORT=3003
or
export HTTP_PORT=3003
$env:P2P_PORT=6003
or
export P2P_PORT=6003
optionally
$env:PEERS="ws://127.0.0.1:6001, ws://127.0.0.1:6002"
or
export PEERS="ws://127.0.0.1:6001, ws://127.0.0.1:6002"
npm start
Click on the image above to play the video.
curl http://127.0.0.1:3001/blocks
curl -X POST http://127.0.0.1:3001/mineBlock
curl -H "Content-type:application/json" --data "{\"data\" : \"Anything you want\"}" http://127.0.0.1:3001/mineBlock
curl http://127.0.0.1:3001/peers
curl -H "Content-type:application/json" --data "{\"peer\" : \"ws://127.0.0.1:6002\"}" http://127.0.0.1:3001/addPeer
curl http://127.0.0.1:3001/address
curl -X POST http://127.0.0.1:3001/createWallet
curl -X POST http://127.0.0.1:3001/deleteWallet
curl -X POST http://127.0.0.1:3001/stop
The onechain project is licensed under the Apache License, Version 2.0, also included in our repository in the LICENSE file.