Seedelf-Wallet

Architecture

Keep it light: a small Manifest V3 extension, the Seedelf crypto and transaction building we already have in Rust (compiled to WebAssembly), and Koios for chain data (on mainnet, the wallet’s own data layer first). Nothing else unless it earns its place.

Shape

flowchart LR
  UI["UI<br/>(full tab or side panel)"] -- "typed RPC (a port per request)" --> SW
  subgraph SW["Service worker"]
    Vault["Vault + lock"]
    Wallet["Wallet state"]
    Crypto["seedelf-crypto (WASM)"]
    Tx["Tx building + signing"]
  end
  SW -- "fetch" --> Koios["Koios<br/>(mainnet: the data layer first)"]
  SW -- "fetch" --> Collat["giveme.my collateral"]
  SW -. "fetch, only when used" .-> Others["CoinGecko (mainnet), Minswap's aggregator,<br/>the IPFS gateway"]
  Page["dApp page"] -. "CIP-30 via content scripts<br/>(only when the user turns it on)" .-> SW

Service worker

Crypto

Transaction building

Decided: Rust (Pallas 0.35), compiled to WebAssembly.

What’s built on it: move-in, creating a Seedelf, transfer, withdraw, removing a Seedelf, a send from the Cardano account, staking (delegate, vote, withdraw rewards, stop), a private session’s funding and return (Minswap builds the swap, and the wallet only signs it), Lovejoin’s deposits, mixes and withdraws, the account’s own DRep’s registration, update, retirement and votes, and a session’s cancel of its DEX orders (seedelf-core/src/orders.rs).

In the CLI, every script spend ends in seedelf-cli/src/commands/spend.rs: prove, evaluate, finish, giveme.my, sign, submit. Only create, fund and util extract still build inside their run()s; the web wallet doesn’t need them.

Tests guard it. The CLI’s offline integration tests (seedelf-cli/tests/cli/) check value conservation, min-UTxO and valid change registers for each command, and seedelf-core/tests/build_test.rs checks the builders directly.

Reading a transaction

Decided: in WebAssembly, with Pallas, as a function of its bytes alone (wasm/src/decode.rs). decodeTx(network, txCbor) answers a TxDetail: CBOR in, structure out. It takes no account, no keys and no UTxOs, so it makes no network call, a fixture file is a whole test of it, and it cannot be wrong about the account because it never sees one. The network only names Seedelf Wallet’s own contract; every address is read from its own bytes.

Three readers, three jobs. None of them is the others.

Both Rust readers decode Conway’s format alone (conway::MintedTx in decode.rs, conway::Tx in cip30.rs). That was partly for size: Pallas’s all-era MultiEraTx costs about 540 KB of module. But seedelf-core’s evaluator (eval.rs) and Lovejoin’s withdraw context (lovejoin/mod.rs) decode with MultiEraTx, so the module carries it anyway, and size is no longer a reason to keep the two readers on Conway alone.

What the decoder does that matters:

