Cryptocurrencies and Block Chain Technology
Cryptocurrencies are very much talked about. Whereas trading cryptocurrencies (Bitcoin, Ethereum, Litecoin to mention a few) is highly speculative and not recommended for now, the underlying technology for secure crypto currency transactions is pretty robust. This is the “Block-Chain” technology. This technology is completely distributive. The transactions are directly between sender and receiver with no central agency such as banks or other entities involved. In the following pages I describe how these transactions are so extremely secure. “Block-Chain” technology was originally invented for Bitcoin transactions. But now it is being considered for secure storage of information such as health care, personal data, deeds, etc. It is currently a hot topic of research in computer science.
What is Block-Chain?
In short it is a digital, distributive, public but securely interlinked ledger of authenticated transactions. The ‘authentication’ is done by consensus among a set of distributed computers called nodes. The distributive nature and minimal human involvement are the things that makes the transactions so secure. The transactions are publicly available to look at, but it is extremely difficult to change/steal the information.
The “Block-Chain” discussed here is mostly for Bitcoin transactions. Most cryptocurrencies use Block-chain for their transactions although the process they use might be slightly different. Some claim the movement of transactions to be faster than that in Bitcoin or to use less resources (computer power, electricity). But the basic idea is the same. Hence in this article, we use the terms bitcoin, cryptocurrency, and data interchangeably. Creating a "Block-chain" (or a distributed public ledger) that is faster, secure and more efficient is the subject of research in computer science.
How does it work?
There are several steps involved. To start with, let us say a transaction occurs between two parties and one party (sender) agrees to send the money/data to the other (receiver). The sender sends the transaction details online.
Step 1. Authentication of the transaction Authentication is to make sure the data is correct and if money transactions are involved, check if there is enough cryptocurrency in buyer’s vault. The data is broadcast publicly to a peer-to-peer (P2P) network of computers (ex: make sure the person buying a service has enough crypto currency). The data is broadcast publicly to a peer-to-peer (P2P) network of computers. A P2P (Fig. 1) network is s a distributed set of computers called nodes, which can communicate with one another, without having to go through a central server or agency (like a bank or a government). Each node is capable of automatically verifying the legitimacy of the transaction (ex. make sure the sender has enough crypto currency in his vault). Once a consensus among nodes regarding the legitimacy of the transaction is reached, the transaction is time-stamped and recorded on all the nodes in the network. Because of this distributed aspect, it is hard for anyone to change a record, since any change on one node will be detected by all the other nodes and the consensus is broken.
Software on nodes package up the validated transaction together with other recent transactions into a single file called a ‘‘BLOCK’.
Step 2. Mining
The process of attaching the new BLOCKS to the Block-Chain of previous blocks consists of two steps:
· Auditing the previous blocks on the Block-Chain
· Creating a unique finger print for the new BLOCK and adding it to the Block-Chain
Special nodes in the network (or the person/team who run these computers) called miners bid for these tasks. The bidding process involves finding a partial solution to a hash based mathematical puzzle. What the partial solution should be is arbitrarily defined by the network. In cryptography, hashing is a process of mapping arbitrary data into a fixed length binary number using a mathematical function called cryptographic ‘hash function’. The hash value is not unique, but if the hash length is large (ex. 256 bits), it is extremely rare for two random data sets to have the same hash value. A cryptographic hash is a one way mapping. One cannot re-construct the data knowing its hash value.
The puzzle is created as follows.
First the data in the block is combined with a 32 bit random number called nonce (“number that can only be used once”) and sent through cryptographic hash function.
The task is to find what nonce (grey box) gives a result that is less than target value given on the right hand side.
The puzzle is broadcast to all the miners. Knowing the data and what partial result to get, miners use a brute force trial and error method to find the partial solution of the puzzle. The miner who solves the puzzle first wins the bid and is rewarded financially (ex. certain number of bit coins). Once the solution is found, the time when the answer was found and the answer are immediately broadcast to all the mining nodes. Once the answer is verified by all the mining nodes, the winner is rewarded with a certain amount of cash (cryptocurrency coins) (The process is called mining because it involves brute force digging to find the solution).
The process of mining requires running calculations repeatedly for a longtime. This requires powerful computers and is extremely energy intensive. In many cases the cost may be more than the reward. Finding alternative methods to mining or making it more efficient is an active area of research in computer science.
Step 3. Fingerprinting and adding the BLOCK to Block-chain
The successful miner has to verify a certain number (given in megabytes) of previous blocks on the Block-Chain. This is essentially auditing to make sure that there are no tampering or duplications of the transactions and/or double dipping.
Once this is done, an 80 byte header is created containing: 1) Bitcoin version number, 2) finger print of the previous block (F0 in figure below), 3) hash of the present data (merkle root, D), 4) time when the block was created, 5) difficulty target (difficulty in solving for nonce by miner) and 6) the nonce found by the miner(proof of work). Next, a unique fingerprint is generated for the new BLOCK by hashing the header info.
The new block is then added to the block-chain and the block-chain is broadcast to all the nodes in the network.
Note that the fingerprint of each block in the chain is nestled with its neighbors. This makes it extremely secure. Even if one bit of information is changed in one block, every subsequent block in the chain will be altered. Further, because of the distributed aspect of the network, any change to the chain on one node is immediately gets detected by the other nodes and the consensus is broken.
Finally, the receiver receives currency/data.