Cryptoassets and the Next-Generation Web: Mining

in #blockchain6 years ago

CRYPTOASSETS AND THE NEXT-GENERATION WEB

MINING

In the last essay, we left a question hanging in the air, which was ‘how does Bitcoin incentivise the maintenance of the public ledger’?

This is where miners come in. The term ‘mining’ might bring to mind images of folks digging in order to unearth some valuable resource. Indeed, videos explaining how cryptoassets work tend to encourage such an interpretation, as they often feature cartoons of men in hard hats, swinging a pickaxe at a rock pile in order to get at the precious bitcoin.

BDFCE591-C21F-4817-BD0C-4670E7B00112.jpeg

In actual fact, ‘miners’ are not men in hard hats but networked computers running the blockchain protocol, and what they are doing is confirming transactions. So when people talk about mining in the context of cryptoassets, what they are really referring to is a form of bookkeeping.

At the foundation of mining there is a form of cryptography known as a ‘hash’, or an encrypted alphanumeric string of characters. Bitcoin uses an algorithm known as SHA-256, which is a hash 64 characters in length made from the numbers zero to nine and the letters A to Z. The purpose of a hash is to take information and then summarise and reduce it to a smaller store of data. In the case of SHA-256, it will generate a unique 64-character hash regardless of whether you input a single letter or the complete works of Shakespeare.

So long as your computer can access the underlying source data, verifying the hash to check it accurately encapsulates the data is pretty simple. It’s kind of like how you can easily check to see if a sequence of numbers opens a combination lock by inputting that sequence and seeing if the lock opens. But should even the tiniest change be made to the underlying information, that will result in a completely new hash. So, by being able to pack lots of information into the same hash structure while guaranteeing totally different results every time change is made no matter how trivial it may be, hashes provide us with a very powerful encryption tool. If you don’t have access to the underlying data, it’s nigh on impossible to decrypt the code and see what it contains.

Another useful thing that hash functions allow for is the building of a hash hierarchy. Where Blockchain is concerned, ‘miners’ are able to group concurrently times transactions together. It works something like this: The hash of the first transaction along with its underlying data is taken by the miners’ software client, which it then combines with the raw data of the next, unhashed transaction. This results in a full record of both transactions, both now hashed. The process then continues for the second hash (which, remember, now contains two transactions’ worth of data) and merging that with the next transactions’ information to form a third hash. And so on. All the while, as new transactions are picked up the computers take that data and package it into a single hash, and by working back through the unbroken chain one can easily verify the underlying code at a later time.

At the same time, there is a kind of lottery going on, in which every computer competes to be the first to prepare a block for insertion into the blockchain. The network is unable to confirm the validity of the latest round of transactions until that insertion occurs. So, for now, each miner is individually hashing and rehashing the underlying data. According to Paul Vigna and Michael J. Casey, the lottery involves “simultaneously and rapidly coming up with new potential block hashes to encode and capture all the data in the new, fully packaged block and link it to the block hash of the previous block. The winning block hash must match one that bitcoin's core algorithm has decided will be the current block's winning number”.

BD4B2CDF-1C98-458F-8202-BB9C0D490EB8.jpeg

The computers create these new hashes by adding a ‘nonce’, which is a unique, randomly generated number, to the data already contained in the block hash. Actually, there are four pieces of data involved in this process, which are the hash of the transactions for the current block, the hash (identifier) of the previous block, the time, and that random number with the curious name ‘nonce’. The computers in the Trustless Decentralised Ledger network take these variables and generate new nonces in the hope that the new variable will be the ‘golden hash’, which is the hash output with the right number of zeros and other conditions the blockchain’s algorithm was looking for. When it comes to finding the golden hash, not all computers are equal, since more powerful machines will have a higher ‘hash rate’, or number of times per second with which the computer can run the four variables through a hash function to derive a new hash.

Once the golden hash is found the puzzle is solved and the winning miner inserts a new block of transactions. Included in the new has is the previous block, so what we have here is a mathematically-linked chain of blocks whose underlying data is extremely sensitive to change, due to that hypersensitive quality hashes are known for. This is why nobody can tamper with the public ledger without bringing attention to their actions.

Remaining work needs to be done once the new block of transactions is added to the Blockchain. This work involves the other miners verifying the winner’s proof of work by comparing data from the underlying transactions to the hashed data within it so as to check it against the history of the blockchain. Once this is done, we have confirmed the legitimacy of the underlying transactions contained within its block.

REFERENCES

“Cryptoassets” by Chris Burniske and Jack Tatar

“Cryptocurrency: The Future Of Money?” By Paul Vigna and Micheal J Casey

“Hidden Secrets Of Money” by Mike Maloney

Coin Marketplace

STEEM 0.31
TRX 0.11
JST 0.033
BTC 64275.02
ETH 3139.81
USDT 1.00
SBD 4.14