Understanding bitcoin and its underlying technology “blockchain” — Part (3/3)

Chirag Bhattad
7 min readAug 26, 2018

This is the third post in a three part series which looks at bitcoin, it’s underlying technology blockchain and goes deep into the nitty gritties of this technology. This post will look at the blockchain network and how it runs. Then I have touched upon the methods used to optimize the universal storage. A major chunk of this post is then dedicated to understand how transactions take place using bitcoin and some of the privacy concerns are highlighted.

Running a Network:

The bitcoin network runs by following certain protocols in an iterative manner for every new incoming transaction. The following steps explain the smooth running of a bitcoin network:

1. The new transaction is broadcast to all the nodes present in the network. Here, nodes mean the computers linked with the universal ledger.

2. Each node collects this new transaction into a block.

3. Now, each node tries to add this block on to the blockchain by finding a proof-of-work for it.

4. As soon as a node successfully mines the block onto the blockchain, it broadcasts this block to all the nodes connected to the network to update their blockchains.

5. The nodes now begin the verification process of this block. They ensure that every transaction on this block is valid and new.

6. The nodes now start working on creating the next block in the chain, which is their way of indicating that they have accepted the previous block. They use the hash of this newly accepted block to mine the new block.

As a rule of thumb, nodes always work on the assumption that the longest chain is the correct chain. Thus, they continue to work on increasing the length of this chain. In case two different blocks are broadcasted at almost the same time, then the nodes generally work with the block which they received first. They also save the other branch in memory in case it becomes longer than the branch they are working on.

When the next proof-of-work is found, the two branches are analyzed and the longer one is assumed to be the correct one. Thus, the blocks from the other branch are integrated onto the longer branch.

Another worry might be the dropping of blocks. There might be a situation where not all the nodes receive the authenticated block. In this case, as long as the block reaches a good proportion of nodes, it will not cause any problems. Say node X did not receive block k. When one of the nodes authenticate block k+1, this node X will receive this block k+1. This is when it will figure out that it had missed one block, making it go back and request for the missing block. Thus, no blocks are missed eventually.

Optimizing Universal storage:

FIG. 8. How disk space is optimized without losing critical transactional data

The size of a block with no headers sums up to around 80 bytes. This 80 bytes is taken from the RAM of a node. The size of a block has been reduced to 80 bytes by discarding spent transactions. After a particular time, there will be enough blocks added to the network to safely discard the spent transactions to optimize the disk space used on each node.

A Merkel tree is specifically used to facilitate this process. It simplifies this process without breaking the blocks hash, with only the root included in the blocks hash. The interior hashes of this tree need not be stored. Thus, the branches of this tree can be systematically deleted in order to compact the old blocks.

With an average block time of 10 minutes 80 bytes amounts to the use of 4.2MB per year by this network. Given the ease with which 8GB RAM laptops are available for consumer use, storage will not be an immediate threat to the future of Blockchain.

Verification of Payment:

FIG. 9. Payment verification process explained by drawing a blockchain network.

The full network node need not be run to verify a transaction. Just by keeping a copy of the block headers of the longest proof-of-work, verification of the transaction can be achieved. By querying the network nodes, one can receive the block headers and then by using the timestamp of the transaction, the block in which it is placed can be figured out. From the block, the Merkel branch of the transaction can be accessed. The user cannot verify the transaction by himself, but by linking it to a place in the chain, it can be confirmed that the network had accepted the transaction and more blocks had been added ahead of it, further verifying the legitimacy of the transaction.

The only visible flaw in this verification process is if a hacker gains control of the network. This way, the attacker can verify his fabricated transaction. But the first paper on Blockchain ruled out the possibility of a hacker controlling the network, with the amount of power and resources required ruling out individual attackers or organizations. Only state owned/controlled groups a.k.a countries can launch such an attack. Even if they did launch such an attack, it would be an almost task to hide such an operation from the world, with the electricity and hardware requirements pinpointing the perpetrator.

A simple way to introduce human intervention and prevent this scenario is to build an alarm which will be triggered when the network detects an invalid or bogus transaction. This alarm will prompt the software to download the full block and force the alerted transaction to confirm its invalidity.

Ease of transaction:

FIG. 10. A transaction can be preceded by multiple transactions as input, but it can only have 2 outputs.

What would the solution be if one of the user did not have the exact denomination of bitcoin to be used in a transaction? What would he do if he had bitcoins invested in multiple sources and he wanted to pull it into a single transaction?

Bitcoin thus does not make separate transaction for every individual coin. In every transaction, there can be multiple inputs. Thus, there can be one large input from a large previous transaction or multiple inputs combining numerous smaller amounts. While the number of inputs can be more than one, the number of outputs cannot exceed more than two, one for the payment and the other for sending back leftover change, if any.

Since there is never the need to pull the standalone copy of a complete transaction, fan-out is not a problem. Fan-out is a chain where a transaction depends on several preceding transactions which themselves depend on several other transactions and so on.

Privacy Concern:

With a public ledger shared throughout the nodes, the concern for anonymity while making a transaction is legitimate. Banking institutions maintain transactional privacy by limiting access to the parties involved as well as the third party. But because blockchain is based on universal distribution, the necessity to announce all transactions is ingrained in the product technology. Thus, while all transactions need to be announced, there can be a break in the flow of information by using public keys, which can help preserve anonymity.

Thus, the fact that a person is sending money to another person is visible in the ledger, but their identity is masked by using encryption functions, which generate keys.These keys link the identity of the person with a public key. To further boost the confidence of the users, a new key pair is generated for each new transaction by the same user, to make sure nobody is able to link multiple transactions to a single person or user.
This evasive manoeuvre might sound pretty foul proof, but linking, which could be considered a real ease of use addition, can lead to the identity of the user. In multiinput transactions, multiple inputs from multiple preceding transactions can act like a pathway to the identity of the user or at least to the number and type of transactions made by him/her.

Defrauding vs Generation:

Before comparing the options of a user with appreciable hardware and power resources, the incentives to create a new block and its comparison with attacking a network are analyzed. By convention, the first transaction in a new block starts a new coin which is owned by the creator of the block. The addition of new nodes to this network of blocks is incentivized by distributing these coins. As the mining of blocks continue, new coins are added into this network, which incentivizes generation.

if the creator imposes transaction fees, then the incentives for generation can be still increased. The coin distribution and individual transaction fees can encourage nodes to stay honest. But if a node has significant hardware and electricity resources, it might choose to attack the network, defrauding people by stealing their coins, or using this power to create new coins. The opportunity cost when the node chooses to attack the network is too high, with new coins and transaction fees tilting the odds into the favour of mining new blocks and earning new coins instead of spending considerable amount of money to collect the required hardware and spend money on power and electricity to sustain the attack on the network.

Conclusion:

Hope this three part series has peaked your interest and acted as a good starting point into the field of cryptocurrency and blockchain technology. I absolutely enjoyed doing the research while writing up this piece and would love to get your feedback in the comments section below.

If you are interested in learning about Unified Payments Service (UPI) and how it compares with bitcoin, then click here to read this two part series introducing and comparing UPI and bitcoin.

--

--