A Blockchain implementation in Rust, based on the Learn Blockchains by Building One tutorial.
Mostly done as an exercise
RUST_LOG=INFO PORT=8082 cargo run --release
RUST_LOG
controls the log levelPORT
controls the port (defaults to 8088) the server runs at.
GET /id
: Returns the randomly generated node idGET /chain
: Returns the current block chainPOST /transaction
: Adds a Transaction (e.g.{ "from": 1, "to": 2, "amount": 100 }
)POST /mine
: Mines a block based on the current transactionsPOST /node
: Adds a node (e.g.{ "address": "http://127.0.0.1:8081" }
)POST /reconcile
: "Reconciles" the local chain with all known nodes
- Blockchains (duh)
- Actix actor model
- Typed actors are sweeeet
- A great way to eliminate blocking on a shared mutable resource
- Integrates pretty well with
Future
s
- Actix web model
- Quite easy to use with Serde
- No coupling with Actix actors from what I've seen (good)
Lots to do, since this is a pretty faithful reproduction of the tutorial.
- Optimise (aka get rid of
.clone
s andBox
es thrown in anger) - Gossiping data (nodes, reconciling)
- Verifying Transactions are sound (currently just dumb data keeping)
- Moar tests