I was compiling a table for Version prefix (hex) and Base-58 result's prefix for different types of Bitcoin addresses.

I came across the content here: https://en.bitcoin.it/wiki/List_of_address_prefixes, which does not contain information about Decimal, prefix Hex for Bech32 addresses (I guess they also called SegWit address, right?)

So, I checked this chart here: https://en.bitcoin.it/w/images/en/4/48/Address_map.jpg but, I don't understand the meaning of "x03x03x00x02x03".

  1. If x00 equal 0x00 in hex and x80 equal 0x80 in hex, how should I interpret x03x03x00x02x03?
  2. What is the version prefix for Bech32 addresses (bc1 addresses)?

Those bytes (x03x03x00x02x03 or better shown as 0x0303000203) are the expanded human readable part. You can find the code on BIP-173.

def bech32_hrp_expand(s):
  return [ord(x) >> 5 for x in s] + [0] + [ord(x) & 31 for x in s]

The problem however is that unlike Base58 encoding, those bytes are only used in calculation of checksum not as the starting bytes. Which makes the picture misleading in my opinion.

Bech32 encoding is very different from Base58 encoding as there is no "version prefix". There is an Hrp, a witness version, a data (hash) and a checksum. Witness version | hash are the data being encoded and expanded_hrp | data is used in checksum calculation (| is concatination).

  • thanks for the response. I doubted the same. Upvoting and accepting the answer. – Andy_Jake Oct 17 '20 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.