rustup
. Instructions for installing rustup
can be found on the official Rust website.cargo run
command.cargo run printchain
cargo run getbalance [ADDRESS]
[ADDRESS]
with the address you want to retrieve the balance for.cargo run create [ADDRESS]
[ADDRESS]
with the address where you want to send the genesis block reward.cargo run send [FROM] [TO] [AMOUNT]
[FROM]
with the source wallet address, [TO]
with the destination wallet address, and [AMOUNT]
with the amount to send.cargo run createwallet
cargo run listaddresses
cargo run reindex
Block
: This struct represents a block in the blockchain. Each block contains data (in the form of a string), a timestamp, a nonce, a hash, the hash of the previous block, and its height in the blockchain.Blockchain
: This struct represents the blockchain itself, which is a list of blocks.Block::new_block
: This function is used to create a new block. It computes the block's hash using a simple proof-of-work mechanism.Block::proof_of_work
: This function attempts to find a nonce such that the hash of the block's data, the nonce, and some other information starts with a certain number of zeroes.Blockchain::new
: This function creates a new blockchain, starting with a genesis block.Blockchain::add_block
: This function adds a block with given data to the blockchain.tests
module contains a simple test that demonstrates creating a blockchain and adding blocks to it.Posted Oct 6, 2023
Implementation of modern POW blockchain using the Rust programming language - GitHub - deepak-likes-code/rust-blockchain: Implementation of modern POW blockcha…
0
3