https://github.com/hardworking-toptal-dev/pos-rust
Proof of stake in rust
https://github.com/hardworking-toptal-dev/pos-rust
proof-of-stake rust
Last synced: 6 months ago
JSON representation
Proof of stake in rust
- Host: GitHub
- URL: https://github.com/hardworking-toptal-dev/pos-rust
- Owner: hardworking-toptal-dev
- License: apache-2.0
- Created: 2024-04-13T02:11:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-13T02:20:06.000Z (over 1 year ago)
- Last Synced: 2025-03-28T15:50:03.576Z (7 months ago)
- Topics: proof-of-stake, rust
- Language: Rust
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Building Proof of Stake in Rust
A tutorial for building a Proof of Stake blockchain in Rust: https://medium.com/emcthye/e76c51f593e9
Start using
```bash
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 itOnce 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. If a node gets out of sync, it's broken. This is an example for showing 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. :)