Web3 Beginner Series: Why does my Bitcoin have multiple addresses?

avatar
ZAN Team
7 months ago
This article is approximately 1402 words,and reading the entire article takes about 2 minutes
The Bitcoin community is a community with ever-evolving technology, and the development of technology generates new content. Different address formats can be considered the result of the application of new technologies. Next, lets explore the differences between different address formats.

There may be many novice friends like me, who, when using WEB3 wallet for the first time, happily opened the Bitcoin wallet and prepared to copy the address, suddenly found that the wallet they created actually had multiple different addresses. It was like walking to an unfamiliar crossroads, with a confused look on my face.

Why are there different addresses? Which of these addresses should I use?

Web3 Beginner Series: Why does my Bitcoin have multiple addresses?

Multiple Bitcoin addresses of OKX wallet

What are these addresses?

The Bitcoin community is a community with ever-evolving technology, and the development of technology generates new content. Different address formats can be considered the result of the application of new technologies. Next, lets explore the differences between different address formats.

Legacy Address (P2P KH)

This format was adopted when Bitcoin was first launched in 2009, so it is called the Legacy format. Because the Bitcoin address at that time was created from a public key/private key pair, it is also called a payment public key hash (P2P KH) address.

At present, it seems that Legacy type addresses will take up more space in transactions, resulting in higher transaction fees. Currently, this type of address is only used when using some old wallets that are incompatible with the new address.

It can be found that Legacy addresses have a feature, that is, they all start with 1. This is because when generating addresses, a prefix will be added to the generated public key according to different scenarios (such as testnet/mainnet). After the public key with the prefix is calculated through Hash, the address will eventually start with 1.

Nested SegWit Address (P2SH-P2WPKH)

Compared with the traditional Legacy address, the P2SH address uses the hash of the redemption script instead of the public key hash. In laymans terms, P2P KH is a payment to a public key hash, while P2SH is a payment to a redemption script. Only when the recipient meets the transfer conditions of the redemption script can the funds in it be spent.

Since the payment object is converted from a public key to a script, the flexibility is greatly expanded, and the execution logic of the redemption script can be customized. Typical applications include implementing multi-signature transactions.

On the basis of P2SH, if the segregated witness technology is embedded, the format of this address is the segregated witness compatible address (Nested SegWit). You can learn about the content related to the segregated witness when introducing the segregated witness address. After the introduction of the segregated witness technology, the transaction volume can be reduced, thereby reducing the transaction fee.

You can see that the P2SH address starts with 3.

Native SegWit Address

Before introducing this type of address, we need to introduce the key technology in it - Segregated Witness (SegWit). As the name suggests, Segregated Witness is to isolate the witness data (witness) and process it separately.

One significant advantage of doing this is that it reduces the size of transaction information, thereby reducing transaction fees. Another benefit of the size reduction is that it increases the upper limit of the size of Bitcoin block transactions from 1 MB to 4 MB.

The characteristic of the segregated witness address is that the address starts with bc 1.

Taproot

The advantages of Taproot addresses are privacy and efficiency in complex transaction scenarios. Compared with Native SegWit, it uses the Schnorr algorithm instead of the elliptic curve digital signature algorithm. The former is more efficient in batch transaction scenarios and improves the privacy of multi-signature wallets.

The characteristic of the main root address is that the address usually starts with bc 1 q.

What address format should I choose?

Current mainstream wallets such as OKX, Unisat and other wallets support the above four addresses. Therefore, in order to reduce transaction fees, it is more reasonable to use Native SegWit and Taproot format addresses.

In addition, if you are interested in Bitcoin inscriptions, these two addresses are your best choice. Most wallets have done additional processing on the inscriptions of these two addresses to protect your special UTXO from being transferred incorrectly in transactions. Look for wallet addresses starting with bc 1!

Of course, wallets with different address formats can trade funds, so there is no need to worry.

If you want to check the balance or block information of Bitcoin, you are welcome to use ZANs node service. We provide a rich API for developers to use. API document details: https://docs.zan.top/reference/zan_getbalance-enhance

A little deeper - introduction to key technologies

After the above introduction, everyone has a preliminary understanding of the wallet. If you are as interested in some of the technical acquisitions in the wallet as I am, let’s take a look at the mysterious technology inside.

Redeem Script

When introducing P2SH, we know that this is a technology for redemption script transactions. So what is a redemption script and what is its role in the Bitcoin ecosystem?

Before introducing the redemption script, we need to introduce the basic structure of Bitcoin transactions.

The following is a typical P2P K-type transaction, where the address starting with 04 ae wants to transfer 10 BTC to the address starting with 15 kD. The account with the 04 ae address needs to show others on the chain that he does have the right to use this account (owns the private key), so he needs to provide a signature (ScriptSig) in this transaction to prove his identity.

In addition to obtaining the signature, the verifier also needs to find the output script of the previous transaction corresponding to the UTXO. The combination of these two scripts is the redemption script. The purpose of the redemption script is to prove the legitimacy of the transaction.

Web3 Beginner Series: Why does my Bitcoin have multiple addresses?

In this transaction, we can see that the signature and output script are both a computer instruction. OP_PUSHBYTES means PUSH a piece of data into the stack. First, in ScriptSig, 04 ae signs the entire transaction with its own private key, and the signature will be pushed into the stack. Then push the public key into the stack, and finally in OP_CHECKSIG, use the public key to decrypt the signature and compare whether the transaction is consistent. If it is consistent, it means that the identity is valid.

In addition to this P2P K method, the redemption script can also implement different identity authentication methods such as P2P KH and P 2 SH.

Segregated Witness

From the above introduction, we can know that the newer wallet formats currently use the isolated witness technology. So what is a witness and how is it isolated?

The Witness here can be considered as the script signature (scriptSig) information in the basic structure of Bitcoin. Segregated Witness extracts it from the basic structure and places it in a new data structure.

Web3 Beginner Series: Why does my Bitcoin have multiple addresses?

As can be seen in the figure above, the only necessary content in a transaction is the information on the transaction source and the transaction output. The size of the transaction has been reduced. Since the yellow part (the total size of the transaction) has a size limit, transmitting the transaction signature separately can allow a block to accommodate more transactions. In addition, since the content of the signature part is not counted when calculating the transaction signature, the problem of transaction scalability can be effectively solved.

The following is a P2TR transaction. You can see that this transaction has an additional Witness part. Its function is to verify the legitimacy of the transaction. After using Witness instead of ScriptSig, the way to verify the legitimacy is still the same, that is, by using the public key to decrypt the Witness signature and verify whether the content of the transaction is consistent. The node will only request Witness information when it needs to verify the legitimacy of the transaction. Now you can use the ZAN Node service for free (visit ZAN.TOP) to connect to the BTC network stably and at high speed.

Web3 Beginner Series: Why does my Bitcoin have multiple addresses?

In summary, Segregated Witness is to transmit the content of the transaction signature part and the rest of the content separately, thereby reducing the size of a single transaction and increasing the capacity of the entire block. In addition, since the content of the signature part is not counted when calculating the Hash value of the transaction, it can effectively solve the problem of transaction scalability.

This article was written by Yeezo (X account @GaoYeezo 75065 ) of ZAN Team (X account @zan_team ).

Original article, author:ZAN Team。Reprint/Content Collaboration/For Reporting, Please Contact report@odaily.email;Illegal reprinting must be punished by law.

ODAILY reminds readers to establish correct monetary and investment concepts, rationally view blockchain, and effectively improve risk awareness; We can actively report and report any illegal or criminal clues discovered to relevant departments.

Recommended Reading
Editor’s Picks