CounterEntropy (OP)
|
https://en.bitcoin.it/wiki/Address says 26-35 alphanumeric characters. But, this Bech32 address is longer - bc1qgdjqv0av3q56jvd82tkdjpy7gdp9ut8tlqmgrpmv24sq90ecnvqqjwvw97. I'd also like to know why this address is longer than the usual, e.g. bc1q5shngj24323nsrmxv99st02na6srekfctt30ch?
|
|
|
|
TheArchaeologist
|
|
July 10, 2020, 03:42:40 PM |
|
The mentioned 26-35 length is valid for addresses encoded using base58. These are the addresses starting with either a "1" or a "3". Native Segwit addresses use a base32 encoding, start with "bc" and they are case insensitive. These addresses have better error detection at a cost of being around 27% larger than the base58 equivalent. Version 0 witness addresses are always 42 or 62 characters afaik, If you would like more info on bech32 check out: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
|
Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
|
|
|
achow101
Moderator
Legendary
Offline
Activity: 3486
Merit: 6824
Just writing some code
|
|
July 10, 2020, 04:08:00 PM |
|
But, this Bech32 address is longer - bc1qgdjqv0av3q56jvd82tkdjpy7gdp9ut8tlqmgrpmv24sq90ecnvqqjwvw97.
I'd also like to know why this address is longer than the usual, e.g. bc1q5shngj24323nsrmxv99st02na6srekfctt30ch?
The longer address is for a Pay 2 Witness Script Hash output. These contain the SHA256 of a script, which is longer than the hash160 of a pubkey in the shorter P2WPKH address.
|
|
|
|
gmaxwell
Moderator
Legendary
Offline
Activity: 4242
Merit: 8672
|
have better error detection at a cost of being
It would be more accurate to say: These addresses don't use mixed case, enabling MUCH faster and more accurate transcription via writing or speaking and support 256-bit payloads which are important for providing adequate security especially when addresses are created with input from multiple parties, both at the expense of being longer. BC1 addresses actually spend slightly fewer bits on error detection (30 instead of 32), but the error detection is designed to be much more effective for common errors (which corrupt only a few characters).
|
|
|
|
cfbtcman
Member
Offline
Activity: 264
Merit: 16
|
|
July 12, 2020, 06:52:07 AM |
|
Somebody can tell me with sure, what is the max number of characters in a bech32 address?
Id like to validate the max number of characters inside a database, so, that is important, after some google i still didnt found one exact answer!
What about bech32 php or javascript good address validator?
|
|
|
|
TheArchaeologist
|
|
July 12, 2020, 07:36:42 AM |
|
Somebody can tell me with sure, what is the max number of characters in a bech32 address?
Id like to validate the max number of characters inside a database, so, that is important, after some google i still didnt found one exact answer!
As asnswered in this thread: 62 characters. The reason you might not have found one answer is because there is a difference in length between a P2WPKH-address and a P2WSH-address: - P2WPKH: 42 characters
- P2WSH: 62 characters
Also mentioned in this thread: P2WSH contains the SHA256 of a script, which is longer than the hash160 of a pubkey in the shorter P2WPKH address. That's the reason the length differ.
|
Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
|
|
|
pooya87
Legendary
Offline
Activity: 3570
Merit: 10837
|
|
July 12, 2020, 07:39:19 AM |
|
Somebody can tell me with sure, what is the max number of characters in a bech32 address?
Id like to validate the max number of characters inside a database, so, that is important, after some google i still didnt found one exact answer!
As asnswered in this thread: 62 characters. The reason you might not have found one answer is because there is a difference in length between a P2WPKH-address and a P2WSH-address: - P2WPKH: 42 characters
- P2WSH: 62 characters
Also mentioned in this thread: P2WSH contains the SHA256 of a script, which is longer than the hash160 of a pubkey in the shorter P2WPKH address. That's the reason the length differ. it should be noted that the length depends on the script each address represents and these numbers here are for version 0 witness program and may be different for version 1+ witness programs. Id like to validate the max number of characters inside a database,
what kind of "database" contains addresses?
|
|
|
|
TheArchaeologist
|
|
July 12, 2020, 07:49:17 AM |
|
it should be noted that the length depends on the script each address represents and these numbers here are for version 0 witness program and may be different for version 1+ witness programs.
Agreed, the version 0 witness program requirement was in my original response. My post was more a summing up of the previous replies since imho everything was in there already.
|
Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
|
|
|
Pmalek
Legendary
Offline
Activity: 2884
Merit: 7435
Playgram - The Telegram Casino
|
|
July 12, 2020, 11:05:05 AM |
|
As asnswered in this thread: 62 characters. I found this source from Trezor's wiki that says that a Bech32 "string" can be up to 90 characters long. This is what it says: A Bech32 string is at most 90 characters long and consists of:
The human-readable part. "bc" for mainnet "tb" for testnet The separator, which is always "1". The data part, which is at least 6 characters long and only consists of alphanumeric characters excluding "1", "b", "i" and "o". https://wiki.trezor.io/Bech32
|
|
|
|
▄▄███████▄▄███████ ▄███████████████▄▄▄▄▄ ▄████████████████████▀░ ▄█████████████████████▄░ ▄█████████▀▀████████████▄ ██████████████▀▀█████████ █████████████████████████ ██████████████▄▄█████████ ▀█████████▄▄████████████▀ ▀█████████████████████▀░ ▀████████████████████▄░ ▀███████████████▀▀▀▀▀ ▀▀███████▀▀███████ | ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ Playgram.io ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ | ▄▄▄░░ ▀▄ █ █ █ █ █ █ █ ▄▀ ▀▀▀░░
| │ | ▄▄▄███████▄▄▄ ▄▄███████████████▄▄ ▄███████████████████▄ ▄██████████████▀▀█████▄ ▄██████████▀▀███▄██▐████▄ ██████▀▀████▄▄▀▀█████████ ████▄▄███▄██▀█████▐██████ ██████████▀██████████████ ▀███████▌▐██▄████▐██████▀ ▀███████▄▄███▄████████▀ ▀███████████████████▀ ▀▀███████████████▀▀ ▀▀▀███████▀▀▀ | | │ | ██████▄▄███████▄▄████████ ███▄███████████████▄░░▀█▀ ███████████░█████████░░█ ░█████▀██▄▄░▄▄██▀█████░█ █████▄░▄███▄███▄░▄██████ ████████████████████████ ████████████████████████ ██░▄▄▄░██░▄▄▄░██░▄▄▄░███ ██░░░█░██░░░█░██░░░█░████ ██░░█░░██░░█░░██░░█░░████ ██▄▄▄▄▄██▄▄▄▄▄██▄▄▄▄▄████ ███████████████████████ ███████████████████████ | | │ | ► | |
|
|
|
TheArchaeologist
|
|
July 12, 2020, 11:13:58 AM |
|
As asnswered in this thread: 62 characters. I found this source from Trezor's wiki that says that a Bech32 "string" can be up to 90 characters long. This is what it says: A Bech32 string is at most 90 characters long and consists of:
The human-readable part. "bc" for mainnet "tb" for testnet The separator, which is always "1". The data part, which is at least 6 characters long and only consists of alphanumeric characters excluding "1", "b", "i" and "o". https://wiki.trezor.io/Bech32 The question was, or at least in my opinion, what the maximum current length is for addresses currently in use. The answer still remains 62 based on the current version 0 witness program. In the future newer versions may arise and in that case there is room left to go to a maximum of 90.
|
Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
|
|
|
|