This repository contains code and documentation for building a sharded blockchain system.
Sharding is a method of horizontally partitioning a blockchain network to improve scalability. Transactions and states are divided into groups called shards that can process transactions parallelly.
This repository demonstrates a basic approach to sharding using Rust. Key components include:
- Shard - Groupings of validators and states
- Topology - Network structure managing shard splitting/merging
- Cross-Shard Transactions - Routed transactions between shards
- State Rebalancing - Redistributing states across shards
The code is primarily located in the src
folder:
shard.rs
- Shard struct and methodstopology.rs
- Managing shard topologytx.rs
- Cross-shard transactionsstate.rs
- State rebalancing logic
To run simulations:
cargo run --example simulation
This will run a sample simulation of transactions spreading across a sharded topology.
Further documentation on design and architecture can be found in the /docs
folder.
Key documents:
design.md
- High-level design philosophyspecs.md
- Detailed specifications and algorithmsdiagrams.pdf
- Visual diagrams of topology and data structures
Contributions are welcome! Please open an issue or PR for any enhancements or fixes.
Some areas that could be improved:
- Additional sharding algorithms
- Alternative data structures
- Visualization tools
- Testing and benchmarks