Bitcoin address formatBitcoin address format
A Bitcoin address is an identifier (like an account number), starting with 1, 3 or bc1 on the mainnet, containing 27-34 alphanumeric Latin characters and digits (except 0, O, I).
Full list of Bitcoin address prefixesFull list of Bitcoin address prefixes
A Bitcoin address, or simply address, is an identifier of 27-34 alphanumeric characters, beginning with the number 1, 3 or bc1, that represents a possible destination for a bitcoin payment. Addresses can be generated at no cost by any user of Bitcoin. It is also possible to get a Bitcoin address using an account at an exchange or online wallet service. Also, you can generate it offline and store on paper or at any digital storage.
There are currently four address formats in use in Bitcoin mainnet:
- P2PKH (Pay 2 Public Key Hash) which begin with the number 1
- P2SH (Pay 2 Script Hash) type starting with the number 3.
- Bech32 type starting with bc1.
- Taproot type sarting with bc1p.
| Use | Leading symbol(s) | Example |
| Pubkey hash (P2PKH address) | 1 | 17VZNX1SN5NtKa8UQFxw ... |
| Script hash (P2SH address) | 3 | 3EktnHQD7RiAE6uzMj2Z ... |
| SegWit mainnet (P2WPKH address) | bc1 | bc1qw508d6qejxtdg4y5 ... |
| SegWit Testnet (P2WPKH address) | tb1 | tb1qw508d6qejxtdg4y5 ... |
| SegWit mainnet (P2WSH address) | bc1 | bc1qrp33g0q5c5txsp9a ... |
| SegWit Testnet (P2WSH address) | tb1 | tb1qrp33g0q5c5txsp9a ... |
| Private key (WIF, uncompressed pubkey) | 5 | 5Hwgr3u458GLafKBgxts ... |
| Private key (WIF, compressed pubkey) | K or L | L1aW4aubDFB7yfras2S1 ... |
| BIP32 pubkey | xpub | xpub661MyMwAqRbcEYS8 ... |
| BIP49 pubkey | ypub | ypub6XiW9nhToS1gjVsF ... |
| BIP49 pubkey | zpub | zpub6qeoQyhseR78SC69 ... |
| BIP32 private key | xprv | xprv9s21ZrQH143K24Mf ... |
| Testnet pubkey hash | m or n | mipcBbFg9gMiCh81Kj8t ... |
| Testnet script hash | 2 | 2MzQwSSnBHWHqSAqtTVQ ... |
| Testnet Private key (WIF, uncompressed pubkey) | 9 | 92Pg46rUhgTT7romnV7i ... |
| Testnet Private key (WIF, compressed pubkey) | c | cNJFgo1driFnPcBdBX8B ... |
| Testnet BIP32 pubkey | tpub | tpubD6NzVbkrYhZ4WLcz ... |
| Testnet BIP32 private key | tprv | tprv8ZgxMBicQKsPcsbC ... |
Hierarchical Deterministic WalletHierarchical Deterministic Wallet
A HD wallet, or hierarchical deterministic wallet is a system of deriving keys from a single starting point known as a seed. The seed allows a user to easily back up and restore a wallet without needing any other information and can in some cases allow the creation of public addresses without the knowledge of the private key. Seeds are typically serialized into human-readable words in a Seed phrase.
Could also add bcrt1 for regtest
Correct. But Regtest is a private local network which is used solely for testing. It is primarily used for the regression tests, hence the name regtest.
Knowing Bitcoin address format helps you understand where an address send or receive BTC from
Is there a difference in size between sending from a P2SH to a bc1, comparing to sending from a bc1 to a bc1? Why?
The process for transferring Bitcoin starts when one user broadcasts a request to the network. This request includes the user's public address, the amount of Bitcoin being sent, and a transaction fee for the miners.
The TX size is a code generated from input and output addresses participating in this transaction
Next, miners process the transaction; information from both users is encrypted, which means the data is turned into a line of computer code called the transaction ID. At this point, the transaction is queued. Transactions are added to the queue until the block limit is reached and a block is created.
So yes, there's a difference in the amount of data required by the miner to "compose" a tx ID and that's why:
Why are segwit transactions cheaper?
Segregated witness transactions are cheaper because they are designed to be.
In legacy transactions, every byte has the same "cost"; they all count equally towards the 1000000 byte block limit. Segwit transactions on the contrary keep certain data (signatures etc) in a separate "witness" section, and that witness section is discounted: every witness byte only counts as 0.25 byte towards the block limit. Fees are determined by the market and not a system rule, but the fact that segwit transactions have some of their content discounted results in the market pricing them less.
Can you highlight what is the difference on send/receive via 1, 3, and bc1?
In other words, should I care? whats in it for sender/receiver?
Mainly tx fees:
All address types are interoperale.
Thats very helpful, thank YOU
To myself. I think one source of confusion is this. Please correct me if I'm wrong about this.
I'm more conversate with the Script Hash Bitcoin Address Format
ypubs get no love around here. jk of course. SLIP-132 was no good. Glad we have output descriptors
Cool list!
Bookmarked!
Thanks!
How about nostr pubkey, isn't it also somehow derived from bitcoin keys?
Yeah nostr keys are BIP 340 keys
Don't think so. You can generate a private key with:
openssl rand -hex 32 > hexprivatekey.txtExample output to text file:
b86bdbc13deb52eb1172e7b2c9821b362r83973efc37cf2ee1cd56ceabdafda8bYou can then use a tool like key-convertr to convert the hex private key into bech32 encoded private key
nsec...., if needed.Here's a more detailed explanation about Nostr keys.
I saw Deezy generating me an onchain address, that looked almost exactly same (except for prefix and last 5 characters) like my nostr npub... while i only logged with Alby and they couldn't see my nsec..
I saw Deezy generating me an onchain address, that looked almost exactly same (except for prefix and last 5 characters) like my nostr npub... while i only logged with Alby and they couldn't see my nsec..
deleted by author
The ecosystem is slowly moving there. Some wallets are already offering them (Muun, Envoy), some others are still testing them and are only available in beta versions (ex. Coldcard). We are a couple of years away from wide adoption I believe.
Personally, I use taproot addresses for my day-to-day exchanges and every time I can, but wouldn’t put generational wealth in them yet.
A curated list of wallets supporting Pay 2 Taproot (P2TR) is available here
Sadly, Taproot's major benefits (more privacy, lower fees, network efficency, etc.) will be seen only AFTER massive adoption.
deleted by author