Bitcoin is the world’s most successful decentralised network for value exchange; every day, thousands of people spin up new wallets and create public key addresses to receive bitcoin via the network. These public wallet addresses are key to how a user requests payment, and several formats are available.
Since bitcoin is programmable money, changes can be deployed when there is network consensus and these changes either bring new features or are intended to improve performance. One of those changes, known as the Segregated Witness (SegWit) protocol update, has introduced a few options on the type of bitcoin wallets/addresses you can support.
Those options include:
- and Bech32.
While P2PKH and P2SH have been around for quite some time, Bech32 is the new kid on the block, you might not have noticed if you’re new to bitcoin, but if you’ve been generating addresses from different wallets, you might have noticed some key differences.
Due to the way bitcoin launches upgrades via soft forks, it means that software and service providers are not forced to update unless they feel the benefits are worthwhile for their business or their users. So depending on the software or method you’re using to broadcast to the bitcoin timechain, you might not have used a Bech32 address.
Many services, wallet providers, and several exchange platforms now support Bech32 addresses, but it’s by no means the standard wallet format for everyone using bitcoin.
What is Bech32?
Bech32 is an address format used to pay native SegWit outputs. It was introduced by BIP173 as a SegWit address.
Bech32 consist of around 42 signs and starts with bc1.
Note: The address above is an example of the format but is an active bitcoin address; please do not send funds to it unless you plan to donate to our Lightning node.
How is Bech32 formats diffrent?
Using only 32 letters and numbers, the bech32 address format does not use mixed cases and remains in lowercase format for a cleaner look but also fewer mistakes when copying an address. Bech32 addresses also include an error-correction code that can catch almost all address typos (and even identify where the typos occur in some cases).
Bech32 also provides a better user experience and branding as people refer to Bech32 addresses as bc1 addresses because their address strings always start with ‘bc1’; this makes it easier to see that this is a bitcoin address and not to be confused with address formats from forks and altcoins.
Bech32 Addresses also encode a SegWit version, making them forward compatible with many conceivable upgrades pitched by bitcoin developers. Bech32 is an encoding scheme used to encode SegWit addresses and Lightning invoices.
What are the benefits of Bech32 addresses?
The previous bitcoin address format used mixed case lettering; these base58 addresses are difficult to type and are highly prone to input errors when sending bitcoin.
Trying to input an address format like:
Note: This is an active bitcoin address
Without copying and pasting or, even worse, verbally telling someone else the address without mistakes is painful as these addresses are case-sensitive. 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 time a double-SHA256 checksum requires, and you start to see why a switch was necessary.
Since Betch32 addresses leverage SegWit, these addresses separate the signature data from a transaction, and miners can fit more transactions into an individual bitcoin block. Doing so removes the seven transactions per second maximum previously bottlenecking bitcoin’s throughput.
Bech32 addresses with SegWit support not only help fit more transactions into each block, leading to quicker confirmations, but also leads to lower fees for your users. Fees on SegWit transactions are between 25 to 40% cheaper than non-SegWit ones.
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 serialisation
- Support for two transaction IDs per transaction
- Signature generation and verification for P2SH-P2WPKH addresses
- Numerous other requirements
As a developer, you’ll need to consider this when creating your application; as for a user, all you need to do is find a wallet that supports Bech32 addresses and create a private key for that wallet or restore your wallet to that wallet provider.
Future improvements to Bech32?
Bech32 addresses provide some much-appreciated performance upgrades, but it is by no means perfect; issues have been discovered with Bech32 error detection for future upgrades under some rare circumstances.
A new bech32 modified (bech32m) format was proposed, which is expected to will be used in taproot and future SegWit-based script upgrades.
To avoid constant upgrades and fragmenting network support, updates are often batched, making it easier to encourage wallets and services that implemented support for paying the original bech32 address format, and other upgrades are worthwhile. Bech32m addresses are not really a controversial upgrade, so it shouldn’t be an issue for bitcoin applications as there is a growing movement to support paying taproot addresses and future upgrades.
Since all bitcoin upgrades are soft forks, old versions of wallet addresses don’t fall away and remain compatible. No upgrade is required to continue paying the original (version 0) SegWit addresses for P2WPKH and P2WSH scripts, so you can use any address format you prefer, and it will broadcast to the bitcoin network.
How do Bech32m addresses work?
Bech32 string ends with a “p”; adding or removing “q” s before the “p” does not invalidate it. Bech32m removes this vulnerability by changing a constant used in the encoding scheme leaving the format more secure. Bech33m is specified in BIP 350 and is proposed as the encoding scheme for SegWit version 1 (Taproot) addresses, which will be introduced by the Taproot upgrade.
Are you using the bitcoin network?
Do you hold bitcoin on-chain? Are you considering moving bitcoin to a wallet where you hold the keys? Have you dealt with different address formats in the past and not understood why they seem so different?
Let us know in the comments down below.