Getting started with building the blockchain
In this section, we’ll create our first blockchain project. We will use the Cargo project we created in the previous section as the starting point for our project.
Block
In the upcoming steps, we will guide you through the process of creating a block, elucidating each essential detail along the way. In the src
folder, create a file called block.rs
and implement the following struct in it:
pub struct Block { timestamp: i64, pre_block_hash: String, hash: String, transactions: Vec<Transaction>, nonce: i64, height: usize, }
We will be following the plan and roadmap that we created earlier, where we did some visual planning, and extend upon this by going through the data types that we have chosen for each of the fields.
Here, Block
has been represented as a struct where we have...