erenoku / naivecoin-rs

Naivecoin implementation in rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

naivecoin-rs

An implementation of Naivecoin in Rust

Goals

  1. Things should be simple
  2. It should perform as well as possible without making things complicated
  3. Should be able to accomplish basic tasks, cryptocurrencies are expected to do

Getting Started

Start two instances of the app

# run these command on different terminal emulators
cargo run # it runs with the default configuration
KEY_LOC=node/wallet2/private_key.pem HTTP_PORT=8001 P2P_PORT=5001 INITIAL="0.0.0.0:5000" cargo run

Get Blockchain

curl localhost:8000/blocks

Mine a Block

curl -X POST localhost:8000/mineBlock

Mine a Transaction

curl --data '{"address":"ADDRESS_OF_THE_SECOND_PEER", "amount":DESIRED_AMOUNT}' localhost:8000/mineTransaction

Send a Transaction to Pool

curl --data '{"address":"ADDRESS_OF_THE_SECOND_PEER", "amount":DESIRED_AMOUNT}' localhost:8000/sendTransaction
# then mine a block so it gets added to the blockchain
curl -X POST localhost:8000/mineBlock

Get Balance

curl localhost:8001/balance
# the balance should be DESIRED_AMOUNT

TODO

  • Add UI for viewing and interacting with the blockchain
  • Check security

References

About

Naivecoin implementation in rust

License:GNU General Public License v3.0


Languages

Language:Rust 100.0%