How Conflux and Ethereum Generate Public and Private Keys

·

In the blockchain ecosystem, public and private keys serve as the unique identifiers and proof of ownership for users. Conflux operates across two distinct spaces: Core Space and eSpace, with eSpace being fully compatible with Ethereum. This article explores how Conflux Core Space and Ethereum generate critical private and public keys, along with the process of deriving user addresses.


Understanding Private and Public Keys

Private Keys

In both Conflux and Ethereum, a private key is a 64-character hexadecimal string.

👉 Learn more about secure key generation

Public Keys

Public keys are derived from private keys using the Elliptic Curve Digital Signature Algorithm (ECDSA), specifically the secp256k1 curve.


Address Generation in Conflux eSpace and Ethereum

Conflux eSpace and Ethereum share the same address generation logic due to full compatibility.

Step-by-Step Process:

  1. Private Key Generation:

    • A 64-character hexadecimal string or a wallet mnemonic phrase (see FAQ for details).
  2. Public Key via ECDSA:

    • The private key is processed through ECDSA to yield a 128-character hexadecimal public key (130 characters with 04 prefix for uncompressed format).
  3. Hashing the Public Key:

    • Apply Keccak-256 hashing:

      value = Keccak256(pubkey)  
    • Retain the last 20 bytes (40 hexadecimal characters) as the account address (often prefixed with 0x).

Conflux Core Address Generation

Conflux Core uses a base32-encoded format (per CIP-37) to avoid confusion with Ethereum’s hexadecimal addresses.

Hex Address Calculation:

  1. A 20-byte hexadecimal string is derived from the Keccak-256 hash of the public key.
  2. A type indicator (4-bit) prefixes the address:

    • 0x1: Externally Owned Account (EOA).
    • 0x8: Contract address.
    • 0x0: Internal Conflux address.
  3. Combine the type (1 character) and the last 39 characters of the hashed public key (156 bits) to form a 40-character hex string.

Base32 Conversion:

👉 Explore Conflux address standards


FAQ

1. Can I use the same private key for Conflux and Ethereum?

Yes, but only in Conflux eSpace. Core Space addresses differ due to distinct encoding methods.

2. What happens if I lose my private key?

You permanently lose access to the associated assets—no recovery is possible.

3. Why does Conflux Core use base32 addresses?

To prevent user confusion and erroneous transactions between Conflux Core and Ethereum networks.

4. Is it safe to generate keys online?

No. Always use offline methods to ensure security.


Key Takeaways

For further reading on elliptic curve cryptography, see ECDSA Wikipedia.