Creating a trustless secure network - the nuts and bolts?
A not too technical look at how hashing and proof-of-work helps the Bitcoin Network
The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. - Bitcoin: A Peer-to-Peer Electronic Cash System, Satoshi Nakamoto
Creating a peer-to-peer network may be easy. But ensuring that it is secure is anything but. The bitcoin white paper proposed a "hash-based proof-of-work" chain to provide this security. Interestingly the document refers to Adam Beck's Hashcash and offers a solution similar to the 1997 paper. The Hashcash paper was updated in 2002 (Hashcash - A Denial of Service Counter-Measure Adam Back - it's a difficult read). Even more interesting is that a similar solution was proposed by Cynthia Dwork and Moni Naor (Pricing via Processing or Combatting Junk Mail) as far back as 1992. However, Adam Beck insists that he wasn't aware of their work.
The older papers proposed using hash-based proof-of-work solutions. The primary concern was spamming, and DoS (Denial of Service) attacks back then. I felt the need to dig into these three papers and understand the underlying concept. I'll be honest; I had to read them several times to get even a basic understanding. I think the idea of hashing and using proof-of-work is essential to understand. They are the foundational technologies that make Bitcoin possible. I will attempt to explain all this as simple as possible (more for my own understanding). Let me clarify that my explanations will explain how these technologies have been applied to Bitcoin.
What is "hashing"?
To understand hashing, let's begin by defining the problem. Let's take the example of the problem Bill and Ted (fictional characters) are facing. Bill and Ted are starting a new internet community. A social platform for people wanting to share recipes for zero-calorie, keto, gluten & vegan-friendly food. They have to ensure that their user data and password are stored securely. They have to keep hackers out of the platform and ensure that user privacy is secure.
One of the most common solutions to Bill & Ted's problem is using a hash function! Using a hash function, they can easily store user data securely. This is how it works. When a new user signs up to their recipe platform, their information, like username, password, etc., is stored in a database. But this is a unique database. It uses a mathematical function (formula). The algorithm converts the characters entered by the user into a new set of characters of a fixed length. For example, if the fixed length is 24 characters long, irrespective of whether the user creates a password with 6 characters or 16 characters, the hash function value will always be 24 characters long.
If a hacker manages to get access to the database of users, they will find only the hashed value. The mathematical functions used to generate such strings are usually one-way functions. No hacker should be able to get the password with only the hashed string. Secure hash functions also ensure that even if a hacker has access to both a user's password and the hashed value, they will not be able to reverse engineer it to figure out other users' passwords. Essentially, using hash functions gives Bill & Ted peace of mind.
This is essentially what the Bitcoin network does. It uses hash functions to create encrypted public and private keys and also uses hash functions to verify transactions. How does this work?
Look forward to more in a future article.
Why is "Proof-of-Work" important?
The proof-of-work concept used in Hashcash is very different from that proposed by Bitcoin. Still, they both serve the same purpose. Adding an additional resistance layer to ensure that the data is authentic. Let's try and understand.
Hashcash was created to battle email fraud and spam. This was achieved by passing the email message through a hash function. A textual encoding of a hashcash stamp is added to the header of the email. This will prove the sender has actually done the work and expended CPU resources. How does this dissuade spammers?
Many emails have to be sent out at a meagre cost for spamming to work. If the spammer has to pass every email through a hash function, the quantum of CPU resources required (more expensive computers, more power consumption, etc.) will make the task unviable. As a receiver of the email, the hashcash stamp in the email header is proof that the sender has put n the work, so it must be genuine.
Bitcoin also uses proof-of-work. But it doesn't expect regular users to do the work of creating and checking hash functions. Instead, this task is performed by a set of timestamp servers called nodes. The paper clearly notes that it will be a CPU intensive task and proposes to incentivise anyone ready for it. Nodes set up to do the proof-of-work will be rewarded with Bitcoins.
It was theorised and then proven that as the volume of bitcoin transactions goes up, more computational power would be required to solve for proof-of-work. Its value would increase as people started using it as a medium of exchange. As transactions increased, the value of Bitcoin itself would further increase. So nodes will essentially get rewarded with Bitcoins for ensuring that the transactions on the bitcoin blockchain are authentic. However, becoming a miner is very risky as getting Bitcoin is not guaranteed. We will explore this too in a future article.
The Bitcoin paper goes into more detail on how proof-of-work is carried out. It also highlights how it dissuades bad actors. And encourages participants in the network to ensure security and authenticity. We'll discuss this in the next article.
Please share this article with like-minded friends and family if you liked this article. Don't forget to like and comment!