Rust Blockchain

crate Docs MIT licensed Rust Version Build Status

Blockchain crate for the Rust programming language.

This library was inspired by this tutorial.

Can you show me how to use this crate?

Here's an example to get started ```rust use std::env;

use rsblockchain::addtransaction; use rsblockchain::rustblockchain::blockchain::Blockchain;

fn main() -> Result<(), Box> { let args: Vec = env::args().collect(); let mut new_blockchain = Blockchain::init();

println!("{}", rs_blockchain::VERSION_INFO);

if args.len() >= 2 {
    let mut collected_args: String = String::new();

    for arg in args[..].iter() {
        collected_args.push_str(arg);
    }

    let amount = rs_blockchain::remove_non_digits(&collected_args);

    if amount != 0 {
        for i in 1..=amount {
            add_transaction!(
                new_blockchain, "Jane Doe" => "John Doe", i as f32,
                new_blockchain, "John Doe" => "Jane Doe", i * 2
            );
            new_blockchain.mine();
        }
    } else {
        for i in 1..=25 {
            add_transaction!(
                new_blockchain, "Jane Doe" => "John Doe", i as f32,
                new_blockchain, "John Doe" => "Jane Doe", i * 2,
            );
            new_blockchain.mine();
        }
    }
} else {
    for i in 1..=25 {
        add_transaction!(
            new_blockchain, "Jane Doe" => "John Doe", i as f32,
            new_blockchain, "John Doe" => "Jane Doe", i * 2,
        );
        new_blockchain.mine();
    }
};

new_blockchain.list_transactions();
new_blockchain.write_chain_to_file()?;
Ok(())

}

```

Can I contribute to this project?

Of course, anyone can!

Dependency Graph

Dependency Graph