3 How does Cryptocurrency Function?
3.0.1 Achieving ‘distributed consensus’
Bitcoin was the first digital currency that functioned without a central mediator. Before Bitcoin came about there was no way to achieve distributed consensus without a centralised actor. Distributed consensus simply means a large pool of people who are geographically segregated agreeing on something. The way that Bitcoin solved the issues of trust that made a decentralised currency impossible to achieve was the invention of the Blockchain.
3.0.2 Bitcoin’s Blockchain
Bitcoin’s Blockchain is essentially applied three main cryptographic concepts to a single distributed ledger (an open ledger everyone has access to): Digital Signatures, Merkle Trees, and the cryptographic concept of Proof-of-Work.
3.0.3 Digital Signatures
Digital signatures ensure that all transactions on the network are authentic. Every transaction will be encrypted with the signing key can only be decrypted with the verification key. Digital signatures are applied so that every transaction has a unique signature that could only be achieved with a private key. A useful to think of it, is when someone makes a transaction to an address he/she essentially states that ‘I give the right to spend this money to the person who owns the private key corresponding to this address’. The person who has received this transaction will in turn be able to spend the transaction by signing the transaction using his private key. With this signature, he can prove that he owns the key, without even disclosing it. Others can verify the signature using the public key.”
3.0.4 Merkle Trees
Merkle trees provide a way to chain together groups of authenticated transactions. Merkle trees ensure this by utilizing the technique of hashing. Hashing is the transformation of string of characters into a usually shorter fixed-length value or key that represents the original string. Each block is chained to the preceding block by containing a hash that could only be generated using the previous block’s hash. For this reason, Merkle trees are often also referred to as Hash trees. Here is a useful video tutorial of this.
We can see that the smallest change in the message will drastically alter the resulting hash. Merkle trees work by using hashes to create a chain, where a block of data can only be added by using the previous hash. If one block is changed then the rest of the blocks will be changed. This is visually represented below. Numbers have been used instead of actual hashes for clarity.
3.0.5 Proof-of-Work concept
The first two cryptographic techniques have ensured that every transaction requested to added to the ledger is authentic and there is a way to order the transactions into blocks. However, if the Bitcoin creators left things here it would still be chaos.
There wouldn’t be a way of agreeing which chain of blocks to choose to summarize all transactions, there would lots of different versions emerging. This is where proof-of-work comes in. Proof-of-work ensures that each block added takes time to ensure that there is order and one single chain of blocks. Users dedicating time to process transactions they are rewarded units of currency.
What is exactly this proof-of-work? Essentially for each block to be added to the chain it needs to undergo a validation process that involves solving a puzzle. Each block starts with a default hash, this is the block is put through a function that turns it into a set string of unintelligible data as explained earlier. Users wishing to earn the Bitcoin reward need to add other characters to the block until the resulting hash starts in a certain number of zeros (currently 18). This difficulty (more zeros required) is enhanced every time 2016 blocks are added to the chain. The diagram below shows that with just one character change.
3.0.6 Alternative mechanisms to achieve distributed consensus: Proof-of-stake
Proof work functions in a way that the more computational power you have the more likely you are to add a block to the chain. Proof-of-Stake functions in a way that the more wealth you stake towards the effort of adding blocks to the chain the more likely you are to win the block reward. In proof of work you will win a certain amount for instance 12.5 Bitcoin or 6 Ether. In proof-of-stake you will tend to win transaction fees. In the visual scenario below we can see that Alice would have the best chance of winning the block reward as see has largest proportion of cryptocurrency.
3.0.7 Proof-of-Stake versus Proof-of-Work Summarised
3.0.8 A Bitcoin transaction
If the above seems to technical here demonstration of transaction using Bitcoin where technical terms have been taken out. It shows how Alice would go about transferring Bitcoin to Bob.