Here we'll explain the concept taking as an example the Bitcoin blockchain.
First application: Bitcoin
In november 2008, a paper released by a pseudonym called Satoshi Nakamoto described an electronic cash system that would work on a peer-to-peer network.
The transactions between users of the system would be stored in "blocks", having each block transactions that happened in a time frame of 10 minutes.
Security of the system would be handled by cryptography, where each transaction would be digitally signed by the sender of the money.
Each block would be linked by the previous block having a hash of it.
This system would later be known by the community as the blockchain.
This is the name of the first block of the chain. It contains no transactions and marks the beginning of the system.
The second block on the chain contains the hash of this block.
Each block has an attribute that is called "Previous Block" and contains the hash of the previous block.
Since this is the first block on the chain, this attribute contains the value 0.
What is in every block?
The system designed by Satoshi Nakamoto was made to store the financial transactions made by the users.
If John sends 2 bitcoins to Paul, the transaction data (basically) is:
- amount of bitcoins being transferred
- John and Paul's accounts
- time and data of the transaction
- the fee charged for the transaction
Signature of transactions
Each block stores all the transactions that happened in a certain time frame.
Every block contains the combined hash of all its transactions. A data structure called Merkle Tree is used for this purpose.
The final signature is called Merkle Root. You can see an example by exploring an individual block on the Bitcoin blockchain, like this one.
Reference to the previous block
The chain is formed in a way that each blocks have a reference of the previous block.
The reference is a hash of all the content of the previous block.
Where is all of this stored?
The Bitcoin blockchain is a database distributed in computers all around the world.
As mentioned before, this is a peer-to-peer network where every node of the network stores a copy of the blockchain.
The incentive of doing so is a financial reward for the people that maintain the network working 24/7.
These people are called miners and provide all the computational power for the system to be always available.
Miners: people that power the system
A copy of the entire blockchain is stored in nodes of the network called miners.
These nodes also prevent frauds, validating all transactions being added on the chain.
All the time the miners are competing with each other to add a block on the chain, containing transactions not yet added to the system.
How is a block added to the chain?
Transactions are happening all the time all over the world.
When a user sends some Bitcoin to another user, the transaction is broadcasted to all nodes (miners) on the network.
Each miner receive the transactions (not yet added to the chain) and with them they try to solve a mathematical problem.
For a miner to have the right to add a block and receive the financial reward, they must solve this problem.
Once they solved it, they broadcast the solution to the network.
Every miner on the network then validates it and accepts the new block, adding it to their copy of the blockchain.
The computational power the miners provide to solve the problem is called proof-of-work.
The incentive for miners to spend computational power (electricity) to this system is a financial one.
Every miner that gets to add a block to the chain, have the right to add a special transaction.
This transaction is called coinbase and consists of the miner adding to himself bitcoins he earned for solving the problem.
The current reward prize is 12.5 bitcoins.
The miner also collects all the transaction's fees payed by users.
Here are some features of the blockchain technology.
The data stored on the blockchain is easily accessible: you can explore transactions online.
By runnning a Bitcoin node you can also have access to more data on the chain
Data is only added to the chain when a miner adds a block. Can't be edited or removed.
Once the data is added, it's there forever.
The data of the system is not stored in only one computer, but in computers spread all over the globe.
Being a peer-to-peer network, there is no central server of the system.
Every node have a copy of the blockchain. With this, there is no central point of failure.
If a node is down, it doesn't affect the whole system.
Security is handled by cryptography.
Users sign their transactions with their private key, guaranteeing authenticity and nonrepudiation.
Integrity on the system is delivered by hashes of previous blocks and of transactions
As mentioned before, everyone can look up data of a especific block. The database is public.
The miners's mathematical problem is easily verifiable once it is solved.
The blockchain technology allows users to interact without the need of trusting the other party.
There is no middleman (e.g. a bank) that you need to trust to send money across the globe.
You just do it without the need of a central authority.
Anyone can enter or leave the network at will.
You can be a miner, participate on the network by just downloading the software.
Anyone can create an account and interact with other users without the need of permission.
The blockchain is up 24/7, 364. You just need an Internet connection to interact with users from any country.
When you send some bitcoins to another account, the whole network will store this fact.
It doesn't matter in which country you are, the data will be accessible anywhere in the world.