As a cryptocurrency exchange operator, including bitcoin in your crypto offerings is a no-brainer. Not all bitcoin implementations are equal, though. Since Bitcoin’s Segregated Witness (SegWit) protocol update, you have a few options on the type of bitcoin wallets/addresses you can support. Those options include P2PKH, P2SH, and Bech32.
While P2PKH and P2SH have been around for quite some time, Bech32 is relatively new. However, many exchanges, wallet providers, as well as several ICO, STO, and IEO platforms now support Bech32 addresses. So it’s imperative your platform does as well if you want to keep up with your competition.
- 1. A Quick SegWit Refresher
- 2. What is Bech32?
- 3. The Benefits of Supporting SegWit and Bech32
- 4. How to Support Bech32 Segwit Addresses
A Quick SegWit Refresher
For those unfamiliar, SegWit is a Bitcoin protocol update that occurred in August 2017 in an attempt to ease the blockchain’s scaling woes. The update was part of the New York Agreement, a form of compromise between those who wanted to increase Bitcoin’s block size (big blockers) and those opposed to the idea.
Without getting into too much detail, SegWit effectively separates, or segregates, the signature data, or witness data, from bitcoin transactions. Doing so enables a Bitcoin block to hold more transactions, which in turn, increases the network’s scalability.
Additionally, separating the signature data from bitcoin transactions opened up the opportunity for layer two scaling solutions like the Lightning Network. Merkelized Abstract Syntax Trees (MAST) and Miniscript also become possible post-SegWit, adding the ability to write smart contracts on the Bitcoin blockchain – a feat that was previously much more challenging to achieve.
Some people aren’t entirely sold on SegWit, though.
Big blockers generally believe that SegWit is, at best, a temporary solution that will inevitably lead to miners becoming disincentivized to continue mining blocks. Because each block includes additional transactions, SegWit miners are effectively earning less in fees per transaction than they otherwise would have.
The Bitcoin Cash hardfork was mainly a response to the SegWit update. Instead of implementing SegWit, Bitcoin Cash developers chose to increase the block size of the blockchain. Looking at the growth of Bitcoin vs. Bitcoin Cash since the split, however, it seems as if Bitcoin (with SegWit) will continue to be the dominant chain.
Now, about half of all Bitcoin transactions utilize SegWit. And we’ll likely see this number continue to grow as more platforms implement SegWit support.
The percentage of SegWit transactions recently eclipsed 50 percent and continues to grow. | Source: Transactionfee.info
What Is Bech32?
Bech32 is a bitcoin address that is fully compatible with SegWit. Many people refer to Bech32 addresses as bc1 addresses because their address strings always start with ‘bc1’.
Bitcoin developers implemented Bech32 as part of Bitcoin Improvement Proposal (BIP) 0173. Previously, Bitcoin used base58 addresses alongside a truncated double-SHA256 checksum. But, this implementation had some drawbacks.
Because it uses mixed case lettering, base58 addresses are difficult to type and are highly prone to input errors when sending bitcoin. Imagine trying to input 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2 correctly without copying and pasting (or even worse, verbally telling someone else the address without mistakes).
Additionally, base58 addresses require a significant amount of space in QR codes, and decoding them is relatively complex and slow. Combine all these issues with the extended length of time a double-SHA256 checksum requires, and you start to see why a switch was necessary.
The Benefits of Supporting SegWit and Bech32
Before getting into the benefits of Bech32 addresses, let’s talk about why you should, at a minimum, support SegWit if you don’t already.
Primarily, transactions that utilize SegWit are cheaper and significantly faster than traditional bitcoin transactions.
Because SegWit separates the signature data from a transaction, you can fit more transactions into an individual Bitcoin block. Doing so removes the seven transactions per second maximum that previously existed for Bitcoin’s throughput. So with SegWit support, your users can transact bitcoins without the ridiculous wait times we saw during the 2017 bull run.
Fitting more transactions into each block also leads to lower fees for your users. Fees on SegWit transactions are generally 25 to 40 percent lower than non-SegWit ones.
Bech32 provides additional benefits.
In comparison with other SegWit addresses, like P2SH, Bech32 has slightly lower transaction fees. But, more importantly, supporting Bech32 addresses gives your users a better experience on your platform.
Other than giving your users more options, supporting Bech32 also reduces the chance of errors when they send and receive bitcoins. Because Bech32 addresses are entirely lower case, rather than mixed case, users have an easier time sharing them and typing them in. If a user does make an error when inputting an address, Bech32 addresses also enable you to identify which characters are likely incorrect, as shown in this demonstration.
These benefits have led nearly all wallets and exchanges to at least support users’ sending bitcoin to Bech32 addresses. And while you still can’t create, and receive bitcoin to, Bech32 addresses on many exchange platforms, most wallets do support those actions. As an exchange, providing users with Bech32 bitcoin wallets helps you to differentiate your platform from the vast array of competitors.
Most of the top bitcoin hardware wallets support Bech32 addresses. | Source: Bitcoin Wiki
How to Support Bech32 SegWit Addresses
Unfortunately, supporting Bech32 SegWit addresses isn’t a simple task. Even becoming compatible with SegWit at the most basic level requires:
- The ability to send to P2SH addresses
- The ability to create P2SH-P2WPKH addresses
- Transaction serialization
- Support for two transaction IDs per transaction
- Signature generation and verification for P2SH-P2WPKH addresses
- Numerous other requirements
Implementing Bech32 support comes with its own set of requirements as well, in addition to what we’ve outlined above. For example, you need to create functions for native P2WPKH and P2WSH addresses as well as perform any front-end work to display how the different wallet/address types vary.
Fortunately, we’ve handled the difficult steps for you. Creating an exchange or ICO/STO/IEO platform through Skalex gives you Bech32 support out-of-the-box. You don’t have to worry about the nitty-gritty aspects of the implementation. Contact us today to receive a demo and see how we can assist you in building out the best platform possible for your business.