Lesson 4: How Blockchains Work
After completing this lesson, you will be able to:
Know what information is stored in blocks.
Understand the role of hashing in blockchain networking.
Explain what a public key, a private key, and a blockchain address are.
Know how transactions are added to the blockchain.
Understand why blocks can’t be altered once they are added to the blockchain.
Welcome to the fourth lesson in Kriptomat Academy’s Blockchain Fundamentals course. In this lesson, we’ll explore how blockchains work.
Cryptocurrency transactions aren’t complete until the transactions are added to a block and posted to the blockchain.
Let’s look at the Bitcoin blockchain and see how it works.
- Bitcoin transactions – that is, transfers of Bitcoin from one address to another – are broadcast to listener nodes that hold copies of the blockchain and the application for running the blockchain database.
- Each node that receives a transaction relays it to the rest of the nodes and to miners, which are network computers that run transaction-validation programs in order to earn newly minted Bitcoins in return.
- Each miner assembles incoming transactions into a unique block, which is a candidate for being added to the blockchain.
- Only one of the candidate blocks can be added to the blockchain database – that’s where mining comes in. We will have more to say about mining in future lessons.
A Bitcoin block starts with metadata – information that is necessary for adding the block securely to the blockchain database
- The metadata starts with an eight-digit number that identifies the block as Bitcoin data. Developers call it the “magic number.”
- Metadata also includes the Bitcoin blockchain version number, an identifier for the previous block, a single cumulative identifier based on all the blocks that have been posted to the blockchain. These two identifiers are “hashed” values. Hashing based on the entire history means that the transaction record can’t be altered without alerting all the nodes on the network. We’ll have more to say about hashing in our course on blockchain security.
- Then you get a timestamp, the difficulty target for miners, and the nonce – a random number to be guessed by miners. That’s the end of the metadata.
After the metadata, the rest of the block holds information about transactions
- Following the metadata are the block size, a six-item block header, and a number representing the number of transactions within the block.
- The transactions follow. For each transaction, the block records the addresses of the sender and the receiver, the amount of Bitcoin to be transferred, proof that the sender had the proper private key for the sending address, and a time stamp.
- A single Bitcoin block holds about 2,000 transactions.
- Each transaction in the block is encrypted using a method called public key encryption.
- Each blockchain defines its own block structure. For example, Ethereum blocks include the amount of “gas” that miners used to create the block and a limit for how much gas can be expended by all the transactions within the block.
Level-2 chains and sidechains coordinate with the main blockchain
- Sidechains are independent blockchains based on the architecture of the parent.
- Some sidechains are intended to improve blockchain performance using a technique called sharding.
- With sharding, a busy blockchain like Ethereum may be split into dozens of separate “shard chains” that record transactions independently and quickly. The results are linked back to the main blockchain.
So – what have we learned?
- Each blockchain has a specific structure for blocks consisting of header data and transactions.
- Bitcoin blocks are created by miners. The block that is added to the Bitcoin blockchain is the one created by the miner who first solves the cryptographic problem.
- Sharding is a technique for improving blockchain performance by recording transactions on separate blockchains, and then updating the main blockchain.
That’s the end of this lesson! Test your understanding and earn points toward a Kriptomat Academy certificate of achievement by taking the test!
Kriptomat Academy content is informative in nature and should not be considered a personalised or any other investment recommendations or advice.