Blockchain Basics - BIP

Introduction

Bitcoin started the Blockchain revolution. It disrupted many industries with the decentralized database concept. There is no central authority controlling the network. It reduced overhead and gave individual players freedom of choice. But on the other hand, it could become a mess if there is not a way to reach agreements on changes. BIP was introduced to normalize the process of changes in the Bitcoin network.

If you're new to Blockchain, check out my Basic Introduction to Blockchain for .NET Developers. 

What is BIP?

BIP stands for Bitcoin Improvement Protocol. It is a design document for introducing features to Bitcoin. It is the standard way of communicating ideas since there is no central authority to direct the Bitcoin. BIP influences a lot of Blockchain networks because most of them are based on the same Blockchain concept introduced by Satoshi Nakamoto in his Bitcoin whitepaper. The first BIP was created by Amir Taaki on August 19, 2011. It was used to describe what a BIP is.

There are three types of BIPs,

  • Standard Track BIPs
    Changes to the network protocol, block or transaction validation, or anything affecting interoperability.

  • Informational BIPs
    Provides general guidelines. This type of BIP is NOT for proposing new features. Therefore, it doesn’t require community consensus.

  • Process BIPs
    Describes or proposes changes in process.

Note
An enhancement or patch that doesn’t introduce changes to the network protocol doesn’t need a BIP.

Process of BIP

The BIP workflow was originally introduced in BIP 0001 and then improved in BIP 0002. The BIP workflow is like this,

Blockchain Basic - BIP

In order to submit a BIP, a BIP author needs to do the following things,

  • Make sure one proposal contains only one idea.
  • Search past discussions to see if an idea has been considered before.
  • Propose an idea or document to the Bitcoin development mailing list ([email protected])
  • Discuss the idea or document in the mailing list.
  • Post a draft BIP to the Bitcoin development mailing list to make sure it is properly formatted and well written.
  • Open a PR at https://github.com/bitcoin/bips repo

After a draft BIP is completed, BIP editor who is Luke Dashjr at this moment assigns a BIP number.

Not every single BIP will be accepted by the community. The following are some of the reasons that a BIP draft could be rejected,

  • Duplication of effort (this is a similar BIP)
  • Disregard for formatting rules
  • Too unfocused or too broad
  • Being technically unsound
  • Not providing proper motivation or addressing backward compatibility
  • Not keeping with the Bitcoin philosophy

BIP Example - SegWit

What is SegWit?

SegWit stands for Segregated Witness. It was submitted as BIP 141. It defines a new structure called a “witness” that is committed to blocks separately from the transaction Merkle tree. The structure contains data required to check transaction validity but not required to determine transaction effects. Scripts and signatures are moved into this new structure.

Purpose of SegWit

To understand the purpose of SegWit, we need to understand the structure of a Bitcoin block first. A Bitcoin block looks like this

Blockchain Basic - BIP

If we zoom in, we can see Block Header has the following fields,

Blockchain Basic - BIP

And, Transactions contains a collection of transactions. A transaction looks like this,

Blockchain Basic - BIP

A transaction has a list of inputs and a list of outputs. An input has this structure,

Blockchain Basic - BIP

And, a output has the following structure,

Blockchain Basic - BIP

Put everything together, you can see a block is like this,

Blockchain Basic - BIP

With the popularity of Bitcoin, more and more transactions are generated at the Bitcoin network. Bitcoin has a lot of benefits, but speed is one of the biggest complaints because PoW (prove of work) on purpose slows down a block’s generating speed to about 10 minutes per block. This also slows down the process speed of transactions. On top of it, a block can only have size up to 1 MB. The speed of transaction is,

Max Speed of Processing a Transaction = 10 minutes / (Max Number of Transactions in a Block)

Therefore, the maximum waiting time for a newly added transaction is about,

Max Transaction Waiting Time = ((Number of Pending Transactions) * (Max Speed of a Transaction Processing)

There is a lot of discussion on how to improve the transaction processing speed and reduce the max transaction processing time. One solution is to increase the max number of transactions in a block. Unfortunately, a block’s size is not unlimited. A block can be up to 1 MB in size. It was limited by Satoshi Nakamoto in 2010. Then, adjusting the content of a block becomes a possible solution. SegWit is designed to move the Witness field out of a block to give more space to transactions. What is the witness field? It is the verification data of transactions. More specifically, witness field is the Script Signature in the Input structure. Some researchers found that script signature and script public key could occupy up to 65% of a transaction structure,  but is only needed at validation time.

BIP Process of SegWit

In 2012, Bitcoin Core contributors Russell O’Connor, Matt Corallo, Luke Dashjr, Gregory Maxwell, and Bitcoin talk moderator “Theymos” talked about stripping out unused data out of a block on IRC Bitcoin development channel. Two years later, in 2014, several Bitcoin Core developers, including Dr. Pieter Wuille, founded a company Blockstream. By early 2015, Blockstream engineers decided to implement a new feature in the company’s prototype sidechain - Elements. The feature would separate base transaction data from witness data. The name of the new feature was Segregated Witness. In the meantime, other developers were talking about the block size limit issue also.

In June 2014,  Mike Hearn published BIP 64 - a small P2P protocol extension that performs UTXO lookups given a set of outpoints. Hearn released Bitcoin XT client to implement his proposal. In June 2015, Gavin Andresen published BIP 101 to increase the maximum block size. Andreson implemented his proposal into Bitcoin XT client. However, both BIPs didn’t pass the BIP process. Bitcoin XT client was designed to be the replacement of the Bitcoin core client or an alternative one. But, because the BIPs it supports are not accepted by the Bitcoin community, it eventually becomes the Bitcoin Cash client by default.
 
By December 2015, BIP 141 was created by Eric Lombrozo, Johnson Lau, and Pieter Wuille to standardize SegWit. In order to reduce the impact, the proposal was designed as a soft fork, which means, only miners need to upgrade their Bitcoin clients.  By June 2016, BIP 141 was finalized and become the standard of Bitcoin. The implemented of SegWit was merged into Bitcoin Core’s master branch by Bitcoin Core lead maintainer, Wladimir van der Laan. The changes were officially released in Bitcoin Core version 0.13.1.

Summary

Most Blockchain projects are open source, community-driven, and decentralized. When the popularity of a Blockchain project increases, the difficulty of making fundamental changes are increased too. If you are starting a new community-driven Blockchain project, you need to think about how to manage changes in the long term. You can definitely borrow experience from the BIP process of Bitcoin.


Similar Articles