Experimental blockchain based on libp2p
.
Peers select random block producer automatically at the end of every minute.
Currently finally selected producer is first one among sorted list of proposed peers.
In future it can be the most reach peer among proposed, like in PoS.
Anyone can change storage and balances.
All transaction are free.
Bootstrap peer gets all the funds when create new chain.
All communication between peers is encrypted with secio
.
For signing transactions and blocks 2048 bits rsa
is used. In future can be replaced with secp256k1
.
For bls bls-lib
is used with FP254BNB
curve.
Currently list of peers and state of storage and balances is saved only in memory.
In future it can be changed.
Also can be added support of EVM
.
To run with pregenerated keys just start peers starting from bootstrap peer peer0
.
-
npm run peer0
-
npm run peer1
-
npm run peer2
Try json-rpc api
curl -X POST -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"addTransaction","params":{"state":{"storage":{"key":"value"}}}}' localhost:3000
curl -X POST -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"get","params":["state","storage","key"]}' localhost:3001
curl -X POST -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"bls","params":{"message":"hello","numOfPlayers":3,"threshold":2}}' localhost:3000
To generate new keys use util/generate-peer.js
then make sure you pass them as arguments to src/start.js
.
https://www.youtube.com/watch?v=g2JcNDu6WJo
-
New nodes connects to known bootstrap node (in future list of peers will be cached and bootstrap node will be required only for first run)
-
Bootstrap node share with new peers list of all currently connected peers
-
New nodes connect to each other