Welcome to BlockDAG Dashboard! ๐Ÿ‘‹

notification0
Notifications
logout

Dev Release 39

May 27, 2024

Greetings BlockDAG Community,

 

Understanding Address Formats in BlockDAG

 

In the dynamic world of blockchain, you will encounter various address formats, particularly when dealing with Directed Acyclic Graphs (DAGs) and hierarchical deterministic wallets (BIP32). This post aims to demystify these address formats, elucidate their functionality within respective blockchain systems, and provide insights into the underlying algorithms and mathematical formulas.

Address Formats in BlockDAG

The address format in BlockDAG systems can vary based on specific implementations. However, some common features include:

 

Base58 Encoding

Many BlockDAG systems utilize Base58 encoding to create user-friendly addresses, avoiding ambiguous characters.

Example: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
 

Checksum
Addresses often include a checksum to detect errors, ensuring the validity of the address.

 

Prefix
Different types of addresses (e.g., standard, multi-signature) may have distinct prefixes.
Example: Bitcoin addresses starting with 1 for P2PKH, 3 for P2SH, and bc1 for Bech32.

 

BIP32: Hierarchical Deterministic Wallets

BIP32 (Bitcoin Improvement Proposal 32) introduced hierarchical deterministic (HD) wallets, which allow for the generation of a tree of keys from a single seed. This innovation simplifies wallet backup and enhances security.

 

  1. Master Seed

A random seed is generated, typically from a mnemonic phrase.
Example: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about

 

2. Master Key Derivation
From the seed, a master private key and master chain code are derived using HMAC-SHA512.
(๐‘˜๐‘š,๐‘๐‘š)=๐ป๐‘€๐ด๐ถโˆ’๐‘†๐ป๐ด512(๐‘,๐‘†)
where ๐‘  is the constant "Bitcoin seed".

 

3. Child Key Derivation
Child keys are derived from the master key using a deterministic algorithm. Each child key pair (private key, chain code) is generated using:
(๐‘˜๐‘–,๐‘๐‘–)=๐ถ๐พ๐ท(๐‘˜๐‘,๐‘๐‘,๐‘–)where ๐‘˜ ๐‘ k p โ€‹ is the parent private key, ๐‘ ๐‘ c p โ€‹ is the parent chain code, and ๐‘– i is the index of the child key.
 

4. Child Key Derivation Function (CKD)
For normal child keys:
๐ถ๐พ๐ท(๐‘˜๐‘,๐‘๐‘,๐‘–)=๐ป๐‘€๐ด๐ถโˆ’๐‘†๐ป๐ด512(๐‘๐‘,๐‘ ๐‘’๐‘Ÿ(๐‘˜๐‘)โˆฅ๐‘ ๐‘’๐‘Ÿ(๐‘–))For hardened child keys (with index ๐‘–โ‰ฅ231๐ถ๐พ๐ท(๐‘˜๐‘,๐‘๐‘,๐‘–)=๐ป๐‘€๐ด๐ถโˆ’๐‘†๐ป๐ด512(๐‘๐‘,0๐‘ฅ00โˆฅ๐‘˜๐‘โˆฅ๐‘ ๐‘’๐‘Ÿ(๐‘–))
 

5. Address Generation
Public keys are derived from private keys:
๐พ๐‘–=๐‘˜๐‘–โ‹…๐บwhere G is the generator point on the elliptic curve. Addresses are generated from public keys, often using Base58Check encoding or Bech32 encoding.
 

Mathematical Formulas and AlgorithmsHMAC-SHA512
HMAC-SHA512 is used to derive keys and chain codes:

HMACโˆ’SHA512(key,message)=SHA512((keyโŠ•opad)โˆฅSHA512((keyโŠ•ipad)โˆฅmessage))

 

where opad is the outer padding (0x5c5c...5c5c, repeated to block size) and ipad is the inner padding (0x3636...3636, repeated to block size).

 

Base58Check Encoding
Base58Check Encoding is used for user-friendly addresses:
 

  1. Add version byte in front of the data.
  2. Compute the double SHA-256 hash of the version and data.
  3. Take the first 4 bytes of the hash; this is the checksum.
  4. Append the checksum to the version and data.
  5. Encode the resulting byte string in Base58.

Bech32 Encoding
Bech32 Encoding is used for SegWit addresses:
 

  1. Divide the input data into 5-bit chunks.
  2. Compute the checksum using the polymod algorithm.
  3. Append the checksum to the original data.
  4. Encode the result using the Bech32 character set.

 

 

Conclusion
Understanding the various address formats in BlockDAG systems and BIP32 hierarchical deterministic wallets is crucial for navigating the diverse landscape of blockchain technology. BlockDAG addresses enhance scalability and throughput with their graph-like structure, while BIP32 simplifies key management and backup through its hierarchical design. Each format offers unique benefits, tailored to the specific needs of the blockchain system it supports. Whether you are working with a BlockDAG implementation or managing a BIP32 HD wallet, mastering these details, algorithms, and mathematical formulas will enhance your ability to effectively utilize blockchain technology.

BlockDAG LogoBlockDAG Logo