In our last blog, we described how bitcoin was founded and the economic rationale behind it.
Disclaimer: I am not a technical guy, and one would have to write a book to explain all the technical complexities of blockchain. I will explain how it works with simply words, analogies and brief descriptions. My explanation will therefore not be useful for anyone wishing to learn the technicalities of blockchain function. This is just a brief description for those who are interested in using the blockchain application without the need to understand the technical elements working on the back end.
In order to create a Peer to Peer electronic cash system, Satoshi Nakamoto needed to solve the double spending problem. We can explain this problem with a simple example. When you send a photograph taken with your mobile phone to someone, the other person receives a copy of your digital file. You keep the original in your phone.
This process cannot be use for digital payments. Keeping a digital copy of the payment mean you can spend it as many times you want. In the centralised economy, banks take care to avoid double spending. They register on a central ledger the transaction; this assures that no one can use the money that has already spent. In a decentralised system, without a central counterpart, the double spending problem was an issue nobody was able to solve, until Satoshi Nakamoto invented bitcoin.
As we have already said, bitcoin works on its own blockchain. The blockchain acts as a ledger, like the one bank use. The big difference is that there is not only one person making a registration in the ledger, but as many as possible.
Let’s take an example: Imagine you a have a blank sheet of paper in front of you and a magic pen. Every person who wants to participate can receive a sheet of paper and the magic pen. Now, once a transaction is executed between two persons, the magic pen registers on all the sheets the transaction between these two people.
If a third party wants to change this transaction, he must change it on the majority of the sheets of paper at the same time. If not, the other sheets will recognize that the modified sheets do not comply with the majority and will not accept the transaction. The sheet of paper is a so-called Node on the blockchain that can be managed by everyone. The magical pen is the process run by the bitcoin blockchain to register the data on the Node.
In the real world, once you transfer a bitcoin from A to B, you create a transaction. This transaction includes several pieces of information; the outgoing wallet, the amount of bitcoin transferred, and the incoming wallet. This transaction information is sent to a blockchain node, which verifies that the transaction contains all the required information.
Once this verification is done, the transaction is sent to the so-called Mempool.
The Mempool contains all of the non-verified transactions which are not yet recorded into a blockchain. At this time, other players come in the game: The Miners.
Miners collect a transaction from the Mempool and put it into a transaction block.
All of the information in the block (there are many transactions per block) is elaborated by an algorithm which creates a Hash – an alphanumerical string.
The Miners must search for another number, called a Nonce, to add to the block. The nonce is necessary in order to have the alphanumerical string begin with a certain number of “zeros”.
Since every block should be created in 10 minutes, we need to prevent the blocks from being created too quickly. The system introduces a new zero on the Hash number, which increases the difficulty to find the correct Nonce. As more zeros are required, the less chance there is to find the number giving the correct Hash.
For example, the information in the block gives a Hash (eg 5lenhf63521efsd8561w). Now, a nonce (number) needs to be added to the block, which will change the Hash from (for example) 5lenhf63521efsd8561w to 00000kefo52ef4s4e. The more zeros are required at the beginning of the Hash [eg. 000000px5kjek56…. ], the more difficult it is to find the Nonce giving the correct Hash.
Once a minor finds the eligible Nonce for a block, it immediately broadcasts the block to all the nodes on the network. All other nodes will check if the Hash is valid. If so, they add the block to their copy of the blockchain and move on to mining the next block.
Source: medium.com
This mechanism avoids the double spending issue. Once you send a bitcoin to a wallet, it is impossible to spend it a second time. For security reasons, normally this assurance is given after 6 blocks (approx. 1 hour). Thanks to blockchain, Satoshi Nakamoto was able to solve the double spending problem and to create a decentralized payment system, allowing everyone to become their own bank.