Bitcoin: A Peer-to-Peer Electronic Cash System - Laymen's Version
The following article aims to rewrite Bitcoin’s original paper from a common man’s view. It may not be the most technically correct version. The purpose of this is to simplify Bitcoin for people who have a basic understanding of finance and little technical knowledge.
A digital version of money should work similar to its physical counterpart i.e. cash. It works without the involvement of any bank or third party payment service. The digital transactions can be protected using a private key or a password, there should be no need to use any central bank to facilitate these transactions. This can be achieved by creating a network of nodes who maintain the network. Every transaction also records the time of transaction. The computers are used to encrypt each transaction into a hash. Every hash will be linked together to form a chain of transactions/hashes. As long as more than 51% of the nodes are honest, the chain of transactions will record true transactions. Every person who is part of the network sees the updated chain and updates their records. Anyone can be part of this network and help create an honest ledger.
The number of people who use online transactions is on the rise. Online transactions are not limited to buying clothing or electronics but to book a travel ticket, a hotel, order food, and book a salon. A large part of the society sends money to their near and dear ones digitally via banks and third party financial institutions. They use either a credit card or a digital wallet like Paypal to make these transactions. These payment companies record each and every transaction. They also control how much, at what time and to whom people can send or receive money from.
Earlier internet was primarily used to connect to other person via mail or messages. You could delete a message or email that you have received. You could delete a Whatsapp message for everyone in a group. Also, you can send the same message to different people.
Imagine if the same could be done with the money. A vendor deletes the record of the payment you have made. A customer reverses the money they have paid to the vendor. The most troublesome would be if a customer keeps on spending the same money again and again like sending a Whatsapp forward.
Inherently buyers and sellers do not trust each other. These companies (credit cards and digital wallets or your banks too) bridge this trust gap and act as a supervisor for safe transactions. These companies own payment gateways. They decide who can use the gateway for the transactions and the amount. There are invisible extra costs to manage the payment gateways securely. Physical cash does not have similar issue. Digitally no such mechanism to safeguard transactions had existed earlier.
Bitcoin aims to create a network where a customer and vendor can transact without the need of third party companies. A customer and a vendor can directly transfer money to each other. Nodes who are part of the network will update the ledger with encryption code that verifies their transactions. No one would be able to see the exact details of the transaction. The transactions are stored as a hash with a timestamp. Computation power of computers connected to the network converts these transactions into hash and link them together. The transactions are completed then stored in chronological order.
Every transaction is linked together. To reverse any transaction, more than 51% of the total computers need to work together to break the chain and rewrite the transactions.
A digital wallet stores your Bitcoins. Your password/private key can be used to unlock the wallet and do transactions. Each transaction is encrypted using an algorithm, SHA-256 and stored as 'hash'.
The hash of a transaction is created using wallet address, amount to be send, wallet address of the payee, and the hash of the previous transaction. The payee can use their own private keys to prove the ownership of their wallet and claim Bitcoins.
One of the concern with any transaction is the issue of double spend. Double spend is when a person can spend same money again and again and no proper records are maintained. The most common solution to this problem is to have a central authority like a bank. The bank records every transaction. They keep a record of old and new balances. The problem is that the whole system depends on the functionality and efficiency of the bank. In the past, we have seen banks are not unbiased and do favors particular individuals and companies.
The payee still needs a system to know that the Bitcoins transferred to them are legitimate. The only way to make sure of this is to be aware of all transactions previously done. The banks played a similar role by keeping a record of all transactions. To do this without a central bank or company, the ledger of transactions must be public. All the people who are part of the network have to agree that up to a certain time, all the transactions recorded are verified and valid. The payee can be assured that the money they received will not be spent again by the sender and now belongs to them.
Transactions need to be timestamped to verify the time of transfer. We created a network where we record the collection of transactions(as hashes) and the time of transaction. This collection of transactions is called a block. It contains the current timestamp as well as details of the timestamp of the previous block. We are able to form a chain of timestamps and the transactions associated with them. This links all blocks and increases the security of the chain. Every new block secures all the previous blocks, transactions and timestamps.
All the transactions are encrypted and converted into a hash using an algorithm called SHA-256. We have defined a certain format of the hash i.e. the hash should start with fixed number of zeros. Computational power is required to convert our transactions and collections of transactions into hash. In a block, we store the hash of the previous block, timestamp, our transactions and a random number. The computers work to find the random number. This random number helps in finding the right hash format for the block.
Once the block is connected to other blocks in the chain, it’s content cannot be changed without doing the work (as earlier done by CPU to calculate the random number and hash). As more blocks are chained, it becomes more difficult to change the previous block. To modify the past block, an attacker needs to redo proof of work for all the block after it and do more work than the honest blocks
Longest chain of the network has the highest proof of work.
Different blocks can be verified at the same time. The block which is verified by the maximum number of computers is considered to be part of the chain.
By default, the average time of computing a block is 10 mins. If there is more computational power working on finding the next block, the difficulty of computing the hash is increased to keep the average time of mining the block same.
The steps to run the network are as follows:
1. A transaction happens when a person A sends Bitcoins to person B
2. This transaction is broadcasted to all the nodes
3. Nodes have a record of all the transactions inluded in Blockchain.
4. Nodes will verify the transaction
5. If the transaction is valid, they will include it in the block
6. As soon as a node, completes the block, they braodcast it to the network.
7. Other nodes will verify the transactions and accept this block as the next in the chain
The longest chain of blocks will always be considered the correct chain. If two nodes broadcast different blocks at the same time, some nodes in the network may receive one or the other first. In this case, the nodes start working with the first one they received, but also save the other branch if it becomes longer. The tie will be broken when the next block is found and the branch becomes longer. The nodes that were working on the other branch will switch to the longer.
Broadcast of New transactions does not need to reach all nodes. They need to reach many nodes, they can get into the block. Similarly, the block does not need to reach all the nodes. Let’s say a node receives Block N+1 and not Block N, it will realize this and request the Block N from the network.
The nodes can be run by anyone. It takes computation and electricity to run a node for the Bitcoin network. There is an inbuilt incentive for people running the node. Whenever a new block is found, the creator of the block gets a fixed number of Bitcoins in reward.
It is also a way to generate more Bitcoins as there is no central authority to issue them. The nodes can also earn from the transaction fee. The transaction fee is predetermined before the transaction and is added to the value of the transfer, at the time of transfer. Once a predetermined number of coins have entered the circulation, the nodes can earn entirely from the transaction fees.
This method of incentive, encourage nodes to remain honest. A greedy attacker can choose to defraud people by stealing back their payments or they can remain honest and earn new coins and transaction fees. It is more profitable for them to remain honest than to undermine the system.
Reclaiming Disk Space
Keeping a record of all the transactions can use a lot of memory. One of the methods to save disk space is to discard the older transactions. This can be done by creating a hash of transactions in Merkle Tree.
A Merkle tree creates a single hash for all the transactions included in a block.
Merkle Trees are created by repeatedly hashing pair of hashes of individual transactions until there is only one hash left. The Merkle Root summarizes all the data related to transactions and stores in the block header.
Simplified Payment Verification (SPV)
We might need to verify if a particular transaction is included in a block or not without downloading the entire block. SPV uses Merkle tree to verify the transactions.
SPV nodes do not download all transactions in a block. They only download block headers. Merkle Tree helps SPV nodes to check if a particular transaction has been included in the block and thus verified.
Combining and Splitting Value
Bitcoin can be split into multiple smaller fractions or multiple fractions can be combined into single larger Bitcoin value.
It works similarly to the cash. If one needs to spend 80 Dollars but only has a 100 Dollar bill, he will get a change of 20 Dollars in return.
Similarly, when a person has to send smaller value of Bitcoin to someone, the transaction will have 2 output address, one of the receivers and one with the change back to the sender. Similarly, multiple values of Bitcoins can be combined to send a single larger value to someone.
Currently, banks keep all the transactions private from the public. There is limited access to people involved in the transaction. There is a concern with Bitcoin, where all the transactions are available in a public ledger. Although the transactions are hashed and nobody can see it.
We can add an extra layer of security by making the people involved in transaction anonymous. Publicly you could see a transaction happening. There is no link between receiver, sender or the amount of transaction. There is only a record if transaction. It is similar to the information from a stock exchange, where we can see the time and size of individual trades but do not know the parties involved.
As an added security, a new wallet address should be used for each transaction to keep the ownership anonymous. Some linking is still unavoidable in certain transactions. The risk is if the owner of a wallet is revealed, the linking could reveal other transactions done by the same person
A new system for digital transactions is proposed without the involvement of any central authority. We started with a normal system to own and spend money, but it is not complete until we could avoid double-spending. To solve this, we proposed a network managed by individuals and Proof of Work to record and verify transactions. It becomes impractical for an attacker to change the transactions until the majority of CPUs are run by honest nodes. The network is simple and robust with no formal structure. All the nodes can work together with little coordination. Nodes can remain private and information can be passed securely from anywhere. Nodes can leave or join the network at will. When they join the network back, they accept the longest chain as proof of what happened while they were gone. They use their CPU power to accept or decline to work on a block. Any new rule or incentive can be enforced with the consensus of the nodes.
Subscribe to get your daily round-up of top tech stories!