Enumeration CashAddressVersionByte

The CashAddress specification standardizes the format of the version byte:

  • Most significant bit: reserved, must be 0
  • next 4 bits: Address Type
  • 3 least significant bits: Payload Length

Two Address Type values are currently standardized:

  • 0 (0b0000): P2PKH
  • 1 (0b0001): P2SH

And two are proposed by CHIP-2022-02-CashTokens:

  • 2 (0b0010): P2PKH + Token Support
  • 3 (0b0011): P2SH + Token Support

The CashAddress specification standardizes expected payload length using CashAddressLengthBits. Currently, two length bit values are in use by standard CashAddress types:

  • 0 (0b000): 20 bytes (in use by p2pkh and p2sh20)
  • 3 (0b011): 32 bytes (in use by p2sh32)

Enumeration Members

p2pkh: 0

Pay to Public Key Hash (P2PKH): 0b00000000

  • Most significant bit: 0 (reserved)
  • Address Type bits: 0000 (P2PKH)
  • Length bits: 000 (20 bytes)
p2pkhWithTokens: 16

Pay to Public Key Hash (P2PKH) with token support: 0b00010000

  • Most significant bit: 0 (reserved)
  • Address Type bits: 0010 (P2PKH + Tokens)
  • Length bits: 000 (20 bytes)
p2sh20: 8

20-byte Pay to Script Hash (P2SH20): 0b00001000

  • Most significant bit: 0 (reserved)
  • Address Type bits: 0001 (P2SH)
  • Length bits: 000 (20 bytes)
p2sh20WithTokens: 24

20-byte Pay to Script Hash (P2SH20) with token support: 0b00011000

  • Most significant bit: 0 (reserved)
  • Address Type bits: 0011 (P2SH + Tokens)
  • Length bits: 000 (20 bytes)
p2sh32: 11

32-byte Pay to Script Hash (P2SH20): 0b00001000

  • Most significant bit: 0 (reserved)
  • Address Type bits: 0001 (P2SH)
  • Length bits: 011 (32 bytes)
p2sh32WithTokens: 27

32-byte Pay to Script Hash (P2SH32) with token support: 0b00011011

  • Most significant bit: 0 (reserved)
  • Address Type bits: 0011 (P2SH + Tokens)
  • Length bits: 011 (32 bytes)

Generated using TypeDoc