BlockDAG Dashboard v3

logout

Notifications

0
logout

Connect Wallet

Dev Release 39

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