Three rules come from reading Conway’s CDDL against what JavaScript and a screen can hold. Each is a way the bytes could have been shown wrongly:

  1. Every number the bytes decide is a decimal string, not only the lovelace ones. coin, slot, epoch and metadatum_label are uint up to 2^64-1 there and ex_units is 0 .. 2^63-1, while JSON.parse rounds anything past 2^53: a ttl of 2^60+1 would show as 1152921504606846800, off by 177. Only counts the decoder works out itself — the size, an output’s position, how many witnesses — are numbers. A Plutus integer past 128 bytes (about 300 digits) is the one number shown in hex (0x…): its decimal costs a pass over its bytes for every digit, and a site chooses its length, so one filling a transaction kept the worker busy for minutes (chunk 51, w2#3).
  2. Bytes that aren’t the thing they should be are shown as themselves. The CDDL types an output’s address and a withdrawal’s reward_account as plain bytes, so a transaction can carry bytes that are no address at all. They show as hex, with the kind unreadable, and every other field still reads, rather than one such output hiding the whole transaction.
  3. Text from the chain is escaped where it would show as something else. A metadatum, a token name, an anchor’s URL and a relay’s host are whatever was written — a right-to-left override turns “drowssap” into “password” on the screen, and a zero-width joiner hides a word break. Each such character is written out as \u{...} (decode::shown, the same set as ui/tokens.ts’s HIDDEN), and unicode-bidi: isolate in the stylesheet keeps a right-to-left script, which is nobody’s trick, inside its own element.

It also checks the metadata against the body’s hash (metadataHashMatches). Metadata whose hash the body doesn’t carry can’t reach the chain with that body, and the view would otherwise show a note that never could. The metadata the body does commit to still can: a signature covers the body alone, so a site can submit it with the body and the witnesses the wallet hands back. A transaction whose two disagree gets a warning and is still shown in full. A site’s sign window says so too, above its note, from the connector’s own read of the bytes it signs (cip30::inspect’s metadata_mismatch, a hash with no metadata included, and metadata it couldn’t read for the hash; chunk 51, G5’s notes, sign#1), so no decode a site can make fail silences it.

What it refuses, in words, rather than showing partly: a certificate from before Conway (a genesis key delegation or a move of instantaneous rewards, variants 5 and 6, which Conway dropped and no node accepts today) — Pallas can’t decode one, and showing a transaction with a certificate missing would be worse than saying so. A body field from an older era, such as Shelley’s update (key 6), is only a field: it’s reported with its hex and the rest reads.

In the worker, tx-view.ts is the cheapest handler there is: no Koios request, no storage write, nothing kept. Every flow parks its built transaction in session storage under its own key and script-spend.ts strips the CBOR out of the summary the screen gets, so the view is asked by transaction hash — which every review already has — and the worker looks the bytes up where they live, walking the kept record rather than knowing each key’s shape (a session’s return keeps its chain inside it; Bring everything back keeps a list). A chain through Lovejoin still being sent is looked for where it’s sent from (SESSION_LOVEJOIN_SENDING, and each session’s SESSION_CHAIN_PREFIX key, by the indices the device knows), since its transactions move there from the key they were kept for Send under; the Lovejoin page’s row for the chain opens each (O3). It’s looked for there first, before what’s kept for Send (a session’s return keeps the same bytes there until its first submit), and the answer says so (TxView.chain): Transaction details then says its signatures were made when the chain was prepared, never that they wait for a confirm (1.3.0’s release review, C17). A hash it no longer holds that a recorded chain names (inChain in lovejoin.ts: the sealed schedule’s deposit, mixes and last, no Koios) gets “The wallet no longer holds that transaction: its chain through Lovejoin was all sent, or stopped partway.” rather than “Review it again” (C28). A site’s are in the connector’s own queue (Waiting.txCbor), held only while the request waits. It shows sentCbor where there is one, so a payment Koios didn’t answer shows the bytes that will be sent again. It also marks each output that pays the user (TxOutput.yours, blind test §9.9): the public accounts’ payment keys (the active one’s from its keys and the last reading, others’ derived on the device), the user’s own register in the wallet contract, and the private sessions’ one-time keys. A reward address has only a stake key, so a withdrawal’s and a proposal’s deposit back (TxWithdrawal.yours, TxProposal.yours) are marked by that: the active account’s, a session’s, then each other account the wallet knows. A certificate’s stake key isn’t, since a site’s sign window already says whose it is. Still no request; locked, nothing is marked.

The bytes never reach the screen until it asks. That is what makes opening or closing the view safe: Send reads the transaction back out of its session key, not out of a component, so the signed bytes were never in the view’s hands. A test pins it, and so does an end-to-end one in the browser.

Networks

One build, both networks: mainnet by default, preprod for testing. Every build has both (enabledNetworks in networks.ts), the dev build included:

The switch:

What’s kept per network, checked for the switch:

What Where
Balances, the contract scan, the account’s UTxOs, addresses and Activity pages seedelf.balances.<network>, seedelf.contract.<network>, seedelf.accountUtxos.<network>, seedelf.accountAddresses.<network>, seedelf.accountActivity.<network>
The Seedelf history, coin control, private sessions, Lovejoin’s schedule and chains, a payment that may still go through, a mix from the public account kept by Remove wallet, who paid for each Seedelf minted here sealed history.<network>, coins.<network>, sessions.<network>, lovejoin.<network>, maybeSent.<network>, lovejoinMaybe.<network>, mintedBy.<network>
Contacts, connected sites one sealed record each, every entry with its network
Seedelf Messaging: the inbox, each conversation, the requests, where the next read goes on from, what waits to be posted, what the reads found that isn’t taken yet, its steps’ marks, the certificate list’s copy with the wallet’s own certificates and withdrawals waiting, the register each Seedelf minted here went under, and its switch sealed messaging.<network>, conversation.<network>.<id>, messagingRequests.<network>, messagingRead.<network>, messagingOutbox.<network>, messagingTake.<network>, messagingMark.<network>, messagingTakeMark.<network>, messagingList.<network> and mintedAt.<network>, with the unsealed messagingTrap.<network> and messagingWithdraw.<network>; messaging.<network> in the settings; its holds and its posting runs’ waits in session storage, by network (Seedelf Messaging)
The payment the pending watch follows, maybe sent or not seedelf.pendingTx.<network>, one per network: a Send on one never drops the other’s watch
A chain being sent, and what chains reserve seedelf.session.chain.<network>.<index>, seedelf.lovejoin.sending.<network>, seedelf.reserved.<network>
A payment’s parts still to go seedelf.waiting.<network>, and each part under seedelf.waitingPart.<hash>, recording its network
Transactions kept for Send one slot each, recording its network; the submit checks it
The pool list, the live governance actions, the dApp connector’s reading seedelf.pools.<network>, seedelf.govActions.<network>, seedelf.dapp.view.<network>, seedelf.dapp.signed.<network>
ADA’s price mainnet only; nothing is asked on preprod

What isn’t per network: the vault (keys don’t depend on the network), the settings, the active account (seedelf.account) and the language (seedelf.language), and the spent outpoints (seedelf.spent), which no two networks share. What sites’ submits spent is kept apart from the wallet’s own (seedelf.spent.sites, the newest 5,000, never in the list of sent transactions), so a site can’t push out what the wallet spent; spentSet and lastSpentAt read both (independent review L7).

One network value drives everything network-specific. The Rust side already takes a network_flag everywhere (true = preprod), and the WebAssembly API passes it through. This is how the CLI’s --preprod works.

  Preprod Mainnet
Koios https://preprod.koios.rest/api/v1 https://api.koios.rest/api/v1
Collateral service https://www.giveme.my/preprod/collateral/ https://www.giveme.my/mainnet/collateral/
Contract config get_config(variant, true) get_config(variant, false)
Addresses addr_test… addr…
Minswap’s aggregator aggr.monorepo-testnet-preprod.minswap.org agg-api.minswap.org
Lovejoin’s mix_box 67ffe4ed…ecc5 c145c10f…1fad
Lovejoin’s pool floor none 30 others’ boxes
Seedelf Messaging open, off until its switch is turned on not right now
ADA’s price none CoinGecko
An NFT’s image ipfs.blockfrost.dev ipfs.blockfrost.dev

Chain data

Mainnet through the wallet’s own data layer, at https://mainnet.seedelf.logicalmechanism.io. The API is seedelf-data/, on a DigitalOcean droplet that reads home’s node, db-sync and Kupo through WireGuard (its runbook); the records of its design are the archived plans for the wallet’s side and the server. Preprod, and mainnet with the Koios-only switch on, read Koios as the rest of this section describes, and so does each part while it’s held on Koios. The data layer:

Koios, same as the CLI. Balances come from extension/src/background/koios.ts (the client), chain.ts (pure helpers) and balances.ts (the service).

What one balance reading asks Koios (four requests: the contract’s and the stake key’s alongside the account’s two, which run one after the other):

Request For
credential_utxos with the wallet contract’s script hash Every UTxO in the contract, or only those after the last block seen (below), to find the owned ones
account_addresses with the Cardano account’s stake address (_empty: true) Every address that has used the stake key, including empty ones, for discovery
credential_utxos with the account’s payment key hashes in range Every UTxO under those keys, whatever the address’s staking part. At most 75 keys a request (Koios’s public tier refuses bodies over 5,120 bytes), so an account with more than about 35 used addresses takes more than one.
account_info with the stake address Whether it’s registered, its pool, its vote delegation, its rewards and its deposit. No row means never registered. The pool’s ticker comes from what the session has read, the pool list on the device, or one pool_info a session.

Storage

Permissions: storage, alarms, sidePanel and scripting, plus the host permissions for the build’s networks’ Koios and giveme.my (and CoinGecko, in a mainnet build). The sites (https://*/*, http://localhost/*, http://127.0.0.1/*) are optional host permissions, asked for when the dApp connector is first turned on and kept after (see dApp connector). One host under them, https://ipfs.blockfrost.dev/*, is asked for on its own the first time the user shows an NFT’s image.

Where Key What
chrome.storage.local seedelf.vault The encrypted vault: a single SecretBox blob, see keys-and-accounts.md
chrome.storage.local seedelf.unlockFailures { count, lastFailureAt } for the unlock back-off
chrome.storage.session seedelf.entropy The vault entropy, only while unlocked
chrome.storage.session seedelf.lastActivity When the user last did something, for auto-lock
chrome.storage.session seedelf.unlockedAt When the wallet last unlocked (or was created or restored), for the unlock’s fresh draws; only while unlocked (independent review M10, L10)
chrome.storage.session seedelf.restored true from a restore until a Home has said so with a reading, or the note was dismissed (restored, blind test T20a, T20b): the fact alone, so the note shows in whichever page opens Home next. Wiped by a lock and Remove wallet, so a later unlock is never called a restore; a create never sets it
chrome.storage.session seedelf.sends When the wallet last sent something before a lock (or, while unlocked, the last try of a payment let go as unseen: final review F8), and when session storage began (noted at each worker start if missing), for Lovejoin’s quiet rule. Kept across a lock and Remove wallet, cleared when the browser closes or the extension updates: two times, nothing of what was sent (independent review M10)
chrome.storage.session seedelf.dapp.refused The sites the user declined, or whose page left a connect question or an unlock wait unanswered (chunk 51, G6’s note), turned away unasked for a while: by origin, until, how many in a row, the network and whether one asked again, never a page’s title (dapp.ts keepRefusals; blind test §9.2 and its cross-area review). Kept across a lock and a trap, not Remove wallet
chrome.storage.session seedelf.balances.<network> The last balance reading, only while unlocked
chrome.storage.session seedelf.contract.<network> This wallet’s contract UTxOs, where each Seedelf is (outpoint, address, register) and the last block seen (contract-scan.ts), only while unlocked
chrome.storage.session seedelf.accountAddresses.<network>, seedelf.accountActivity.<network> The account’s stake address, addresses and payment keys (from the balance reading), and its Activity pages, only while unlocked
chrome.storage.session seedelf.accountUtxos.<network> The account’s UTxOs with their key paths, from the balance reading, for the UTxOs screen and what’s locked; only while unlocked
chrome.storage.local seedelf.preferences The user’s settings: spendRewards; hideBalances, lockAfterMinutes and currency; dappConnector and dappPassword; lovejoinReturns, lovejoinDepth and lovejoinDelay (privacy review §4.1), and lovejoinWidth; lovejoinCollateral (a return’s collateral into a 5 ₳ pool); dappAccount, the public account connected sites use; koiosOnly, Read Cardano through Koios only; messaging, Seedelf Messaging’s switch for each network (changed through messaging-switch alone, and read as off on a network Messages isn’t open on, whatever is kept: MESSAGING_NETWORKS, preprod only for now). Not sealed: nothing in it is about money, though it shows which settings were changed. Deleted with the wallet, but for koiosOnly: with it on, Remove wallet and Forgot password write it back after the reset, the rest at their defaults, as they keep the network (1.5.0’s release review, C08).
chrome.storage.local seedelf.network The network the wallet is on, in a build with both (see Networks). Kept when the wallet is removed.
chrome.storage.local seedelf.account Which public account the wallet works on, as an index from 0. Unsealed, beside the network and for the same reason: Wallet reads it while deriving the keys, before anything is unlocked. One integer for the wallet, not one per network — the account’s keys are the same on both. Which accounts the phrase has used, and what they are called, are sealed (accounts). A create or restore puts it back to 0.
chrome.storage.local seedelf.language The language the wallet is in, en, es or ja. Unsealed, beside the network and the account and for the same reason: the screens before the unlock are shown in it. Kept when the wallet is removed.
chrome.storage.local seedelf.openIn Where the toolbar button opens the wallet: a tab or the side panel. The browser’s, so kept when the wallet is removed.
chrome.storage.local seedelf.pools.<network> Every live pool, for a day. The same for everyone, but its time shows when staking was last browsed. Deleted with the wallet.
chrome.storage.local seedelf.govActions.<network> The live governance actions, for an hour. The same for everyone, but its time shows when they were last read. Deleted with the wallet.
chrome.storage.local seedelf.lovejoinPools.<network> Lovejoin’s token pools found: every standard pool, as WebAssembly verifies it (its reference UTxO, seed and scripts at the holder, named by their hashes), with where its launch is, and the block Koios’s holder was read to; the pools handed to the reads, which never leave them (shown), the copies read once (checked: every later launch of a shown pool’s values a look kept, the same for every device; MERGED-1) and the box reader they were read with (reader, BOX_READER: under another, each is read once more; chunk 51, gap-g6#1), and a hash of the token list looked under (listed), which sends the next look back to the head start when the list changes (1.6.0’s release review, STATE-2 and STATE-4). Which copy holds the wallet’s boxes is never here: it’s sealed, in lovejoin.<network>’s copies (R2-4). The same for everyone, but its height shows when the wallet last looked. Deleted with the wallet.
chrome.storage.session seedelf.prices ADA’s price in every currency, for five minutes (mainnet only), so when it was read stays off the disk (privacy review §3.13); a copy an older version kept on disk is removed at the next read, and with the wallet.
chrome.storage.session seedelf.poolRefs.<network>, seedelf.stake.built The tickers of pools read this session (the user’s among them), and the staking transaction built last; only while unlocked
chrome.storage.local seedelf.private.<record> Sealed private records: accounts (which public accounts the phrase has used and what the user called them), contacts, history.<network> (the Seedelf history, which each UTxO’s history class is read from, with a note of each site transaction the user signed that pays their own Seedelf, until it lands or for 30 days), coins.<network> (the locked private UTxOs, shared, and each public account’s own locked UTxOs and collateral, by index, with the payments that set its collateral, the newest 20, kept through a reclaim, for Activity to name (collateralPaid); the older shape, from before there were several public accounts, reads as account 0’s and is folded in on the first write), dapps (the sites connected, per network; no account is recorded per site, since every public-account connection is to the one dApp account, Preferences.dappAccount), maybeSent.<network> (the payment being sent, from just before its submit, and one that may still go through, until it’s settled; kept by Remove wallet), sessions.<network> (private sessions: indexes, stages, transactions, with what each funding and top-up paid the session’s account (for a session the restore scan found, what the scan read there) and what a site’s signed transactions pay it, the newest 40 outputs, and, where a swap’s Splash order was filled in part, which transactions at its address were fills of it and which a stranger’s (remnants); a site’s session’s record goes when it’s disconnected, and a found one’s when it ends with nothing left (1.5.0’s release review, C02), unless something left behind is still at its account; while a found one whose record holds a swap waits to end, when a refresh first found it over (recovered.quietAt, 1.5.0’s cross-area review, X01); and, from a restore until a scan finishes on that network, a mark that it hasn’t (unscanned, C19), so a restore writes the record of every network the build has at once), lovejoin.<network> (boxes’ due times and their unlock marks, each chain the wallet sends with its leaves, a withdraw being sent, signed, with its box’s due time, from just before its submit until it’s seen, refused or 2 hours old, and what Koios said made each box no record accounts for (where it named no public account, that transaction’s inputs’ payment and stake keys and the accounts they were judged against, inputs and judged, judged again on the device once the wallet knows another account; one kept before those were is asked of once more where it knows an account past the first 24, chunk 51’s gap-g6#2, or where it says a deposit made the box, which those keys alone tell the phrase’s own from someone else’s, e1a#1), with the transactions it hasn’t answered for yet that the pool reads ask about again (asking: a count’s or rejudge’s, When it asks), kept until 3 hours after a pool read last listed a box of them; all of that the classic pool’s, as 1.5.0 kept it, with each token pool’s due times and counts beside it under pools (the counts: boxes not mixed yet, of them those Koios hasn’t said the making of, unsure, and those someone else, or another device, put in under the wallet’s key, someoneElse, which Home doesn’t flag, chunk 51’s e1a#1), and every mix in mixes, followed until its boxes are back; and copies, the copy pools a read found the wallet’s boxes in, read while anything of the wallet’s is left there; launches, the pools the wallet started, each with its values (box: its ADA, and its token with the quantity), its set (version: v2, none on a start before 1.8.0; 1.8.0’s release review, pr363#0) and, where Send sent the build without the certificate, the hash its review showed (reviewed), 1.6.0’s release review, 318-worker#1; depositors, a seed’s or Bootstrap’s deposit’s public account or private session once its chain’s record goes, kept as an origin is, 316#1 and chunk 51’s l2rank#3; mixedLeaves, of the leaves kept once a chain’s record goes, those a mix of that chain made, kept with them, so a deposit’s own box never reads as mixed (a leaf kept before it was reads as a box whose making the wallet can’t place, chunk 51’s l2still#2); each chain’s landed, all sent and known in, 321-lj-worker#0; while Bring every box back now goes, every pool’s, one pool’s or the retired pools’ (marked retired), how many it sent and left, why the last box didn’t go, what it waits for (waiting) and whether its withdraws’ confirmation is late (late), bringing, 321-lj-worker#1 and #4; each box its withdraws went for, with its pool and when, kept while a read of that pool lists it, counted, and when a read of the pools is owed for boxes with no due time, recheck: 2 hours after a run that sent withdraws stops, wlj-2’s notes, or at once where the first run on 1.8.0 or later dropped 1.7’s counts of boxes not mixed yet or let a 1.7 Bootstrap go, read once Bring every box back now is over or stopped (a Stop, pressed or the run’s own, never puts it later), and again 2 hours on while a box one of its withdraws went for is still listed and held as spent, 1.8.0’s release review, critic#3, and 1.8.0’s review of its fixes, r2-critic#0; its last run stopped by Stop, its count and its pool or that it was the retired pools’, until it’s asked again, bringStopped, L2; and, for a wallet that had something in the retired pools, when the first run on 1.8.0 or later retired them, once a network, the record’s own retired, a time, where bringing’s and bringStopped’s are marks), and mintedBy.<network> (who paid for each Seedelf minted here), and mintedAt.<network> (the register each Seedelf minted here went under, read from the transaction’s own bytes at Send: the Seedelfs that take Seedelf Messaging’s first messages by themselves; a name with none is one the wallet removed), and lovejoinMaybe.<network> (a mix from the public account stopped at a transaction that may have gone through, written only by Remove wallet while unlocked; final review F1), and, on mainnet alone, contract.mainnet (the private index’s cursor, the wallet’s rows as of it, the newer rows already checked, and v, the rule they were judged under: The private side, under Chain data), and Seedelf Messaging’s messaging.<network> (the inbox) with a conversation.<network>.<id> for each conversation, a family Remove wallet finds by its prefix, messagingRequests.<network> (the crate’s requests, which strangers’ first messages make), messagingRead.<network> (where the next read goes on from, and the rest a read needs, at one fixed size), messagingOutbox.<network> (the user’s envelopes waiting to be posted, copied from their conversations’ records), messagingTake.<network> (the key’s envelopes the reads found that aren’t taken yet, and what of them wasn’t kept), messagingMark.<network> and messagingTakeMark.<network> (what a read’s scan and a take are working on while they run), beside messagingTrap.<network>, not sealed, which says only which of the two trapped, and messagingList.<network> (the relay’s certificate list as the wallet last read it, with the wallet’s own certificates and withdrawals waiting to be posted), beside messagingWithdraw.<network>, not sealed, which says only that withdrawals wait (Seedelf Messaging). See below.
chrome.storage.session seedelf.messaging.expiredAt, seedelf.messaging.paused, seedelf.messaging.readAfter, seedelf.messaging.posts, seedelf.messaging.listed Seedelf Messaging’s times and its posting runs, by network: whether the certificate list was read, and the wallet’s own certificates set right, in this unlock (chunk 55’s 55e); when its skipped keys and tombstones were last expired; whether the relay’s off switch has stopped that network, and when a page asks it again (once an hour; the worker keeps a copy in memory); until when its pages wait for the day’s reading (the 1.10.0 gate’s W15 and W16); and what the posting runs keep between them, for a worker Chrome starts again: the waits the relay asked for, on the device’s clock, the strikes of answers the wallet doesn’t know, and where the next run starts, each by the envelope’s stamp digest, never a conversation’s ID or record (the freeze’s fix D). A lock clears them, so an unlock asks again
chrome.storage.session seedelf.dapp.view.<network>, seedelf.dapp.signed.<network> The account as the dApp connector last read it (kept 30 s), and the account’s outputs of the last 32 transactions it signed or sent for sites, for chaining and for answering a site’s resubmit with its id (independent review M3, final review F12), per account (…:i for a session); only while unlocked
chrome.storage.session seedelf.moveIn.built, seedelf.mint.built, seedelf.transfer.built, seedelf.withdraw.built, seedelf.remove.built, seedelf.send.built, seedelf.collateral.built, seedelf.session.out, seedelf.session.site-out, seedelf.session.top-up, seedelf.session.mix-out, seedelf.session.tx, seedelf.session.back, seedelf.session.claim, seedelf.lovejoin.public Each flow’s transaction as its review built it, kept for Send and recording its network (a Seedelf spend’s with its one-time key’s seed); a payment or a funding in parts keeps each part after the first under <key>.<i>, the first naming them all (keepParts, partHashes), where the transaction view finds each (tx-view.ts); only while unlocked
chrome.storage.session seedelf.pendingTx.<network> The payment the pending watch follows, one per network (see Submits); only while unlocked, with a maybe-sent one sealed too (maybeSent.<network>)
chrome.storage.session seedelf.spent, seedelf.spent.sites, seedelf.sent.<network>, seedelf.reserved.<network> What the wallet’s own submits spent and when (for 2 hours, the newest 10,000), what sites’ submits spent (the newest 5,000), the transactions it sent there whole, for 2 hours, the newest 16 of its own Sends (each with the public account its review was built on) and, apart, the newest 16 a chain sent (sites are answered from those of the last 20 minutes), and what each chain being sent reserves (a payment’s parts still to go as parts.<first hash>); only while unlocked
chrome.storage.session seedelf.session.chain.<network>.<index>, seedelf.lovejoin.sending.<network> A Lovejoin chain being sent, a window at a time: a session’s return, or a mix from the public account; only while unlocked
chrome.storage.session seedelf.waiting.<network> Each payment whose parts wait for the one before to be in a block (parts.ts Waiting), by its first part’s hash: every part’s hash, the part each spends the carry of, how many went and when, when the next one’s parent first showed, the payment’s kind, what it is (SpendWhat), a session’s index for a funding, and, once the rest won’t go, why (refused, unseen, cancelled), kept up to an hour more for Home’s banner. Written before the parts that go at Send are sent, so a worker stopped meanwhile leaves them to the pump. Only while unlocked: a lock stops the rest, which the lock countdown and Remove wallet say first (gap-3#6, gap-1#1)
chrome.storage.session seedelf.waitingPart.<hash> Each part that waits, as Send kept it (its network, the unsigned transaction and its one-time key’s seed, and what the Seedelf history records once it’s sent), off Send’s keys so the next review can’t take it; gone once it goes or the rest stop. Only while unlocked
chrome.storage.session seedelf.koios.until When Koios’s limit lets the wallet ask again, after a 429, so a restarted worker honours it
chrome.storage.session seedelf.readFailed.<network> When the last balance reading on a network failed (balances.ts), so Home’s alert follows the worker’s last reading, across a trip to Settings or a reload, until one succeeds (blind test E05); its words stay in the worker’s memory alone. Only while unlocked
chrome.storage.session seedelf.balancesPrivateStale.<network>, seedelf.readingTooLarge.<network> That only the kept reading’s private side is behind (privacy review §2.9), and when a reading too large to keep was made; only while unlocked

UI

dApp connector

It serves the public account and private sessions. The records of its design are the archived plans for the public account and private sessions.

flowchart LR
  subgraph Tab["A site's page (top frame)"]
    P["cip30-page.js<br/>window.cardano.seedelf"] -- "postMessage" --> B["cip30-bridge.js<br/>(isolated world)"]
  end
  B -- "port seedelf.cip30<br/>(origin from Chrome)" --> D["dapp.ts"]
  D -- "approvals" --> W["The connector's window<br/>(?view=dapp)"]
  D -- "inspectDappTx, signDappTx,<br/>signDappData" --> X["WebAssembly (cip30.rs)"]
  D -- "reads, utxo_info, submittx" --> K["Koios"]

Private sessions

A private session funds a one-time account from the private balance, swaps there through Minswap’s aggregator, and brings the result back into the private balance. The swap runs itself after one approval. It’s reached from the dApp browser (screens/Dapps.tsx: Home’s dApps row, a grid of tiles, Minswap’s opening screens/Swaps.tsx). The flow is in flows.md.

flowchart LR
  UI["dApps → Minswap<br/>(Swaps.tsx)"] -- "sessions, swap-quote, session-out,<br/>session-advance/stop/resume" --> S["sessions.ts"]
  A["chrome.alarms<br/>seedelf.sessions, unlock"] -- "runAll" --> S
  S -- "estimate, build-tx" --> M["Minswap's aggregator"]
  S -- "credential_utxos, tx_status,<br/>utxo_info, datum_info, epoch_params,<br/>address_utxos, tx_info, submittx,<br/>account_addresses, account_txs" --> K["Koios"]
  S -- "buildWithdrawParts, buildWithdraw (out),<br/>readDexOrder, checkOrderCancels,<br/>buildOrderCancel,<br/>inspectSessionTx, signSessionTx,<br/>attachWitnesses, buildSessionReturn" --> X["WebAssembly"]

Lovejoin

Lovejoin is a mixer of fixed boxes (the classic pool’s 10 ₳, a token’s, or another amount of ADA). The wallet uses it on preprod and on mainnet, where a return goes through it too once its pool holds 30 boxes that aren’t the wallet’s (the pool floor; below it a return comes back directly and says why). That pool is v2’s, of 5 ₳ boxes; the classic pool and 8131b1d’s pools are retired, withdraw-only (Lovejoin v2, and the retired pools, below). It has had no third-party audit, only its makers’ own review, and the wallet says so where Lovejoin is chosen. The record of the protocol and its decisions is the archived plan, archive/plans/chunk-16-lovejoin.md.

Bootstrapping a pool (Bootstrap, which 1.5.0 called a seed). A mix takes two other people’s boxes for each of its own, and the wallet’s own boxes never count towards the floor, so an empty pool can’t be mixed into and no wallet could ever start one: the mainnet pool was empty at launch. So either side can Bootstrap, a chain of depth 0: the deposit alone, no mixes (publicBuild’s bootstrap, sessions.ts’ for the private side, check_deposit in the WebAssembly, fresh_for in seedelf-core). It needs no other boxes, and the floor doesn’t apply to it, because it draws nothing from the pool. It buys whoever puts it in nothing — the box goes back to the same owner and the chain shows it — so the review says that plainly, in a warning. Below the floor it leads the pool’s page, without waiting for a mix to be refused: lovejoin-status carries others and floor for that, both from the pool read the page already makes (ownership works out the other boxes anyway). It also says there that the wallet’s own boxes don’t count, so bootstrapping and mixing in one wallet never unblocks it. Its count is typed, not stepped: it makes no mixes, so it isn’t held to a mix chain’s MAX_MIX_BOXES but to the deposit’s own size (mostBootstrap: MAX_TOKEN_DEPOSIT_BOXES, 64, in every pool on v2’s scripts, an ADA pool’s too; MAX_DEPOSIT_BOXES, 96, was the classic pool’s, retired), and from the private balance to what one funding UTxO’s reserves pay a deposit and its sweep back for (privateBootstrapMost, WebAssembly’s lovejoinBootstrapMost, which builds both for each count: one deposit’s most, at a dearer byte too, fewer only where a deposit’s fee would pass MAX_FEE’s 10 ₳). It goes in from whichever side is chosen, as a mix does. From the public account it’s that one deposit, which spends no script and so puts up no collateral at all (Funding.collateral is None; only mix reads it, and a Bootstrap makes none). Into a token pool, from either side, the deposit reads the pool’s reference UTxO, still with no script and no collateral (1.6.0’s release review, 317-wallet#0). From the private balance it’s a one-time account funded by a Seedelf spend, which puts up giveme.my’s collateral as every Seedelf spend does, and deposits from there; the session records mix.bootstrap (a 1.5.0 session’s mix.seed still reads), so the chain it runs later is depth 0 too. Its funding pays no 5 ₳ collateral and no tail reserve, since a deposit alone runs no script: buildBack builds its chain without one (depositOnly), the WebAssembly’s ChainRequest.collateral and PlanRequest.collateral are optional (mixes_collateral refuses none only for a chain that mixes), and its return is a sweep, never merged, since a merge puts up a collateral. So its one payment carries the boxes, the deposit’s 1.5 ₳ reserve, and core’s bootstrap_back_reserve for that sweep, whose Seedelf output must hold its least after its fee: priced from the parameters the review read, never less than BOOTSTRAP_BACK_RESERVE (1.5 ₳, today’s), so a dearer byte raises the reserve rather than lowering the cap (1.8 ₳ at 6,465 lovelace a byte, where a fixed 1.5 ₳ would hold it to 68 classic boxes); read through lovejoinBootstrapReserve(params), which the form’s bounds carry too (privateBootstrapBounds), and added in mixFunding, never in funding_for, which 1.5.0’s record pins (tests/lovejoin-1-5-0.test.ts; 1.6.0’s release review, 318-rust#0: the deposit’s change alone can’t pay the sweep). The record carries mix.noCollateral, so its return puts up none whatever 5 ₳ is at its account (323-worker#4). A Bootstrap funded with a 5 ₳ collateral, as older versions funded one, keeps it, and its return puts it up and merges; one funded with neither (only dev builds between commits 62162483 and fc8561c7 made one) goes in with one box fewer, that box’s ADA paying the way back, and a one-box one comes back directly. The private side spends private UTxOs for a deposit that hides nothing, so the page says the public account is the cheaper side. A Bootstrap’s boxes are held: no due time, kept in the pool for its mix entry (bootstrapOf, by the entry’s deposit, which for a private one isn’t its chain’s last transaction; a watch that saw the deposit land keeps the hold, landedDeposit) until brought back by hand, one (Bring one back, which asks first) or all (Bring them all back, after which they come back by themselves, one a run). A box brought back by hand counts against the Bootstrap that held it (holderOf, kept on the withdraw as holder): the one whose deposit put it there, or, for one someone else’s mix moved, the oldest landed one missing a box at its deposit; squareUp credits Bootstraps first by what their deposits no longer list; bootstrapOf holds boxes no record accounts for in a Bootstrap’s place only once its deposit is known in; and no Bootstrap holds a box Bring every box back now counted back (holdable, counted) (1.6.0’s release review, 316#0, R3-5). In a retired pool nothing is held: the first run on 1.8.0 or later lets each Bootstrap there go (released, below). A restore can’t know the hold, so on a restored device the boxes others’ mixes moved come back by themselves. 1.5.0’s seeds are never held: a seed’s boxes get a due time at the first pool read and come back unmixed after the delay.

flowchart LR
  R["a session's return<br/>(sessions.ts)"] -- "chain" --> L["lovejoin.ts"]
  T["Lovejoin page<br/>(Lovejoin.tsx)"] -- "mix: private (a mix session),<br/>public, again, status, withdraw now" --> L
  A["unlock, seedelf.sessions alarm"] -- "withdrawDue" --> L
  L -- "credential_utxos (mix_box),<br/>account_info (mix_logic),<br/>ogmios (first mix), submittx,<br/>tx_status, utxo_info,<br/>tx_info (what made a box)" --> K["Koios"]
  L -- "giveme.my (withdraws)" --> G["giveme.my"]
  L -- "buildLovejoinChain, planLovejoin, lovejoinFunding,<br/>buildLovejoinFromAccount, buildLovejoinAgainFromAccount,<br/>lovejoinOwned, buildLovejoinWithdraw, finishLovejoinWithdraw,<br/>ogmiosUtxos, declaredCovers" --> X["WebAssembly"]

Seedelf Messaging

Messages between Seedelfs (chunk 54): the protocol is seedelf-messaging’s, specified in its protocol.md, and reaches the worker through WebAssembly’s stateless exports (wasm/README.md). The worker’s half is background/messaging.ts (54e); the screens are ui/screens/Messages.tsx and ui/messaging.ts (54f), whose flow is flows.md’s.

What we borrow from Lace

Paths are relative to a Lace checkout at e431933, its extension at 2.4.2 (see development.md). SecretBox was adapted from the lace-extension@2.4.0 tag, whose files are the same.

What Lace path How we use it
SecretBox (Argon2id + ChaCha20-Poly1305) packages/lib/core/src/secret-box/ Adopted in extension/src/background/secret-box/ (Apache-2.0, without the EMIP-003 path)
Typed RPC between extension contexts packages/lib/extension-messaging/src/ Adapt; it’s about 1.8k lines and needs RxJS
Service-worker boot order and install preloading apps/lace-extension/src/sw-script/ Pattern
Worker-owned store mirrored in the UI apps/lace-extension/src/util/connect-store.ts, apps/lace-extension/src/sw-script/create-remote-store.ts Pattern
Lock state machine and inactivity timer packages/contract/app-lock/src/store/ Pattern
Unlock back-off packages/contract/authentication-prompt/src/store/unlock-backoff.ts Pattern
MV3 manifest and CSP apps/lace-extension/assets/manifest.json Pattern
CIP-30 connector apps/lace-extension/src/content-scripts/, packages/lib/dapp-connector/, packages/module/dapp-connector-cardano/ Pattern: a page script and a bridge, the origin from Chrome, pings while a prompt waits, a popup window, the collateral rules, chaining. Not its manifest content scripts on every page: ours are registered only while the user has the connector on.
Keeping existing vkey witnesses intact packages/module/blockchain-cardano/src/tx-executor-implementation/merge-pre-existing-vkeys.ts Reference

We don’t take Lace’s contracts, modules or feature-flag framework, its host/guest shell, its analytics (PostHog, Sentry), or anything for Bitcoin or Midnight.

Licensing: Lace is Apache-2.0, and this repository is MIT. Files copied or adapted from Lace stay under Apache-2.0. For each one:

The store package carries every third-party notice in licenses/THIRD-PARTY.txt: SecretBox, the npm packages in the bundle, and the Rust crates in the WebAssembly. extension/scripts/third-party.mjs writes it when npm run package runs. Inter’s and Lucide’s licences sit next to it.