Skip to content
ENBANKDesk

Enbank docs

Accounts and keys

How the desk creates an EVM account, stores the key, and accepts addresses.

On this page

Key generation

The first visit to /app with an empty wallet shows the gate. createWallet calls generatePrivateKey and privateKeyToAccount from viem/accounts. That yields a secp256k1 private key and the checksummed address derived from it.

type LocalWallet = {
  address: `0x${string}`;   // 20 bytes, 40 hex chars
  privateKey: `0x${string}`; // 32 bytes, 64 hex chars
};

The gate shows the address before you enter. Reveal key shows the hex key in the same session, with a warning that it is stored in the browser. Entering the desk calls setAddress, so the preview ledger's address field becomes that EVM address and custom becomes true.

Browser storage

The wallet is a JSON blob at localStorage["enbank.wallet.v1"]. It is not encrypted, not wrapped by a passphrase, and not synced. Any script running on this origin can read it. Closing the tab does not clear it. A new browser profile does.

readWallet rejects the blob unless the address matches /^0x[a-fA-F0-9]{40}$/ and the key matches /^0x[a-fA-F0-9]{64}$/. A corrupt value is treated as no wallet, and the gate shows again.

Address formats

isAddress accepts two shapes. The generator only produces the first.

ShapeRuleShort form
EVM0x plus 40 hex characters0x1234…abcd (6 + 4)
Solana-styleBase58 alphabet, length 32 to 44First 4 and last 4 characters

The base58 check uses the alphabet without 0, O, I, and l. It checks length and charset. It does not decode to 32 bytes or verify a checksum. A string can pass the desk and still be an invalid Solana pubkey.

The seeded preview address, used until a wallet is adopted and after a desk reset, is the base58 constant 7KqE2nB4aR9cM3uP6xL8sD1fH5jT2wY8vC4bN7mQ3eA.

Account menu

After the gate, the desk header can:

  • Copy the address.
  • Use another address, which writes desk.address if isAddress accepts it.
  • Reveal the stored private key.
  • New wallet, which calls clearWallet and returns to the gate. The preview ledger is left in place until you reset it.
  • Reset preview, which replaces the ledger with createDesk() and the sample address. See the preview ledger.

Custody boundary

The address is the account only in the product sense: the desk attributes balances and activity to it. This site does not custody assets for that address, does not watch it on a chain, and does not derive a Solana keypair from the EVM key. Production settlement would still need a Solana signer for the MXE program transactions. That signer is not this preview key.