How Does The Blockchain Work
How Does The Blockchain Work
Table of Content
Is Blockchain Secure?
4. Consensus Algorithm: The nodes that form a block will try to add the block
to the blockchain network to make it permanent. But if every node is allowed to
add blocks in this manner then it will disrupt the working of the blockchain
network. To solve this problem, the nodes use a consensus mechanism to ensure
that every new block that is added to the Blockchain is the only version of the
truth that is agreed upon by all the nodes in the Blockchain, and only a valid
block is securely attached to the blockchain. The node that is selected to add a
block to the blockchain will get a reward and hence we call them “miners”. The
consensus algorithm creates a hash code for that block which is required to add
the block to the blockchain.
5. Addition of the new block to the blockchain: After the newly created block
has got its hash value and is authenticated, now it is ready to be added to the
blockchain. In every block, there is a hash value of the previous block and that is
how the blocks are cryptographically linked to each other to form a blockchain.
A new block gets added to the open end of the blockchain.
Let’s say Jack and Phil are two nodes on the bitcoin blockchain network who
wants to carry out a transaction between them.
Step 1: Facilitating the transaction: Jack wants to send 20 BTC to Phil via the
Blockchain network.
Step 5: Addition of the new block in the blockchain: After the newly created
block has got the hash value and authentication through proof-of-work only then
it will be added to the network and the transaction will mark as complete. Phil
will receive 20 BTC from Jack.
The new block will be linked to the open end of the blockchain.
Anyone on the network can fetch the information and confirm the transaction.
This will help to keep track of all the transactions and to verify whether any user
is trying to double spend. For example, if Jack tries to carry out a transaction in
the future, the rest of the nodes can check Jack’s past transaction records to
check whether Jack has enough balance to carry out the current transaction. If
there is enough balance then the transaction will be approved.
Is Blockchain Secure?
In the most basic way, one can think of a blockchain as a linked list. Each of the
next items in the list is dependent on the previous item, except for the first
block, also known as the genesis block, which is hardcoded into the blockchain.
In the blockchain, each block contains the hash of the previous block’s header
and a hash of the transactions in the Merkle tree of the current block. In this
way, each block is cryptographically chained to the previous block. Let’s
understand with an example what happens when someone attempts to change a
transaction or block data in a blockchain network.
In this way, the 10th block depends on all the previous blocks and the
genesis block as well.
If someone tries to change data on the 2nd block, then the attacker will
have to change data on all the later blocks as well, otherwise, the
blockchain will become invalid since the later blocks depend on the hash
value present in the 2nd block and the 2nd block has changed, but not the
later blocks.
2. Proof of work: For adding block into the chain, proof of work is needed.
miner need to solve tough math calculation to mine the block and this
needs huge energy and time consumption. After this also, miners verifies
that block is not compromised. That’s why it becomes futile for hackers to
try breaching the blockchain.
Blockchain mining works in various steps from transaction to being added into
the chain. These steps are:
4. Miners verify the validity: Other miners verify that the added block is
not malicious. If it is compromised then hackers doesn’t get the reward
and ends up wasting time and resources. If the block is normal then the
miner who mined gets rewarded.