Blockchain technology is a constantly evolving, secure and shared record-keeping system in which each user has a copy of the data, which can only be modified if all parties involved in a transaction agree. This article examines the fundamentals of blockchain technology.
To understand the fundamentals of the blockchain, we need to understand how a transaction can be added to the existing blockchain. This can be done by going through a few important steps, as illustrated in Figure 1.
Step 1: Assume that user 1 wishes to transmit to user 2 an X amount of digital bitcoins. The transaction is then initiated by user 1.
Step 2: The node of user 1 initiates a transaction by creating it first and then digitally signing it with its private key. In a blockchain, a transaction can represent a variety of actions.
Step 3: The requested transaction is broadcast to each individual computer via a peer-to-peer (P2P) network (or node).
Step 4: Individual nodes receive the request and use cryptography techniques to try to validate the transaction. The miner node is the node that completes the validation procedure. Bitcoin is used to compensate these miner nodes.
Step 5: The verified blocks are now added to the blockchain network. Hashing is used to connect these nodes.
Step 6: The approved transactions are then recorded in a public ledger. Transactions are completed and the ledger is updated after the block is added to an existing chain.
Key cryptography techniques used in blockchain
Hashing, public-private key mechanisms, and digital signatures are the key cryptographic techniques used by the blockchain community. In this case, a hash feature is implemented to offer each user the opportunity to view the blockchain in its entirety. Blockchain characteristically uses the SHA-256 hashing algorithm. Public-private key pairs are used to gain access to the information and allow transactions. Digital signatures are also used for multi-signature contracts and digital wallets on the blockchain, as well as to ratify transactions by signing them securely (offline). Figure 2 describes briefly the key algorithms used in blockchain networks.
Demonstration of the hashing function in blockchain
Hashing is a cryptographic procedure that produces a fixed length output when any data is processed through the hashing function. The Bitcoin blockchain network utilises the SHA 256 hashing function. Hash functions are designed to make it impossible to find two inputs that produce the same output. A hash function has two crucial properties: (i) a single character change will completely change the hash result, and (ii) it is a one-way function that cannot be reversed. Figure 3 gives a demonstration of the SHA 256 hash function in a blockchain network.
The working of a blockchain network
Each node in a blockchain network stores a full copy of the distributed ledger. A block in this network has four fields: a block number, a data field, a hash value, and a nonce. Nonce is a random whole number that is a 32-bit (4-byte) field, which is changed by miners to make it an acceptable number for hashing the value of a block. Furthermore, the chain of blocks is formed by putting the preceding block’s hash on the current block. The field prev holds the hash of the previous block.
The hash value starts with four zeros, as seen in Figure 4. This specifies whether or not a block is legitimate. The previous hash value, the new transaction block and a nonce are combined to form each new hash value. The number of leading zeroes required in the hash output determines the hash cash difficulty factor. The difficulty is adjusted so that block production remains constant at approximately 1 block every 10 minutes. The more difficult it is to alter the blockchain, the tougher it is to overwrite the blockchain and double spend coins.
Blockchain technology is widely accepted by a variety of businesses. It has opened up a plethora of opportunities in the areas of healthcare, finance, accountancy and the online marketplace. The adoption of blockchain technology is expected to grow manifold in the coming years, offering quite a wide range of jobs for young aspirants.