Skip to content

mrb1nary/rust-blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Rust Blockchain

A simple blockchain implementation in Rust featuring wallets, transactions, and a Proof-of-Stake (PoS) consensus mechanism.

🌟 Features

  • πŸ”— Blockchain Core: A functional blockchain with blocks and transactions.
  • πŸ’° Wallet System: Generate and manage wallets with cryptographic key pairs.
  • πŸ’³ Transactions: Secure peer-to-peer transactions between wallets.
  • ⚑ Proof-of-Stake (PoS) Consensus: A lightweight and efficient consensus mechanism.

πŸ›  Installation

Make sure you have Rust installed. If not, install it from Rustup.

# Clone the repository
git clone https://github.com/yourusername/rust-blockchain.git
cd rust-blockchain

# Build the project
cargo build --release

# Run the blockchain node
cargo run

πŸ“Š Blockchain Architecture

classDiagram
    class Block {
        +index: u32
        +timestamp: u128
        +hash: String
        +prev_hash: String
        +nonce: u32
        +data: String
        +new(index: u32, prev_hash: String, data: String) Block
        +calculate_hash() String
        +mine() void
    }

    class Transaction {
        +id: String
        +sender: String
        +recipient: String
        +amount: f64
        +timestamp: i64
        +new(sender: String, recipient: String, amount: f64) Transaction
    }

    class Wallet {
        +address: String
        +balance: f64
        +new() Wallet
        +transfer(recipient: String, amount: f64) Option<Transaction>
    }

    class Blockchain {
        +chain: Vec<Block>
        +new() Blockchain
        +add_block(data: String) void
        +is_valid() bool
        +total_blocks() usize
    }

    Wallet --> Transaction: creates
    Blockchain --> Block: contains
    Block --> Transaction: stores data
    Transaction --> Wallet: links sender/recipient
Loading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages