Home > Coding > How to generate crypto wallet address: A Structured Model for Multi-Chain Compatibility

How to generate crypto wallet address: A Structured Model for Multi-Chain Compatibility

In the domain of elliptic curve cryptography, the ECDSA-SECP256k1 algorithm provides a hierarchical structure for key generation and derivation, enabling a single mnemonic seed to produce a master private key (the “parent”) from which public keys (direct “children”) and chain-specific addresses (derivatives) are generated. This model underpins interoperability across blockchains such as Bitcoin (BTC) and Ethereum (ETH), where the private key serves as the root of trust for transaction signing, while public keys and addresses adapt to network-specific formats.

This document elucidates the relationships:

  • Mnemonic Seed: Entropy source for the hierarchy.
  • Private Key: Parent node—core secret for signing.
  • Public Key: Child node—derived via point multiplication, used for verification.
  • Addresses: Grandchildren—hashed and encoded variants of the public key, tailored per chain.

A tabular representation clarifies the hierarchy, followed by derivation steps and examples. This structure facilitates secure, multi-chain deployment in wallets like MetaMask or Electrum, reducing key management overhead in heterogeneous environments.

Hierarchical Relationships: A Tabular Overview

The derivation forms a tree-like structure, with each level building on the previous for security and usability. The private key acts as the central “parent,” from which all verifiable elements descend. The table below illustrates the relationships, input/output formats, and chain adaptations.

LevelComponentRoleInputOutput FormatRelationship to ParentChain Adaptation Example
RootMnemonic Seed (BIP39)Human-readable entropy source for recoveryRandom 128-256 bits12-24 words (e.g., “abandon ability able…”)N/A (originates hierarchy)Universal—Same mnemonic restores all chains
ParentPrivate KeyCore secret for signing transactions; root of trustMnemonic seed + PBKDF2 (2048 iterations)64 hex chars (256 bits, e.g., “e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35”)Direct from seed (BIP32 master)Universal—Signs for all SECP256k1 chains (BTC, ETH)
ChildPublic KeyVerification artifact; proves ownership without revealing private keyPrivate key × SECP256k1 generator point (G)130 hex chars uncompressed (04 + x + y, e.g., “0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b235202485758b173d470a122a480ce7b011e6f4727883325288628a44bdfd2a7bbe5”) or 66 compressedDeterministic child of private key (irreversible multiplication)Universal—Verifies signatures on all chains
GrandchildAddressReceiving identifier; hashed/encoded public key for on-chain lookupPublic key + Chain hashing/encodingChain-specific (e.g., BTC: 34 base58 chars “1Afv47SJAf47SJAf47SJAf47SJAf47SJAf”; ETH: 42 hex chars “0x1a2b3c4d5e6f7890abcdef1234567890abcdef12”)Hashed child of public key (e.g., BTC: RIPEMD160(SHA256(pub)); ETH: Keccak256(pub[1:])[-20 bytes])Chain-specific—BTC uses legacy base58; ETH uses hex for gas efficiency

This hierarchy ensures forward security (compromise one child doesn’t reveal parent) and recoverability (mnemonic rebuilds the tree).

Derivation Process: Step-by-Step Conversion

The process is deterministic: Same input always yields the same output, enabling recovery. Below is a sequential walkthrough using the example mnemonic “abandon ability able about above absent absorb abstract absurd abuse access accident.”

Step 1: Mnemonic → Seed (Entropy to Binary)

  • Input: Mnemonic words.
  • Process: Map words to bits (11 bits/word), add checksum, apply PBKDF2 with “mnemonic” salt (2048 iterations, HMAC-SHA512).
  • Output: 64-byte seed (e.g., 5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac1a0a0b3d0a0e0f0a0b0c0d0e0f0a0b0c0d0e0f0a0b0c0d0e0f0a0b in hex).
  • Purpose: Converts human-readable words to cryptographic material.

Step 2: Seed → Private Key (Master Parent)

  • Input: Seed.
  • Process: HMAC-SHA512 on seed → First 32 bytes = Master private key (BIP32).
  • Output: 64 hex chars (e.g., e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35).
  • Purpose: The “parent” secret—Signs all transactions.

Step 3: Private Key → Public Key (Direct Child)

  • Input: Private key.
  • Process: Multiply private key by SECP256k1 generator point G (elliptic curve point multiplication).
  • Output: 65-byte uncompressed (e.g., 04 + 32-byte x + 32-byte y = 0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b235202485758b173d470a122a480ce7b011e6f4727883325288628a44bdfd2a7bbe5).
  • Purpose: Verifiable “child”—Proves ownership without exposing parent.

Step 4: Public Key → Address (Chain-Specific Grandchild)

  • Input: Public key.
  • Process: Chain-specific hashing + encoding.
  • BTC: SHA256(pub) → RIPEMD160 → Prepend 0x00 → Double SHA256 checksum → Base58 encode.
  • ETH: Keccak256(pub[1:]) → Take last 20 bytes → Prepend 0x.
  • Output: Address (e.g., BTC: 1Afv47SJAf47SJAf47SJAf47SJAf47SJAf; ETH: 0x1a2b3c4d5e6f7890abcdef1234567890abcdef12).
  • Purpose: “Grandchild” label—Receives funds; Unique per chain to avoid collisions.

Reversibility (Conversion Back)

  • Address → Public Key: Not possible (one-way hash); Requires full keypair.
  • Public Key → Private Key: Impossible (ECDSA one-way).
  • Private Key → Mnemonic: Not direct; Requires reverse-engineering entropy (infeasible).
  • Mnemonic → All: Fully reversible—Words rebuild the tree.

Example Derivation Chain

Using mnemonic “abandon ability able about above absent absorb abstract absurd abuse access accident”:

StepComponentValue (Example)Derivation Method
1Mnemonicabandon ability able about above absent absorb abstract absurd abuse access accidentUser input/random entropy
2Seed5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac1a0a0b3d0a0e0f0a0b0c0d0e0f0a0b0c0d0e0f0a0b0c0d0e0f0a0bPBKDF2(mnemonic + salt)
3Private Key (Parent)e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35HMAC-SHA512(seed) first 32 bytes
4Public Key (Child)0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b235202485758b173d470a122a480ce7b011e6f4727883325288628a44bdfd2a7bbe5Private × G (SECP256k1)
5aBTC Address (Grandchild)1Afv47SJAf47SJAf47SJAf47SJAf47SJAfRIPEMD160(SHA256(pub)) + Base58
5bETH Address (Grandchild)0x1a2b3c4d5e6f7890abcdef1234567890abcdef12Keccak256(pub[1:])[-20 bytes] + 0x

Conversion Tools and Best Practices

  • Online (Safe): Ian Coleman BIP39 Tool—Input mnemonic, see all.
  • Code Snippet: Python for derivation (from our framework).
  • Tips: Backup mnemonic only; Use HD paths (BIP44) for child keys per chain.

This hierarchy powers the multi-chain economy—One parent, many children. Questions? Test with the tool!

Leave a Comment