sunsided / rustchain

A Rust blockchain playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rustchain - a blockchain example in Rust

This repo is purely an exploration of current ideas communicated in various blog posts. It is not meant to produce a practically useful blockchain solution, nor does it attempt to be particularly smart about it. Most if not all credit goes to the authors of the posts below:

Example

To run the example, execute

$ RUST_LOG=info cargo run

After the console output settles, you can execute these commands:

  • ls p: prints all discovered peers
  • ls c: prints the current blockchain
  • create b <DATA>: creates (mines) a new block containing the payload <DATA>

Known flaws

  • If two peers disagree on the next block in a chain because they are mining a successor block to the current state, the first one wins and the second one is now in a failed state from which it will not recover.
  • Race conditions can be created by increasing the difficulty and creating a block on multiple application instances simultaneously.

About

A Rust blockchain playground


Languages

Language:Rust 100.0%