Crates.io | rust-blockchain |
lib.rs | rust-blockchain |
version | 0.1.0 |
source | src |
created_at | 2021-03-14 18:54:52.750783 |
updated_at | 2021-03-14 18:54:52.750783 |
description | A simple blockchain implementation for add-ons in applications. |
homepage | https://crates.io/crates/rust-blockchain |
repository | https://github.com/j0fiN/rust-blockchain |
max_upload_size | |
id | 368844 |
size | 44,319 |
Blockchain Cryptocurrency model Implemented in Rust.
git clone https://github.com/j0fiN/rust-blockchain
cd rust-blockchain
cargo run
Your terminal should output this after execution.
[
Block {
prevhash: "",
transaction: Transaction {
amount: 100.0,
payer: PublicKey([212, 228, 66, 151, 84, 100, 15, 69, 176, 15, 174, 89, 213, 77, 1, 197, 165, 14, 211, 66, 26, 195, 82, 173, 80, 62, 245, 2, 238, 119, 27, 111]),
payee: PublicKey([212, 228, 66, 151, 84, 100, 15, 69, 176, 15, 174, 89, 213, 77, 1, 197, 165, 14, 211, 66, 26, 195, 82, 173, 80, 62, 245, 2, 238, 119, 27, 111]),
},
ts: 2021-03-12T23:27:21.159007300+05:30,
},
Block {
prevhash: "2c127d95f718dacab98f43ae1d7c3d723c0255f4eba111b2dd56930f87651169",
transaction: Transaction {
amount: 1200.0,
payer: PublicKey([0, 108, 242, 50, 94, 62, 119, 120, 34, 42, 236, 105, 155, 216, 125, 152, 45, 178, 243, 105, 244, 173, 234, 85, 227, 221, 1, 118, 171, 197, 22, 10]),
payee: PublicKey([161, 164, 235, 77, 164, 93, 133, 27, 245, 112, 95, 17, 221, 74, 219, 99, 1, 129, 8, 231, 243, 159, 80, 130, 170, 206, 165, 194, 110, 75, 217, 105]),
},
ts: 2021-03-12T23:27:21.161052100+05:30,
},
]
Code(main.rs) | Doc |
---|---|
chain::Chain::new() |
Builds the blockchain with genesis block append by default. |
wallet::Wallet::new() |
builds the node with digital signature components. |
satoshi.create_transaction(1200., notildore.pub_key) |
Builds the transaction object and signs it and returns back trnsaction, signature and nonce. |
notildore.verify_and_add(transaction, satoshi.pub_key, sig, nonce, true, &mut blockchain) |
transaction verification is done along with block append |
cargo test
Do contribute is you want to make it better or :star: the repo if you like it!