Skip to content

JasonMarkWomack/rust-blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rust-blockchain

RUST_LOG=info cargo run

This starts the client locally. The blockchain is not persisted anywhere.

You can start it in multiple terminals to get multiple connected peer-to-peer clients.

In each client, you can enter the following commands:

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 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 its own chain to the longest one it receives.

This is a VERY overly simplified, offline-running, highly inefficient, and insecure blockchain implementation. If a node gets out of sync, it's broken. This example demonstrates some of the concepts behind building a blockchain system in Rust, so it shouldn't be used anywhere near a production scenario. But you can have fun with it and learn something.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages