Skip to content

Address

Jerry Jiang edited this page Oct 17, 2018 · 8 revisions

Contentbox Address Format

A Contentbox address, is an identifier of 35 alphanumeric characters, beginning with "b1" or "b3", that can be generated from a ecdsa public key. Currently, there are two types of address:

  • P2PKH address which starts with b1: b1Dy23MQ3NoKdCWWazygQNCk3AUEZ29nqU1
  • P2SH type address which starts with b3: b32TwuDCFWaC9Jfhzqj7NSvrCeHzrbEAbS7

Address Generation

Contentbox uses elliptic curve secp256k1 as its basic signing algorithm, and the address is derived from public key.

Public Key

A ecdsa public key consists of two parts, X and Y, both Big Integers and can take up to 32 bytes. Contentbox uses an array with 65 bytes to represent the public key: byte[0] is fixed content(0x4), byte[1:32] is X and byte[33:64] is Y. So a public key in byte array format is as following:

040f7ed5210cde2df4ea654c607e882244b22766c2fd3a7d7682f24a2340f4ba3ef10a21ef4891bdd897dfdf5ac4cd6d98df11e04e06763034b9c3fb5dfef72d3a

Public Key Hash

The public key byte array format can convert to a shorter hex format, which is using hash function ripmend160(sha256(byte[65])) to generate an array of 20 bytes.

Address

Address generation takes public key hash(which would be referred as pkh) as input, and produces a base58 string. The following steps show how it's calculated:

  1. prefix = [0x13, 0x26] (if P2PKH) | [0x13, 0x2b] (if P2SH)
  2. checksum = sha256(sha256(prefix + pkh))[0:4]
  3. content = prefix + pkh + checksum
  4. address = base58(content)

Clone this wiki locally