Understanding Blockchain

Understanding Blockchain

Blockchain Overview

Understanding blockchain starts with digging into blockchain as the decentralized ledger behind the digital currency Bitcoin. The ledger stores information about the transactions in chunks called blocks.  Duplicate copies of the ledger can be downloaded and stored by anyone to view the transactions.

Think of Blockchain as a Ledger

A ledger is a book or a file on a computer for storing and calculating economic transactions. These transactions are either debits (money paid out) or credits (money coming in).

For example, Cory deposits a paycheck in his account as a credit (money coming in). He records buying a burger and fries as a debit (money paid out).

A block records the transactions made with Bitcoins at a certain point in time. A block is similar to a page in the ledger. Every time a block completes, a new block can start building similar to recording transactions on a new page.

Blockchain Transactions

Each transaction in the ledger is validated to prove that the person transferring the virtual coins actually owns the coins. Once the transaction is validated and stored in the blockchain, it can’t be changed as discussed in detail below.

This whole idea prevents any unauthorized changes to the ledger and records each transaction describing how the virtual coins have been spent. Even better, the users of Bitcoins don’t have to trust other users because all users of the Bitcoin system have copies of the blockchain to validate transactions without trust. The Bitcoin system was specifically designed to prevent cheating.

Interconnected Blocks

Blockchains can be used for anything that has value and they are not just used for Bitcoin and other cryptocurrencies. However, cryptocurrencies are the most well-known application of blockchain.

After a block is verified, it attaches to the end of the blockchain to become the last block in the blockchain. A new block is attached to the end of the blockchain about every 10 minutes.

Linking Blocks to Form a Blockchain

Blocks in the blockchain are linked together to each other cryptographically. Remember when we talked about the unique code each block had called a hash? Each block builds upon the hash of the previous block in the blockchain.

If one block in the chain changes, the hash won’t match up with the following block and can be easily detected by the other computers in the network. If hackers try to modify a transaction in a particular block, they then need to change all the operations in the following blocks of the blockchain which is considered practically impossible.

Decentralized Data Storage

Storing the ledger on millions of computers ensures that a single computer can’t make any changes to the data because the same data has been stored in millions of computers on many networks.

If a hacker wants to modify a transaction, he has to modify it on all the computers with stored blockchains and that is not possible to do. With this decentralization, you don’t have to trust a single authority because multiple networks hold the records.

Who Makes The Blocks?

A block combines recent transactions and links them with past blocks. Who makes these blocks and tacks them onto the end of the blockchain? In Bitcoin, the creation of the blockchain is dictated by the Bitcoin protocol which is implemented in software.

Miners

Anyone can become and miner and like mineral miners, these people are discovering value.  In Bitcoin, miners compete to solve a puzzle. The first miner to solve the puzzle can create a block from all the transactions that are pending. If they are the first to solve the puzzle, they can append the new block to the end of the blockchain.

Difficulty level adjusted

New Bitcoins form about every 10 minutes. As more miners join the network, the chances of solving the puzzle faster than 10 minutes increases. Here again, the Bitcoin protocol has a solution. The difficulty of the puzzle increases or decreases to maintain the 10 minute solution time.

Miner Rewards

As a reward for solving the puzzle, the miner is awarded new Bitcoin. This reward is called the Coinbase (not to be confused with the popular exchange).  However, they have to wait for 50 transactions to complete before the miner can spend the new Bitcoin from the Coinbase.

This prevents cheating because if it is discovered that the blockchain is broken, the next miner ignores the broken part transaction and continues building on the unbroken part of the blockchain. Waiting for 50 transactions gives everyone more than enough chance to validate the blockchain.

What Stops the Miner from Cheating?

Stealing Bitcoin Transactions in the Block

If you happen to mine one block and try to change the payment address of some of the transactions to your address, the transaction hash will not match. How Bitcoin transactions work explains this in more detail but basically, the payment address is part of the Bitcoin transaction that is signed by the person who owns the Bitcoin. Changing the transaction would invalidate the signature.

Since other miners check each transaction miners, the invalid signature will be detected and other miners will not build on your block. Why? Miners don’t want their blocks invalidated since they spent a lot of work solving the puzzle. Instead, they would choose to start a new block that would replace your block and the blockchain would continue.

Faking the Bitcoin Solution

What stops a miner from faking the Bitcoin solution? The hash of the last block in the blockchain is used as part of the puzzle for the next block. The puzzle is very hard to solve but easy to validate. When the miner presents their block as the solution to the puzzle, the other miners can quickly validate that the puzzle wasn’t solved and the block will not be accepted into the blockchain. In other words, no other miners will want to build on this invalid block for the same reasons as above – they expended too much work to lose out on their reward.

Conclusion

With this understanding blockchain overview, you can see that blockchain revolutionary to the world and to the future of finance. Now that you understand the basics of blockchain through this tutorial, go out and discover new ways to make use of this incredible technology.