Simple example for building a blockchain in Rust
Gravacao.de.Tela.2023-03-21.as.20.37.43.mov
Developed by: @GabrielAlonsoCabral
USAGE
RUST_LOG=info cargo run
SCRIPTS
* `ls p` - list peers
* `ls c` - print local chain
* `create b $data` - `$data` is just a string here - this creates (mines) a new block with the data entry `$data` and broadcasts it
* `EXAMPLE $data: rust_blockchain > Peer Id: 12D3KooWSXGZJJEnh3tndGEVm6ACQ5pdaPKL34ktmCsUqkqSVTWX`
Once a block is created by a node, it's broadcasted and the blockchain in all other nodes is updated (if it's a valid block).
On startup, a node asks another node on the network for their blockchain and, if it's valid and longer than the current local blockchain, it updates it's own chain to the longest one it receives.
This is a VERY overly simplified, offline-running, highly inefficient and insecure blockchain implementation.