Skip to content

DeFiChain Address Format

Ahmed Hilali edited this page Nov 17, 2020 · 1 revision

How DeFiChain Addresses are generated

Just like Bitcoin, DeFiChain supports several types of addresses:

  • Pay to script hash, or P2SH (The default address type)
  • Pay to public key hash, or P2PKH (The legacy address type)
  • Bech32 segwit addresses

This document will briefly cover how the first two are generated, and the differences between DeFiChain and Bitcoin when it comes to address generation.

Pay to public key hash, or P2PKH (The legacy address type)

We will start first with the legacy address, as it's easier to explain. A DeFiChain legacy address is generated exactly the same way as a Bitcoin legacy address, you may refer to this document to see the specific steps involved (Quite technical): https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses

There is a major difference however, in the final step, Base58Check encoding, Bitcoin address prepend a 1 to the start of the address, where as DeFiChain addresses prepend an 8.

Pay to script hash, or P2SH

P2SH are also generated much the same way as Bitcoin. More info can be found here: https://medium.com/coinmonks/how-to-generate-a-bitcoin-address-step-by-step-9d7fcbf1ad0b#b764

The main difference here is that the P2SH addresses in DeFiChain start with 'd' rather '3' for Bitcoin.

Note the difference between base58 string encoding in DeFiChain and Bitcoin:

  • Pubkey address: '8' vs '1' for Bitcoin
  • PS2H address: 'd' vs '3' for Bitcoin

Other types of addresses

DeFiChain also supports other types of addresses such as bech32 addresses, although these are not the default address types. For bech32 addresses, the starting identifier in DeFiChain is 'df'.