Now, let's look at how a blockchain implementation works and what all the things are that are involved in completing the flow of execution. Let's take the example of a Bitcoin, shown in the following workflow for blockchain:
In the preceding diagram, we see how blockchain works and the steps mentioned are as follows:
- Let's say someone requests a transaction in Bitcoin; for example, person A wants to send Bitcoin to person B. That person or entity requests a transaction that results in debiting person A's wallet and crediting person B's wallet with one Bitcoin.
- Now, this requested transaction is broadcasted to the P2P network, consisting of computers known as nodes, which are spread across the globe.
- Now, once the transaction is propagated, the transaction is picked up by the network of nodes, they validate the nodes that are running the blockchain programs, and they validate the transaction and the user status using known algorithms that are common across all nodes.
- In our example, we talked about person A sending one Bitcoin to person B, which involves the cryptocurrency as well. The verification part also involves checking whether person A initiating the transaction for one Bitcoin really owns that Bitcoin or not.
One must avoid double booking and fake transactions altogether. Verification may also involve contracts, records, agreements, or documents that need verification.
- Once verified, the transaction is then combined with other transactions to create a new block of data for a ledger. This freshly created block of a series of transactions then gets added to an existing blockchain in a way that is permanent (it's unalterable).
- With this block added to the blockchain, the transaction is complete.
- Once the block is added, it remains there for the rest of the blockchain's life.