https://github.com/afmontoya/rust-blockchain
Rust Blockchain Prototype
https://github.com/afmontoya/rust-blockchain
blockchain blockchaintech blockchaintechnology rust
Last synced: 3 months ago
JSON representation
Rust Blockchain Prototype
- Host: GitHub
- URL: https://github.com/afmontoya/rust-blockchain
- Owner: afmontoya
- Created: 2025-01-31T06:37:06.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-31T06:46:08.000Z (5 months ago)
- Last Synced: 2025-01-31T07:31:20.348Z (5 months ago)
- Topics: blockchain, blockchaintech, blockchaintechnology, rust
- Language: Rust
- Homepage: http://www.montoyamedia.com
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Rust Blockchain Prototype
A simple blockchain prototype implemented in Rust. This project demonstrates **block
linking, cryptographic hashing (SHA-256), and basic chain validation**.## π Features
β Implements **SHA-256 hashing** for block security.
β Dynamically adds new **blocks with transactions**.
β Validates **blockchain integrity** to detect tampering.
β Rustβs **safe memory management** and high performance.## β‘ Installation & Setup
### πΉ 1. Clone the Repository
```sh
git clone https://github.com/afmontoya/rust-blockchain.git
cd rust-blockchain2. Install Rust (if not installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Verify installation:
rustc --version
cargo --version3. Run the Blockchain
cargo run
How It Works
1 Each block contains:Index: Block position in the chain.
Timestamp: When it was created.
Transaction Data: Example transactions (e.g., "Alice pays Bob 10 BTC").
Previous Hash: Links it to the previous block.
Hash: SHA-256 cryptographic hash of the block.
2οΈβ£New blocks are added dynamically, and the blockchain checks its integrity.3οΈβ£ Example Output:
Block {
index: 0,
timestamp: 1738304591,
data: "Genesis Block",
prev_hash: "0",
hash: "84c70fe872b086a794dd802f657442b11f6d861678093955b941444c9b2790bb",
}
Block {
index: 1,
timestamp: 1738304591,
data: "Transaction: Alice pays Bob 10 BTC",
prev_hash: "84c70fe872b086a794dd802f657442b11f6d861678093955b941444c9b2790bb",
hash: "980cdeb08292cf65515e291d9946b01303fcad317e659e85902228f97eb93563",
}
Is blockchain valid? trueπ₯ Planned Features (Future Improvements)
π Proof of Work (Mining): Implementing difficulty-based mining.
π Transaction System: Add real sender/receiver transactions.
π Networking: Make it peer-to-peer (P2P) for decentralized nodes.
π REST API: Build an HTTP API to interact with the blockchain.
π Database Integration: Persist blockchain to a database (PostgreSQL).π― Contributing
π‘ Contributions are welcome! If you'd like to add features or improve the project, feel
free to fork the repo and submit a pull request.Fork the project
Create a new branch
Commit your changes
Push to your fork
Submit a pull request
π License
This project is licensed under the MIT License.π Connect with Me
π¬ Have questions or suggestions? Feel free to reach out!GitHub: @afmontoya
Twitter: @montoyamedia