Qsafe

How Qsafe works

Qsafe is a vault contract on Elysium. Funds inside it move only when one of your one-time hash keys signs the exact action. Your wallet funds the vault; it never controls it.

Your keys

When you open a vault, your browser draws a random 32-byte seed and derives 64 one-time keys from it. Each key is 67 secret values. Hashing each value 15 times gives the key's public end; the 67 ends hash into one leaf, and the 64 leaves form a Merkle tree. Only the root of that tree (32 bytes) and a public seed go on-chain.

  • The seed is encrypted in your browser with your passphrase (AES-GCM, PBKDF2 with 310,000 rounds). It never reaches our server.
  • Your recovery code is the seed written as 52 letters and digits. It rebuilds every key, on any device.
  • When a set runs low, you rotate to a fresh set of 64 keys derived from the same seed. The last two keys of a set can only sign that rotation, so you can never lock yourself out.

One signature, step by step

The action (swap, withdraw, send or rotate), the vault number, the key number, the key set, the vault address, the chain, a deadline and the current protocol fee are hashed into a 32-byte digest. The digest is read as 64 base-16 digits, plus 3 checksum digits. For each of the 67 digits, the signature reveals the secret value hashed that many times.

The vault hashes each revealed value the remaining number of times, rebuilds the leaf, climbs the 6-node Merkle path and compares the result with your root. If it matches, the key is marked as burned and the action runs. Changing one bit of the action changes the digest, and the checksum makes it impossible to reuse a signature for another digest without reversing keccak256.

Hashkeccak256, tweaked by public seed, key, chain and step
Digitsbase 16 (w = 16), 64 message + 3 checksum = 67 chains
Keys per set64 (tree height 6), up to 1,024 supported
Signature67 × 32 bytes + 6 × 32 bytes path
Gasabout 230,000 for a withdrawal, 390,000 for a swap, paid by our relayer

What a vault can do

  • Deposit: anyone can fund any vault with HYPE or any Elysium token, from a normal wallet.
  • Swap: through the Uniswap v4 PoolManager on Elysium, up to three pools (HYPE, USDC, KNTQ and every Montra coin). You sign the route, the amount and a minimum output; the result lands back in the vault.
  • Withdraw: to any address.
  • Send to another vault: the balance moves inside the contract, no wallet key in between.
  • Rotate: hand over to a fresh key set.

Security model

  • No elliptic curve. Nothing in the vault's authorization uses ECDSA or any public key on a curve. Breaking a signature means finding a keccak256 preimage.
  • A stolen wallet key moves nothing. The wallet that deposited has no power over the vault.
  • The relayer can't change a byte. It pays the gas and submits what you signed. Any change to the amount, route, recipient, deadline or fee breaks the signature.
  • One key, one action. Each key is burned on-chain after use. The app also marks a key as used the moment it signs, before anything leaves your browser, so no key ever signs twice.
  • The owner can't touch balances. The contract owner can only set a protocol fee on swaps (never above 0.5%) and where that fee goes. A fee change voids pending signatures.
  • What it doesn't protect. Elysium itself, its bridge and the tokens you hold still rely on their own cryptography. Your deposit transaction is signed by your wallet. Smart contracts can have bugs: only deposit what you can afford to lose.

Contracts

QsafeVault (vault, swaps, keys) and HashSig (the verifier library) on Elysium, chain 99901. Vault: . Swaps go through the Uniswap v4 PoolManager 0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1.

The contracts were tested against a fork of Elysium with real pools: 22 Foundry tests (including forged, tampered, replayed and cross-account signatures, key exhaustion and rotation) plus vectors that check the browser signer against the on-chain verifier byte for byte.

API

JSON over HTTPS, no key. Agents can use it as is.

GET  /api/exposure?address=0x…     is this wallet's public key on-chain? (5 chains)
GET  /api/quote?in=0x…&out=0x…&amount=…   exact output on the live pools (base units)
GET  /api/account/:id               a vault: key set, used keys, balances
GET  /api/activity                  latest vault events on Elysium
POST /api/relay                     submit a signed action (the relayer pays the gas)
curl -s "qsafe.ink/api/exposure?address=0x000000000000000000000000000000000000dEaD"