What is legacy and segwit address?
- Luda Kukuetu
- 2024-03-25
- 8 min
- 1
- 932
Legacy and SegWit are two strange and unclear words used to refer to the format of Bitcoin wallet addresses.
What's the difference Legacy and Segwit? Despite the complexity of the issue, it is one of the important topics for those who have decided to join the world of cryptocurrencies. Previously, we have already considered what Bitcoin is, as well as how to buy coins and, it would seem, this information is already enough to become a full-fledged user of cryptocurrencies, but...
You have already noticed that different wallets have different addresses: some begin with "1", others with "3", and there are even those that begin with "bc1". Of course, such differences can confuse the user. Firstly, it is not quite clear why there is such a variety, and secondly, there is a fear of losing money during transfers (if Bitcoins do not reach the addressee). Well, in general, the fear is reasonable, but "the lion is not so fierce as he is painted".
In this article, we'll take a look at the nuances of what is Bitcoin address and demonstrate that it's actually quite simple!
What is Bitcoin address?
The Bitcoin wallet address (unique identifier) is something like your cryptocurrency account number. It is needed both to receive and to send Bitcoins. The user needs to provide the recipient's wallet address to make the transfer (transaction). In turn, the recipient must provide the address to the sender.
Until recently, there was no problem with understanding different Bitcoin address types, because all network participants used the same Bitcoin address format, namely a Legacy. But with the development of technology, not only the format of recording addresses has changed, but also the way in which transactions are processed between addresses.
Let's take a lookup at the important points of this issue…
What is Legacy address?
Legacy address (P2PKH - Pay To Public Key Hash) is a standard Bitcoin address format originally provided in the protocol and used by most crypto-purses and services.
This address, suggested by Bitcoin creator Satoshi Nakamoto, can be identified by the number "1" (prefix) at the beginning of each address (example: 18sp5z1aYXMXGxef1xiPbCYnspcG8eQznh). This address format has been and remains the most popular since the launch of the Bitcoin network.
Despite the widespread use of Legacy addresses, they have a number of direct and indirect drawbacks:
- Sensitive to case of input data and inconvenient to write on paper;
- Low priority for miners because there are far fewer such transactions per block;
- Reduced cryptographic strength of the digital signature used by Bitcoin;
- "Unflexible" transactions.
The technical details! Bitcoin uses the Base58 algorithm to convert public keys into a human-readable format. It is quite similar to the well-known Base64, but uses a shortened alphabet, meaning that some characters are not used to avoid homographic attacks.
Because of this, we will never see such characters as 0 (zero), O (capital "o"), I (capital "i"), l (lowercase "L") and "+" and "/" characters in Legacy addresses.
It would seem that the disadvantages are not so significant, however, with the growing popularity of Bitcoin, they began to play a key role.
As we know, transaction fee is paid in satoshi (a small part of Bitcoin), so once the coin has risen in value, the transaction fee has risen as well. Of course, when you transfer $10,000 in BTC, $5 fee will not seem like a big deal, but for micro transfers where the fee will be 10% or more of the transfer amount - this is a significant disadvantage. Add to this slow transfers and you are "screwed"!
What is Segwit address?
Until late summer 2017, ordinary BTC consumers successfully used classic Legacy addresses to make transactions. But on August 24, the Bitcoin network underwent a soft fork, proposed in March 2016 by developers P. Welle and G. Maxwell.
The update included activation of the Segregated Witness protocol and a new bitcoin address format - Bech32 or SegWit address (P2WPKH - Pay to Witness Public Key Hash).
Segregated Witness has reduced the weight of transactions in blocks of the Bitcoin network by removing signatures from them and moving them to "additional data," followed by individual processing.
Brief description of the technology: The SegWit protocol separates the cryptographic signature from the transaction itself and moves it outside the main blockchain. In this case, the space freed up in the main block is filled by other transactions. The introduction of SegWit led to an increase in transaction throughput, as more transactions could be entered into a block. At the same time, the problem of high fees was no longer an issue, as you no longer had to charge more generous fees for miners to confirm your transactions in the first place.
The update has affected not only the method of forming transaction blocks, but also the format of Bitcoin wallet public key entries themselves.
SegWit addresses start with "bc1" (example: bc1qnnc0enjmp4essg8t8rxqnyg9394qgwjtpngv9), and they are entered regardless of case, i.e. bc1qnnc... = bc1Qnnc... = BC1QNNC...
This address recording format has simplified their use quite a bit and made it easier to write. Core advantages of SegWit addresses include:
- High degree of protection against errors;
- Increased transaction throughput;
- Reduced fees by up to 50%.
The main disadvantage of the updated protocol is that not all cryptocurrency services support it, but in this case there is a solution in the form of an intermediate address, referred to as Compatible. Among well-known crypto wallets, SegWit support is implemented in Trustee Wallet, Trezor, Electrum, Ledger Nano S.
What are multisig (multi-signature) and compatible addresses?
This type of address appeared back in 2012 in order to at least somehow solve the problem of expensive transactions.
Bitcoin Foundation chief scientist G. Anderson proposed an update to BIP-0016 that would improve transaction execution logic by allowing sending not just to addresses, but also to programmable keys (something similar to smart contracts in Ethereum).
As a result of the update, Bitcoin addresses began with the prefix "3" (example: 3FVeDqkWXGPmgugHD1FLn9xMfeZcF181RG). The structure remains similar to Legacy addresses. You could often see such Multisignature addresses in "multisignature wallets", when one address has 2 or 3 private keys.
We will not deepen into the technical essence of such addresses, but only touch their interaction with the Legacy and SegWit addresses.
SegWit implementation was not supported on the old wallets, that is, they did not see Bech32 addresses and could not understand what to do with such "recipients", so the intermediate P2SH format, namely Compatible, became a kind of bridge in the interaction between the different addresses. A special script encrypted in the key to the 3xxx address allows users of old wallets to send funds to new (3xxx) wallets, and owners of new ones to already spend them using SegWit technology (that is, to pay transactions at low fees).
From Legacy to SegWit in Trustee
After the implementation of the SegWit protocol in Trustee Wallet, some users began to have questions: "How is it possible that I sent some funds in BTC, but the balance was deducted all of them, why?".
To answer this question you will need to delve a bit deeper into the workings of Bitcoin itself. So…
Bitcoin is quite complicated in processing transactions on its own. To put it simply: when you want to send part of your balance to someone, it's not part of the balance that leaves your wallet, but the whole amount, divided into a new owner with his share (what you sent him) and change to your address (what's left of the balance minus the transaction fee).
This whole process of sending, splitting, and returning the "change" happens in one block, one transaction. After confirming the sending, you can use the "change" for your next transactions.
Talking about Trustee's support for Segwit, it's important to note one feature. By sending funds from a Legacy address, the change is returned to SegWit instead of the Legacy address. This makes switching from the outdated, slow and expensive Legacy format to the faster and cheaper SegWit easy, convenient and cost-free for the user, eliminating the need for a separate transaction to transfer between their addresses.
Summarize
The world does not stand still, and the world of cryptocurrencies even more so, the development and improvement of protocols is inevitable.
Above we have reviewed the types of bitcoin addresses used and hopefully brought some clarity to our understanding of what is going on. If you still have questions, we will gladly answer them in our Telegram chat. Trustee Wallet team is always in step with the times, join us!