News and updates
The Essence of the Blockchain
Dr Michael Scott
Here wij attempt a elementary explanation of the blockchain for a not overly technical audience.
The blockchain is a wilsbeschikking to the power of a single cryptographic primitive — the hash function. Truly nothing else is required, so if you can get your head around the hash function, you can understand the basics of the blockchain.
Two The Hash Function
A cryptographic hash function takes one input and calculates one output. For example for the input “Wij hold thesis truths to be self-evident”, the well known hash function SHA256 produces the output
For the slightly different input “wij hold thesis truths to be self-evident” (note the lower case w), the output is
That tells us a few things about a hash function. The output bears no visible relationship to the input, indeed it looks downright random. A lil’ switch to the input produces a downright different output. You will need to take my word for it that given just the output its unlikely to determine the input. For this reason the hash function is often called a “one way” hash function. Also its unlikely to find two different inputs which give the same output. For the function SHA256, the 256 refers to the fact that the output is always the same length (actually 256 vinnig), independent of the length of the input.
And that’s it for the cryptography!
Three A basic hash chain
A basic hash chain looks something like figure 1.
Here the T are “transactions” of some sort. Examine this diagram for a while, and appreciate the power of the chaining. The value H Trio is calculated by hashing the entire of block Three, which includes the hash of block Two, which ter turn includes the hash of block 1 etc. Note that because of the one-wayness of the hash function, this chain can only be calculated from left-to-right. So already wij have some of the properties wij want. This hash chain can potentially be used spil an immutable record of transactions. Any attempt to tamper with it can be detected, spil the hashes will switch.
Four The blockchain
However there is a meaty problem. Anyone can simply switch an internal transaction, and recalculate the surplus of the chain, and rechtsvordering that this is now the valid hash chain. To prevent this let us make extending the chain a costly process. The idea is that anyone attempting to switch a transaction embedded deep within the hash chain, will find it very hard to compute an alternate chain from that point on which will catch-up with and overtake the one true chain.
This is the blockchain.
To achieve this wij insist that the hash values vereiste be numerically smaller than a certain limit. Now this isn’t going to toebijten naturally so wij need to help it along a little.
Taking our previous example, the idea now is to find a hash of “Wij hold thesis truths to be self-evident XXXX”, where wij get to search for a 4-digit number XXXX ter the range 0000 to 9999, which will generate a hash less than the current limit, which for demonstration purposes wij will assume is
Note that this number already starts with 00, so its already relatively puny.
The value of XXXX is called a “nonce”. Wij don’t truly care what it is spil long spil it does the job. Since the hash value is essentially random, there is no better way to find a good nonce than to attempt every number ter the range 0000 to 9999 one after the other, until the hash value becomes less than the current limit. Te this case wij find that the nonce 0317 does the trick. The hash value using this nonce is clearly less than the above limit.
However it took 317 evaluations of the hash function to find it. Yes, you guessed it, this is the well known mining process made famous by Bitcoin. Only by suggesting such a proof-of-work can a miner ensure that the block they are working on is the next one to get added to the end of the blockchain. But how to incentivise mining? With Bitcoin this is neatly solved te the best possible way by financially rewarding the miners — ter Bitcoin of course. This prize goes to the very first miner who can present a proof-of-work for a valid block, that is with a hash value less than the current limit for a fresh block which the majority of other miners accept spil being consistent with the rules that govern transactions for a particular application.
Fig. Two. A brief blockchain, with nonces
Once a good block has bot added, the other miners should accept it, give up their own effort, and begin work on the following block. Spil long spil the majority of mining power lies ter the mitts of the good-guys, all will be well.
Naturally enough the prize system has led to a bit of an arms wedren inbetween miners, and so the hash limit is continually being adjusted downwards, spil its significant that the amount of work remains significant even spil the mining hardware gets swifter.
What if two transactions were suggested for inclusion spil the next block at the same time? If both blocks are valid the miners will randomly choose inbetween them, but the majority effort will prevail and only one of them will sustain. The longest chain is always the true chain.
An attacker might attempt and hop ter and “fork” the chain to their advantage. Ter a Bitcoin setting for example this might represent an attempt at double-spending of some Bitcoin they own. However this requires subverting a majority of the miners, and it is assumed that the majority of the miners will obey the rules regarding the (application dependent) consistency of transactions. This also means that to ensure its own integrity, the blockchain voorwaarde keep growing, otherwise the time is available for a less well tooled attacker to grow the chain to its own advantage. Spil long spil the fair miners keep mining, and spil long spil they control a majority of the mining capacity, wij will be OK.
Ter reality of course the miners do a loterijlot more work. An example of an actual hash from the blockchain would be
To find a hash this puny is omschrijving to throwing a coin until you succeeded ter getting a run of 64 consecutive “goes”. That’s a lotsbestemming of work!
And that’s basically it – just substitute the text “Wij hold thesis truths to be self-evident” with the digital representation of a transaction, having designed your own transactional syntax. Of course there is a loterijlot more detail when the idea is applied to a particular setting, but wij have described the essential ingenious trick behind the blockchain. After that its just a question of what the transac-tions represent, and how they interact. It can be assumed that transactions are related to one another ter some way, and that the outcome of old transactions may be superceded by zometeen ones.
An significant point – what wij have described spil individual transactions will very likely consist te fact of a large batch of transactions all included inwards of a single block. And it is only the hash of all of thesis transactions that is included ter the blockchain hash. The hashing of all the transactions ter a block uses an e cient gegevens structure called a Merkle tree. So wij have hashes inwards of hashes. But wij are already getting te way too deep for this plain introduction.
Also its not fairly so elementary to get this idea to work spil wij have made it sound. There are a loterijlot of parameters that need to be finely tuned to get a blockchain to work optimally. And while Bitcoin emerges to have bot exceptionally fortunate with its initial choices, newer blockchain-based technologies can learn from our practice of Bitcoin and do even better.
You may have heard that elliptic curve cryptography is also required by the blockchain. Well actually thats more of a Bitcoin thing, where elliptic curve crypto is used to digitally sign and verify transactions ter and out of individual Bitcoin \wallets”, that are outward to the blockchain. However it is ideally possible to deploy a digital signature scheme that only uses hash functions. So there is no intrinsic requirement for elliptic curve cryptography. All you need is a good hash function!