Blockchain is a way of storing information that is wildly different from traditional databases.
Traditional databases structure information in tables, and are usually owned and controlled by an organisation, person, entity, etc. Like a bank that owns all your transaction records. The bank is also responsible for ensuring the validity of these information. It may also edit and delete these information, depending on the tools and laws it controls.
Blockchain, on the other hand, stores information in linear blocks and strings these blocks together to form a long chain of information. Miners all around the world ensure the validity of the information. But no information can be deleted or edited once they are added to the blockchain.
In a blockchain, identical copies of these information are found in multiple computers cross-referencing each other. If information in 1 copy changes, it wouldn’t tally with the information on other computers, rendering that copy invalid. This ensures that the ledger contains true information only.
Also, since no single user or entity owns this database, nobody can delete or amend the information that has been added to the blockchain.
In short, blockchain is a public database.
This is an alternative to replace centralised databases if we do not trust entities or persons to be responsible in storing and using our information.
How to add blocks to the chain?
Since no single person or entity is responsible for checking and maintaining the database, it is important to know how information can be validated before they are added.
Otherwise, anyone can broadcast a fake information to all the computers, and everyone adds the fake information to their own ledger, and it becomes a valid information in the block.
Cryptographic hashing function (ie. SHA256) helps with this validation.
SHA256 (Message input) = Unique output
When a message input is hashed, it gives a unique output according to the hashing formula and the message input. Hashing is a one-way road, which means this unique output cannot be reversed to find out the message input.
SHA256 (Message input + special number) = Unique output
As a miner, in order to validate that you have received the same message input as other miners, you will begin a quest to find out what special number to add to the message input to throw out a Unique output that, say, starts with 20 zeros (0000000000000000000234).
This is usually done through trial and error (throws random special numbers until you get that 0000000000000000000234).
When a miner found the special number that results in 0000000000000000000234, he broadcasts the special number to other miners. The other miners input the special number, and check if they also get 0000000000000000000234. If they do, it means that they have received the same message input. Based on the low probability of getting this result with another message input, the message input is deemed valid and they add it to the blockchain.
This process of coming up with this special number expenses huge amount of computing resources (CPU power, electricity). Hence, this mechanism for rewarding miners is called Proof of Work — because by solving the special number, the first miner had proved that he did put in a lot of work to get it.
When they have successfully done so, they’re rewarded with tokens.
Referencing the parent block
Each new block makes references to the block before it: The parent’s hash is referenced in the new block. This is how the blocks are linked to each other. Hence, each unique output hash created is influenced by the block before it.
If the information in your block is different from other miners, you will not get the unique output as others.
If the information of your previous block is different from other miners, you will not get the unique output of the current block, as others.
When in doubt, we trust the longer block because more computational work is required to get there.
Hence, instead of trusting a third party, this protocol creates trust via computational work.
Examples of blockchain
As repeated multiple times, one of the main features of blockchain is that it is not controlled by a single entity. This favours the crowd who has less trust in authorities or assets that are controlled by governments, such as fiat currencies.
This explains the creation of these blockchain use cases:
Bitcoin: a blockchain of digital money transactions to replace fiat currency transactions. Each transaction is cryptographically signed (using the person’s public/private key pair), and hashed. Instead of banking systems and ledgers, it follows its own bitcoin protocol (variation of the process mentioned above).
Digital monies do not need to be settled using real cash. Like credit and debts, bitcoin provides a way for people to send, borrow, lend money among people who trust this trustless ledger system.
Ethereum: a programmable blockchain platform for people to build and execute smart contracts. We can use it to write application codes to execute transactions based on triggers. These smart contracts allows participants to transact with each other without a trusted third party middleman. People have used it to develop dApps, DeFi products, etc. It is also known for its cryptocurrency, Ether, digital money.
There are many more uses of blockchain. Since the information added to a blockchain cannot be altered and has to be valid, there’s low or null possibility of fraudulent information being recorded. If every company’s records can be validated using blockchain, this eliminates the need for auditing and accounting.
Summary
- Blockchain is a public database whose information are confirmed via peer-to-peer networks.
- These information are grouped into blocks, and added in chronological order, validated by computers.
- To validate an information add it into the blockchain, miners have to submit mathematical proof that they have solved the puzzle in a process called mining.
- Each block references to its parent block, chaining all the blocks of information together
- Examples of blockchain include Bitcoin, a cryptocurrency, and Ethereum, a programmable blockchain.