Skip to content

sandoche/NaivecoinStake-Proof-of-Stake-Core

 
 

Repository files navigation

NaivecoinStake

Licence: Apache 2.0 Medium Badge Twitter: sandochee

A tutorial for building a Proof of Stake cryptocurrency: https://naivecoinstake.learn.uno

Most of this amazing work has been done by Lauri Hartikka, find the original tutorial here: https://lhartikk.github.io 👏

npm install
npm start
Get blockchain
curl http://localhost:3001/blocks
Mint a block
curl -X POST http://localhost:3001/mintBlock
Send transaction
curl -H "Content-type: application/json" --data '{"address": "04bfcab8722991ae774db48f934ca79cfb7dd991229153b9f732ba5334aafcd8e7266e47076996b55a14bf9913ee3145ce0cfc1372ada8ada74bd287450313534b", "amount" : 35}' http://localhost:3001/sendTransaction
Query transaction pool
curl http://localhost:3001/transactionPool
Mint transaction
curl -H "Content-type: application/json" --data '{"address": "04bfcab8722991ae774db48f934ca79cfb7dd991229153b9f732ba5334aafcd8e7266e47076996b55a14bf9913ee3145ce0cfc1372ada8ada74bd287450313534b", "amount" : 35}' http://localhost:3001/mintTransaction
Get balance
curl http://localhost:3001/balance

Query information about a specific address

curl http://localhost:3001/address/04f72a4541275aeb4344a8b049bfe2734b49fe25c08d56918f033507b96a61f9e3c330c4fcd46d0854a712dc878b9c280abe90c788c47497e06df78b25bf60ae64
Add peer
curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6001"}' http://localhost:3001/addPeer

Query connected peers

curl http://localhost:3001/peers

Todo

  • Create method getBalance(height, address) to check the balance of an account at a height h
  • Replace the use of minterBalance by the method getBalance(height, address)

⭐️ Show your support

Please ⭐️ this repository if this project helped you!

patreon.png

🍺 Buy me a beer

If you like this project, feel free to donate:

  • PayPal: https://www.paypal.me/kanbanote
  • Bitcoin: 19JiNZ1LkMaz57tewqJaTg2hQWH4RgW4Yp
  • Ethereum: 0xded81fa4624e05339924355fe3504ba9587d5419
  • Monero: 43jqzMquW2q989UKSrB2YbeffhmJhbYb2Yxu289bv7pLRh4xVgMKj5yTd52iL6x1dvCYs9ERg5biHYxMjGkpSTs6S2jMyJn
  • Motive: MOTIV-25T5-SD65-V7LJ-BBWRD (Get Motive Now: https://motive.network)