How the BlockChain Works?
Whether or not there is a Satoshi Nakamoto is a moot point. What is clear is that in the aftermath of 2008, two lessons were learned by too few:
- Spending more than one owes – debt – entails a departure from pure capitalism in that it introduces a form of bondage into a system that should be concentrated on the communication of value rather than social relationships; and
- Trust, the basic emotion upon which is based the ability to ascribe value to little metal disks and painted paper (i.e. money), is too central to the capitalist system to be ascribed to mere humans (i.e. bankers)
Nakamoto was one of those thus gifted, and these two points were the basis upon which Bitcoin was founded (a: communicating value and, b: trusting the medium of communications); and although there have since been other cryptocurrencies that deal with these two challenges differently, it is worth understanding at least one of the,.
Bitcoin’s approach is pristine and clear, albeit somewhat flawed in its results, perhaps. It can therefore serve as an excellent basis for understanding how other systems work – even those that do not rely upon a blockchain of some form or structure.
This is important, not only for Cryptocurrency enthusiasts, but for all of us. It is the wave of the future, and – because it is safer than any centralized and therefore assailable database – it is the technology that is expected to support future land registries, elections, identity management, medical records … nearly every aspect of life that is subject to the recording of data.
A company that goes by the name of Bitnation, for example, is providing e-residents of Estonia and Liberland with all the administrative tools of a virtual nation.
In the following article, we will explain why the Blockchain was created, how it supports the Bitcoin virtual/electronic/crypto/call-it-what-you-will currency, more or less how it works, and what some of its limitations are.
And, we will show how the system replaces the misguided trust we place in banks, funds and other members of the traditional finance world, with trust in the no-nonsense, non-ego-guided binary workings of a computer.
The Ledger – Communicating Value
Anyone peering at the list of dramatic personas above will notice the absence of one particular character – the Bitcoin. That is because – quite simply – Bitcoin as an entity does not really exist.
That golden disk with the dollar-style crossed “B” is no more than a marketing image. Participants in the Bitcoin economy do not have physical wallets full of little golden coins.
Instead, they have access to a series of online ledger blocks, which are – like regular paper ledgers – recordings of transactions. Each block in the ledger contains all of the transactions executed within a given time period,[i] and together they form a time-continuous chain of such blocks.
Throughout these ledger blocks, all of a user’s previous transactions are recorded. Even one’s account balance is not actually recorded.
Instead, before being able to spend money, or – in the case of Bitcoin – to transfer value to another in return for a service or asset, the system will examine all previous ledger blocks to ensure that the participant has more value (value received minus value spent) than he is about to spend.
In this manner, one of Western society’s most problematic elements – debt – is revoked. One cannot spend more than one has. Ensuring that the payer has sufficient credit is a basic requirement for approving a transaction.
These ledger blocks are distributed throughout the entire Bitcoin network to provide redundancy and security. They are not merely decentralized into a network of hubs and spokes, but actually interconnected, so that they are all identical at any specific moment.
The ledgers cannot be altered by a central bank or authority. Instead, the retainers of the ledger blocks receive a broadcast whenever a new block is added.
They then backcheck their own chain of blocks to ensure consistency and broadcast their approval throughout the network. Only after the entire network has confirmed the coherence of the chain, is the new block approved.
Thus, merely changing the contents of a single block is insufficient, since that change must be approved by the entire network to be properly recorded throughout the system. It must conform to the history of all the identical online ledgers in the network!
The Block – Generating Trust … and Chains
Now, we ask, precisely how does the network confirm that a change recorded is indeed legitimate? How can we automate a system so that it does not require the actual computation of every transaction in the system to verify its authenticity? To answer this, we must take a closer look at the block.
A block is part of a chain of such blocks that comprise the online ledger, which records all the transactions made within a specific timeframe. Each block is identified by a hash – a 256-bit chain (a binary number using 256 digits of 0s and 1s, whose regular value is too large to name – larger than 10 to the power of 78, i.e. 10 followed by 77 other digits) – that is unique to each block.
Besides the transactions, each block contains (as an input that is on par with the parameters of the block’s listed transactions) a timestamp, and the hash of the previous block in the ledger.
Thus, a chain of blocks is gradually formed in which one block cannot be altered without changing the hash identifiers of all of its subsequent blocks.
Each block also contains a 32-bit operator (nonce) that is used to derive the block’s unique hash, based on the block’s recorded transactions and the previous-block’s hash inputs.
This structure aims to undermine the creation of counterfeit transactions. Doing so would alter a previous entry in a previous block, thereby altering that previous block’s hash and requiring an updating of all its subsequent block hashes (which, as mentioned, is based – among others – on the hash of the previous block) until the present.
The Race to Find the Nonce
While, admittedly, the above sounds like a game played by Harry Potter fans, the race to find the nonce is at the centre of the entire Bitcoin system.
As mentioned, the nonce is a 32-bit chain, which means that there can by more than 2 billion of them; and it is used as an operator to derive a hash (block identifier) based on the transactions of the block plus the hash of the previous block.
Now for the hard part: The Bitcoin system specifies a maximum value or specific value range for the Hash, and because it is applied randomly upon several inputs (the transaction parameters and the previous hash), there is no way to reverse engineer it from the resulting hash, since this would entail knowing – not only the nonce – but also how it applied to each input from the block.
The only way in which to arrive at a hash that fulfils the system’s requirements is to try one nonce after the other until the desired hash value is derived. Nonces are tested one after the other at a rate measured in quintillions-per-second.
To do this, increasingly powerful computers are required to test the ever-shrinking number of available nonces (even 2 billion permutations will eventually run out). And this is where the race element steps in.
The moment a block is closed for new transactions, a new one is initiated. Immediately, the race is on to find the correct nonce for the newly-closed block.
As soon as this nonce is found, the block with its nonce and resulting hash is submitted for approval to the entire network of miners and other parties hosting the ledger. Simultaneously, the newly opened block is closed and submitted to a new race, and a third block is opened for new transactions.
Miners! On Your Mark!
Miners execute the most important task in any monied society. Without them, there would be no gold, copper or silver; but there, the similarity ends.
In the Cryptocurrency world, miners are the people (well, their CPUs and GPUs, actually) entrusted with sitting by their computers and testing nonces.
Clearly, testing one nonce after the other is power-intensive (it uses up lots of electricity) and it needs to be done very quickly, since most people will not want to sit in a restaurant for hours, waiting for the Bitcoin network to approve payment.
On the other hand, the miner will not want to invest time and money in a process that requires the approval of an entire community unless he receives remuneration for his work.
In the beginning, miners were mostly computer enthusiasts with above-average computers using graphic processors, simply because these are faster than the central processing units to be found on each computer.
Now, however – as the competition for finding nonces from an ever narrowing pool increases and the reward shrinks – their task has been almost overtaken by large corporations with even larger computers.
As mentioned above, miners are incentivized through payment[v] in the following manner.
To each block is added one transaction in which previously non-existent value is created (a “newly minted bitcoin”) and credited to the miner who finds the correct nonce first.
The miner receives his payment after he submits the block with the correct nonce and newly-ascribed hash to the network and it is accepted by all participating computers.
The accepted nonce represents what is referred to as “proof of work” (since it entails a lot of work), and it is also proof of the miner’s dedication to the system: he has invested work, time, electricity and other resources to the search for the nonce and hopes to receive remuneration for his work, once it is approved.
Thus, the self interest of the miner is that which is at the basis of the system’s trust in him. There can be no conflict of interest, as there exists in the banking world, where perverting the system can often result in gains due to the system’s inherent flaws.
And So, To the Drawing Board
The finalized process of creating the Blockchain (a chain of blocks) is thus:
- From the moment a previous block (call it “1”) has been closed to accepting new transactions, a new block (“2”) is initiated.
- At this point, miners begin the race to find the nonce for the closed block (“1”).
- A nonce is found for Block “1” and it is submitted to the network.
- Once approved, it joins the chain and its hash is added to the newly initiated block (“2”).
- Simultaneously, the new block (“2”) is closed and submitted for the next race to find its nonce. A new block (“3”) is initiated.
The only time this process is disrupted is when two people find nonces at the same time that generate hashes that fulfil the value parameters set forth by the system.
We now have two timelines – two chains emanating from the same source: a fork. In this case, payment for work is withheld while the race for finding the nonce of the next two respective blocks (one continuing each timeline) is on.
Both these blocks contain the same transactions, and the race is not only between miners, but between two timelines. The first block submitted and accepted by the network determines which of the two timelines will be the “legitimate” one.
Payment goes to the originator of the winning timeline, and the blockchain continues from there, the other timeline ceasing to “exist”.
This is clearly a limitation of the system, meaning that work is often done for which there will no remuneration; however, this risk can be factored into the pricing.
Other problems with Bitcoin’s blockchain include increasingly lengthening processing times and the number of possible transactions per block. Also, the larger the blockchain grows, the bigger the servers required to host it.
As a result, power is once again being concentrated into the hands of large corporations (read: banks), defeating the entire grass-roots premise of the original instigators of the system.
Another limitation is that the more bitcoins minted, the more hashes and nonces found, the slower the system becomes and the more resource hungry (electricity and CPU/GPU power) are required.
As a result, the mining industry gets more and more centralized in the hands of those who can afford to undertake this task in the hopes of cornering the market. Already, hundreds of thousands of miners have dropped out of the game, since they cannot afford the bills and/or deliver the goods on time.
The corollary of this is that once about 50% of the ledger is in the hands of a single entity, it becomes open to manipulation. There are many more limitations to Bitcoin’s blockchain – some of which are addressed by the ledger workings of other cryptocurrencies.
From the user’s point of view, besides longer transaction times mentioned above, the greatest danger posed by the system is the inability to retrieve a lost key. Since keys cannot be retrieved, this entails a total loss of one’s assets.
Introducing: The Blockchain
And so, we have the blockchain – a continuously growing chain of blocks that record all of the transactions a person has made, safeguarding him/her from overspending, and from the whims of banks and other financial institutions.
It is a completely comprehensive and independent mechanism, in which trust in your banker is replaced with trust in the technology. That technology, upon which the Blockchain is based, is quite simpe and provides for many the hope of an end to corruption and (often) mere administrative incompetence.
As we watch capitalism slowly sink again and yet again into its self-satisfied self-delusion and unbridled greed, cryptocurrencies offer freedom from financial institutions and – hopefully – an immunity to the stupidities and ill will of those to whom we entrust our savings.
[i] Having said this, we should stress that the values recorded use a unit called Bitcoin, of which a maximum of 21 million will ever exist within the system. The fiat-value of each of these Bitcoins is in dramatic flux – having started as being equal to half a pizza and reaching a maximum value of $20,000 in December 2017 – subsiding dramatically thereafter and leveling off in the $3,000-4,500. region as of this writing (circa 2018).
[ii] The maximum number of transactions a block can contain is about 2400, depending on their levels of complexity. On average, there are about 500 transactions in a single block. In addition to the fixed payment for solving a block, miners can also receive additional incentive from the providers of transactions; and the higher the fee paid, the higher transaction’s priority for inclusion in the current block.
[iii] The nonce is added to the end of the other transaction parameters and the previous block’s hash number. The numbers are then hashed (deriving a number from a string of text) using SHA256 encryption – an encryption protocol developed by the US’ National Security Administration.
[iv] In fact, this requirement changes every 10 minutes.
[v] The payment for solving the first block created by Nakamoto (the “Genesis” block) was 50 Bitcoins. Because the number of Bitcoins to be mined ever, is to reach 21 million, this reward gradually drops – it is halved every 210,000 blocks, and is expected to hold at its present 6.25 Bitcoins until about 2020.
Open your trading account at AvaTrade or try our risk-free demo account!