Accounts & Keys

Ed25519 key pairs, addresses, signing, multisig, and delegation.


Every single-key XE account is an ed25519 key pair, but the address is not the public key. Both are 32 bytes / 64 lowercase hex, so nothing about the wire shape gives it away — the values differ, and substituting one for the other fails validation:

address = sha256("xe/account/v1" ‖ pubkey_32)

The address is the identity: it goes in a block's account, destination and representative, in /accounts/{address}/* paths, and in provider / consumer on leases. The public key is the credential: it appears as pub_key on a chain's first block, on directory registrations and on chat envelopes, and as signatures[].public_key on multisig blocks. Because SHA-256 is one-way, a key cannot be recovered from an address — anything that must verify a signature is handed the key alongside it. Committing to the key instead of being it is what allows a key to be rotated later without the account changing. No prefixes, no checksums.

Key Generation

kp, err := core.GenerateKeyPair()        // random
kp := core.KeyPairFromSeed(seed)         // deterministic from 32-byte seed
addr := kp.Address()                     // sha256("xe/account/v1" ‖ pubkey); core.DeriveAddress(pubKeyHex) for a bare key

xe wallet create prints both values and a 24-word recovery phrase (xe wallet phrase shows it again; xe wallet restore rebuilds the seed file from it).

Block Signing

  1. Canonical encoding via MarshalBlockCanonical()
  2. SHA-256(networkID ‖ canonical ‖ aux) → b.Hash — the aux tail (MarshalBlockAux) frames the opening block's pub_key (tag xe/block/pubkey/v1, present only when previous == "0") and, on lease-family blocks, the certificate hash plus the timekeeper attestations; it is empty for every other block. Genesis is hashed with the network-ID prefix cleared
  3. ed25519.Sign(privateKey, hashBytes) → b.Signature

The first block of a single-key chain must declare pub_key (the node checks it derives account); every later block must not — the key is already on the chain, and accepting a redeclaration would be a silent credential swap.

Multisig Accounts

  • Address = sha256(canonical(keyset)) (hash-derived)
  • Opened with multisig_open block
  • Rotated via multisig_update blocks
  • Spending: M-of-N threshold; Receiving: 1-of-N

Delegation

Each block includes an optional Representative field. Empty means keep current delegation. Delegation weight is the account's XE balance in micro-XE — XCU is mintable by authorized minters and must not mint consensus weight, so it contributes nothing.

Recovery phrase v2

New wallets generate 24 English BIP39 words from 256 bits of random entropy. Import accepts 12, 15, 18, 21 or 24 words. The phrase is your only backup unless you separately keep the hex seed. Anyone with your backup controls the account.

XE uses standard BIP39 (PBKDF2-HMAC-SHA512, 2048 iterations, NFKD words and passphrase), followed by SLIP-0010 ed25519 at m/44'/22597'/account'. Every level is hardened. Account defaults to 0 and ranges through 2147483647. The coin type is 22597. A recovery phrase made before testnet-0006 used coin type 1 and restores to a different address now. The 32-byte leaf key is the signing seed. Address derivation stays unchanged.

phrase, err := core.NewRecoveryPhrase() // save securely; never log
kp, err := core.KeyPairFromPhrase(phrase, "", 0)
err = core.ValidatePhrase(phrase)

The BIP39 passphrase defaults to empty and is available only by explicit opt-in. Creation requires two identical entries. Restore asks once; check the resulting address against your backup. Keep it separately and avoid a weak passphrase. It is never stored, logged or accepted on argv. A wrong passphrase opens a different, empty account. It is separate from the web vault password. Save the account index with your backup.

The signing seed remains authoritative: wallet.seed is still 64 hex characters and a newline, mode 0600. wallet.phrase, also 0600, adds normalized words, account: N on a second line and address: <64 hex> on a third. The CLI reveals the words only when this address matches the signing seed's address. A missing or mismatched address prints no words and directs you to wallet.seed for backup. Create and restore refuse to overwrite a stray phrase file when the seed is missing. A phrase cannot be computed from a signing seed; hex-only wallets have no phrase.

Wallets made before v2 restore from their hex seed. Their old #1005 words encoded the seed directly. Those words also have valid BIP39 checksums, so v2 cannot detect them; it derives a different, empty account. No legacy mode is provided. Keep the old seed file or import its hex in the web wallet.