Skip to content

GabrielAlonsoCabral/simplified-blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-simplified-blockchain

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.

About

Simple example for building a blockchain in Rust

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages