The WebAssembly bindings the web wallet’s worker uses for Seedelf cryptography, and to build, read and sign its transactions. Every protocol rule is enforced in seedelf-crypto and every transaction is built by seedelf-core: this crate adapts them for JavaScript, reads the transactions others build (the dApp connector, the transaction view), and keeps every private key inside WebAssembly.
The arguments named …Json are JSON text (the extension passes JSON.stringify(request)), and so is every structure an export answers with but the Register and Proof objects: the extension parses it. Amounts are lovelace or token quantities as decimal strings, and tokens are [{ policyId, assetName, quantity }], hex.
| Export | What it does |
|---|---|
SeedelfKey |
Holds the secret scalar inside WebAssembly memory. |
SeedelfKey.fromPhrase(phrase, account) |
The wallet’s key from a 12-, 15- or 24-word phrase, using the frozen v1 derivation (seedelf-crypto::derivation). The wallet always uses account 0: one private balance for the whole phrase. Throws with a reason on an invalid phrase. |
SeedelfKey.fromEntropy(entropy, account) |
The same key from the phrase’s BIP39 entropy, as the vault stores it. The key comes straight from the entropy: the phrase isn’t written out, in WebAssembly or in JavaScript. |
SeedelfKey.random(), SeedelfKey.fromHex() |
Dev/test constructors only. |
key.baseRegister() |
Returns the base register (G1, G1^x). |
key.isOwned(register) |
Whether this key can spend a UTxO with this register. |
key.createProof(register, vkh) |
Returns a Proof, { z, gR }, a Schnorr proof bound to the one-time key hash vkh (28 bytes, hex). |
key.free() |
Overwrites the scalar where the object keeps it, in an allocation of its own (Wiped in src/lib.rs), then releases it. wasm-bindgen’s free() moves an object out of its cell before it’s dropped, so a key held in the cell itself was wiped as a copy and left in memory. A copy a call left on the module’s stack isn’t reached by free(): scrubStack() is for those. And a copy a later call built into the heap is reached by neither: after a lock’s free()s and scrub the worker replaces the whole instance and zeroes the old one’s memory (the extension’s wasm.ts renewWasm, with the glue’s reset function, which build.sh asks for). |
MessagingKey |
Seedelf Messaging’s own secret scalar x_m (chunk 55, protocol.md §21), held as SeedelfKey holds x, in an allocation of its own that its free() overwrites. It’s one network’s, named when it’s made and kept. It has none of the funds methods (no baseRegister, isOwned, createProof or one-time key), and every messaging* export that takes a key takes it and no other class, which wasm-bindgen checks before anything is read: x can’t be passed where x_m belongs. messagingCertificate alone takes both. |
MessagingKey.fromEntropy(entropy, account, network), MessagingKey.fromPhrase(phrase, account, network) |
The wallet’s messaging key for network, "preprod" or "mainnet", from the vault’s BIP39 entropy or from the phrase, at generation 0 (seedelf-crypto::derivation::messaging_key_v1, its vectors seedelf_messaging_key_v1.json): HKDF-SHA-256 of v1’s seed under its own salt and info, so it says nothing of x, and each network’s key is another. Any other network throws, a missing one included: none falls back to preprod. |
MessagingKey.random(network), MessagingKey.fromHex(hex, network) |
Dev/test constructors only. |
messagingKey.network |
The network the key is for, preprod or mainnet. Every export whose request names a network (messagingReceive, messagingStart, messagingReveal, messagingCertificate, messagingValue) throws for the other, so one network’s key never reads, writes or proves on the other’s. |
scrubStack() |
Overwrites the top 512 KiB of the module’s stack, half of it, with zeros: the copies earlier calls left there of the keys they worked with and of what the keys came from, which no free() reaches. The worker calls it after a lock’s free()s, and after each derivation of keys (an unlock’s, a second account’s): the next call that builds something can copy stale stack bytes into the heap, where no scrub reaches. Takes nothing and returns nothing. |
generatePhrase() |
A new 24-word recovery phrase from the secure random source. |
validatePhrase(phrase) |
Accepts 12, 15 or 24 words, the lengths Lace accepts. Throws with a user-facing reason (word count, unknown word N, checksum). Case and extra whitespace are ignored. |
phraseToEntropy(phrase), entropyToPhrase(entropy) |
Phrase ↔ BIP39 entropy (16, 20 or 32 bytes), with the same rules as validatePhrase. The vault stores entropy, not words. These, validatePhrase and the fromPhrase and fromEntropy constructors wipe WebAssembly’s copies of what they’re given and return. |
bip39Wordlist() |
The 2048 BIP39 English words, for autocomplete. |
CardanoAccount.fromPhrase(phrase, account) |
A public account: standard CIP-1852 keys (m/1852'/1815'/account'), the same as Lace, Eternl and Yoroi. The wallet’s public accounts are any CIP-1852 index but 24301', the one-time accounts’; the Seedelf key stays account 0’s. The private keys stay in WebAssembly memory; free() overwrites them where they lie, as key.free() does, and drops them. |
CardanoAccount.fromEntropy(entropy, account) |
The same account from vault entropy. |
account.receiveAddress(network, index), account.changeAddress(network, index) |
Base addresses 0/index and 1/index, delegated to the staking key 2/0. |
account.stakeAddress(network), account.accountPublicKey() |
The reward address, and the account xpub (hex). |
account.paymentKeyHash(role, index) |
The payment key hash at role/index (0 receive, 1 change), hex: the payment credential of every address made from that key, whatever its staking part. Koios is asked for the account’s UTxOs under these. |
account.stakePublicKey() |
The stake key 2/0’s Ed25519 public key, hex: what CIP-95’s getRegisteredPubStakeKeys and getUnregisteredPubStakeKeys give. |
account.drepOf() |
The account’s own DRep (CIP-105’s key 3/0): { id, hash, publicKey }, its CIP-129 ID (drep1…), key hash and public key, hex. The public key is what CIP-95’s getPubDRepKey gives. Never the private key. |
account.isOwnAddress(address, keys) |
Whether an address is the account’s own: under one of its payment keys, whatever its staking part (the first 20 of each chain, keys, optional, hex key hashes as the last balance reading found them, and up to 500 when it carries the account’s stake key). The stake key alone isn’t enough: anyone can pair their own payment key with it. An unreadable address isn’t. |
account.carriesStakeKey(address) |
Whether an address’s staking part is the account’s stake key, whoever’s payment key it’s under: isOwnAddress tells the account’s own from someone else’s. An unreadable address doesn’t. |
Network.Preprod, Network.Mainnet |
The network for addresses. |
OneTimeAccounts.fromPhrase(phrase), OneTimeAccounts.fromEntropy(entropy) |
Private sessions’ one-time accounts: CIP-1852 account 24301', session i with its own payment key 0/i and stake key 2/i. A separate type from CardanoAccount, so nothing that pays or shows the public account can be handed these keys. They never leave WebAssembly; free() overwrites them where they lie, as key.free() does, and drops them. |
accounts.address(network, i), accounts.rewardAddress(network, i), accounts.keyHash(i) |
Session i’s address (its own payment and stake keys), its reward address (stake key 2/i, which the wallet never registers; a site connected to the session is given it), and its payment key hash, hex, which Koios is asked for its UTxOs under. |
accounts.sharedStakeAddress(network, i) |
Session i’s address with the shared Seedelf staking part, as sessions had it before each had its own stake key: kept for what’s still at those. |
Register |
{ generator, publicValue }: compressed G1 points in hex. new Register(generator, publicValue) wraps two points and checks nothing; see isValidRegister. |
rerandomize(register) |
Returns (g^d, u^d) with a fresh d that is thrown away. |
isValidRegister(register) |
On-curve and torsion-free check. |
registerToDatum(register) |
Inline-datum bytes (PlutusData CBOR). |
verifyProof(register, z, gR, vkh) |
Off-chain mirror of the validator’s check. |
buildMoveIn(account, key, requestJson) |
Builds and signs a move-in with seedelf-core’s build::move_in. The request carries network, Koios’s epoch_params row (params), the account’s UTxOs (utxos), each { utxo, role, index } with its role/index checked against the derived address, lovelace and tokens. Returns { txCbor, txHash, fee, lovelace, minimum, tokens, depositOutputs, withdrawal, changeLovelace, changeTokens, inputs, leftOut }. lovelace below what the deposit needs is raised to it (so "0" with tokens moves only that), and minimum says what that is; null is Max, with no minimum, and leftOut lists the UTxOs Max leaves where they are, and why. Keys never reach JavaScript. |
buildAccountSend(account, requestJson) |
Builds and signs a payment from the Cardano account with build::account_send_many. The request is a move-in’s with payments in place of lovelace and tokens: one to 100, each { to, recipient, lovelace, tokens }, where to is a bech32 address on this network (checkPayableAddress) or a Seedelf’s full name, and recipient, for a Seedelf, the contract UTxO holding it, as Koios returns it. Each amount is raised to its minimum as a move-in’s is; null is Max, for a single recipient only. An optional note is CIP-20’s message, which anyone can read: one line, 500 characters at most, written as lines of at most 64 bytes. Returns { txCbor, txHash, payments: [{ to, lovelace, minimum, tokens }], max, fee, withdrawal, note, changeLovelace, changeTokens, inputs, leftOut }. |
withdrawal in a move-in’s, a send’s or an account mint’s request |
Optional: the stake key’s whole reward balance (lovelace, a decimal string), withdrawn along with the payment, with the stake key 2/0 signing too. The extension passes it only when the user spends rewards and the vote is delegated. The result’s withdrawal says what was withdrawn ("0" for none). |
invalidHereafter in a move-in’s, a send’s, a staking transaction’s or an account mint’s request |
Optional: the slot the transaction stops being valid at (slotAt). Past it, one that never landed can’t land any more, so paying again can’t pay twice. An account mint’s draft holds it too, so its finish must be given the same slot. Without it, the transaction has no such slot: it stays valid for as long as its inputs are unspent. |
slotAt(network, unixMs) |
The slot a time (milliseconds since 1970, as Date.now() gives) falls in on a network, from its Shelley start: what invalidHereafter is counted in. Throws for a time that isn’t one. |
buildStaking(account, requestJson) |
Builds and signs a staking transaction with build::account_staking. The request carries network, the epoch_params row, the account’s UTxOs (as for a move-in), action and state, the stake key’s standing from Koios’s account_info: { registered, deposit, rewards, drep }. action is { kind: "delegate", pool }, { kind: "vote", drep }, { kind: "withdraw" } or { kind: "stop" }; or, for the account’s own DRep, { kind: "drep-register", delegate, anchor } (with delegate, the account’s own vote goes to it too), { kind: "drep-update", anchor }, { kind: "drep-retire" } or { kind: "drep-vote", votes: [{ txHash, index, vote }] } (vote is yes, no or abstain), with drep, the DRep’s standing from Koios’s drep_info: { registered, deposit }. An anchor, optional, is { url, hash }. Signed with the spent UTxOs’ payment keys, and with the stake key and the DRep key 3/0 where its certificates or votes need them. Returns { txCbor, txHash, action, pool, drep, fee, deposit, drepDeposit, refund, withdrawal, changeLovelace, changeTokens, inputs }, drepDeposit (the DRep’s part of deposit) for a DRep action only. |
poolId(id), drepId(id) |
A pool ID (bech32 or hex) as pool1…; a vote delegation as Koios names it (a DRep’s CIP-129 ID, from CIP-129 or CIP-105, or drep_always_abstain / drep_always_no_confidence). Each throws the reason to show the user. |
drepProfile(requestJson) |
A DRep’s profile as CIP-119 metadata: { givenName, objectives, motivations, qualifications, doNotList } in (a name is required, 80 characters at most; each text at most 1,000), { file, hash } out: the file to publish exactly as it is, and its blake2b-256 hash, which the registration’s anchor carries. The wallet never publishes or fetches it. Throws the reason to show the user. |
buildMint(key, requestJson) |
Creating a Seedelf from the private balance (build::mint_apart), in one step. The request carries network, the epoch_params row, the wallet’s spendable contract UTxOs (each checked: owned, no Seedelf, no reference script), the label (printable ASCII, 15 at most) and classes. Picks the UTxOs, proves them under a new one-time key, measures the scripts with the wallet’s own evaluator (Aiken’s uplc) and finishes the transaction: no draft carrying proofs goes to Koios. Returns the unsigned transaction and { txCbor, txHash, seed, tokenName, lovelace, fee: { size, compute, scriptReference, total }, changeLovelace, changeTokens, changeOutputs, inputs, classesMixed }. |
draftAccountMint(account, key, requestJson) |
Creating a Seedelf paid by the Cardano account (build::account_mint), step 1. The request carries network, the epoch_params row, the account’s UTxOs (each with its role/index, checked as for a move-in), the label, and optionally collateral, the account’s collateral with its path: put up, never spent (without one, the mint puts up one of utxos). Picks the inputs and the collateral, and returns { draftCbor, inputs, collateral } for Ogmios. |
finishAccountMint(account, key, requestJson) |
Step 2: the same request plus Ogmios’s evaluation. Returns the transaction signed with every input’s key and the collateral’s, ready to submit, and { txCbor, txHash, tokenName, lovelace, fee, withdrawal, changeLovelace, changeTokens, changeOutputs, inputs, collateral }. |
buildTransfer(key, requestJson) |
Paying Seedelfs from the private balance (build::transfer_apart), in one step. The request carries network, the epoch_params row, the spendable contract UTxOs (checked as for a mint), classes, and payments: one to 100, each { to, recipient, lovelace, tokens }, where to is the Seedelf’s full name, recipient the contract UTxO holding it, as Koios returns it, and lovelace is raised to what the payment needs, if less. Checks each recipient’s UTxO and register, picks the UTxOs, proves them under a new one-time key, and measures and finishes it in the wallet, as buildMint does. Returns the unsigned transaction and { txCbor, txHash, seed, payments: [{ to, toSelf, lovelace, minimum, tokens }], fee, changeLovelace, changeTokens, changeOutputs, inputs, classesMixed }. toSelf says the Seedelf is this wallet’s own; paying it is allowed. |
buildWithdraw(key, requestJson) |
Paying addresses from the private balance (build::sweep_many_apart, or sweep_all for Max), in one step. The request carries network, the epoch_params row, the spendable contract UTxOs (checked as for a mint), classes, and payments: one to 100, each { to, lovelace, tokens }, to a bech32 address on this network (checkPayableAddress) and lovelace raised to what the payment needs, if less. null is Max, for a single address only: up to the 20 largest UTxOs, with every token. An optional funding ({ session }, the session’s own class for a top-up) marks a private session’s funding or top-up rather than a payment, which changes what is picked first. Measured and finished in the wallet. Returns the unsigned transaction and { txCbor, txHash, seed, payments: [{ to, lovelace, minimum, tokens }], max, fee, changeLovelace, changeTokens, changeOutputs, inputs, left, classesMixed }: what each address receives, what comes back, and how many UTxOs Max left. |
buildTransferParts(key, requestJson), buildWithdrawParts(key, requestJson) |
buildTransfer’s and buildWithdraw’s requests, in as many transactions as the UTxOs they spend need: { parts: [result] }, each part a buildTransfer or buildWithdraw result, one when one transaction takes it all. An amount to one recipient goes in parts, and so does a session’s funding (its first payment; the payments after it go in the first part). Max takes every UTxO: 25 transactions at most (MAX_PARTS), each spending 20 at most. Several recipients at once go in one transaction. A part with no ADA of its own to pay with spends what the part before carried forward, an output of ADA alone to the wallet’s own register: it’s built and measured before that output is on chain, and sent once it is, since giveme.my witnesses only what’s on chain. A carry no later part spends is its part’s change (changeLovelace, changeOutputs). The last part carries left, how many UTxOs Max left, and leftWhy, why: tokens (a token they hold wouldn’t fit with the rest), fee (too little ADA to pay for spending them, even carried forward) or limit (the payment went as 25 transactions); left is 0 and leftWhy absent when it left none, and on every other part. Max over no UTxOs throws one transaction’s words: There's nothing in the Seedelf balance to send (or to withdraw). |
buildRemove(key, requestJson) |
Removing a Seedelf (build::remove), in one step. The request carries network, the epoch_params row, the Seedelf’s utxo (checked: this wallet’s, holding exactly one Seedelf) and to (an address on this network, or null for the private balance). Measured and finished in the wallet. Returns the unsigned transaction and { txCbor, txHash, seed, name, to, lovelace, tokens, fee, inputs }, where lovelace is what comes back and tokens every other token the UTxO held, which comes back with it. |
classes in a Seedelf mint’s, transfer’s or withdrawal’s request |
Optional: each spendable UTxO’s history, by txHash#index: { id, origin }, where origin is own, received, session, change (an earlier spend’s change that names no public account, no session and no spend made elsewhere), lovejoin, mixed (a box’s way back alone, where the worker knows the box is mixed: its own chain’s last mix made it, or the server said a mix did) or unknown. Selection keeps different histories apart where it can (build::Histories), beside the UTxOs holding the tokens sent, which go first by the box rule (holding_by_rule): those that are no box and that the purpose takes before a mixed box (build::Histories::before_boxes: a payment’s every one, a funding’s own session’s and received money), the most first, then as few of unknown making as hold the rest, then as few boxes, the mixed first, then by how much each holds, then the purpose’s later money, and none the others make needless; the spend from those holding the most, whatever their history (holding), goes only where the rule’s is refused, does worse by the rule over all its boxes, or does as well and merges more histories. A payment’s parts by history take the rule’s holders for everything still owed first (token_group), each part’s by the rule (build::max_inputs_apart), before Worth where a chain does; by Worth alone, as before: a stealth mint takes a mixed box first, then received, lovejoin, unknown, change, own and session money, in that order; a funding, a top-up and a payment, of boxes that pay alone, a mixed one, then any other, then one of unknown making, before size. Merging, every purpose takes boxes last, a token pool’s way back with its token among them: one of unknown making (a part other than box:, such as an unplacedBox’s unknown:<tx>) only where none pays without one, even where that merges more, and then with as few others as pay; else as few as pay, the largest first; of as many, the most mixed ones that merge no more of the rest (build::box_rank). With at most 12 boxes (build::EXACT_BOXES), over every set of them in one transaction, each costed by what it pays together, its boxes in a’s weighed order, its tokens’ least shared as its change shares it. With more, of the choices it tries, each weighed by what it pays (build::box_weight: in one transaction, Weighed::InOne, beside the change its order makes anyway, which keeps the holders’ tokens and, where all the other money goes first, that money’s (build::Kept), and beside a change of ADA alone too, for fewer boxes before more than one where all the other money goes first, and past what one transaction spends; in parts, at any count, Weighed::InParts, its ADA less its tokens’ least). Each box is weighed by itself there, so it can be off by its token’s share of the change’s least, about 0.2 ₳ where the token joins an output with room (a little more for a long token name) and up to an output’s whole least, about 1.6 ₳, where the change’s last output is full, or in parts where boxes’ tokens share one; within that a merge can take more boxes than pay, or fewer mixed, and where it takes one of unknown making, more of them than pay; and near the most one transaction spends, or in parts, beside token boxes, one of unknown making where a choice it doesn’t try pays without one (two ways back of one pool, say, or a token that shares an output of change or opens one). Past what one transaction spends, a funding still takes another session’s money before a box where that pays; where none of the rule’s choices builds, selection falls back to the orders it took without the rule, so nothing those sent as one transaction is refused or split into parts; and before its first merge that takes one of unknown making, it tries those orders without any. The result’s classesMixed names the ones it spends together, when it has to. |
checkPayableAddress(address, network) |
Throws the reason a withdrawal or a send can’t pay an address: not an address, a Byron address (Seedelf Wallet can't pay a Byron address), a stake address, the other network. Any other address on the network passes, a script’s too, as the ledger takes it: its payment carries no datum, which the extension warns of. |
signScriptSpend(key, requestJson) |
At Send: { txCbor, seed, collateral }, where collateral is giveme.my’s answer. Refuses a transaction that wasn’t built with that seed’s one-time key, checks giveme.my’s signature against its public key over the transaction id, then adds it and the one-time key’s. Returns { txCbor, txHash }. |
buildSessionReturn(accounts, key, requestJson) |
A private session’s return: everything at session index’s one-time account into the private balance, built and signed with its key. The request: { network, params, index, utxos, merge, own, collateralPool, collateralBoxes, rewards }, utxos every UTxO at the account, merge (optional) the funding’s Seedelf change to merge into, own (optional) the session’s own transactions by hash, whose outputs come back first, and collateralPool (optional, a poolRef) the 5 ₳ Lovejoin pool the session’s 5 ₳ collateral is mixed into on its way back, rather than coming back with the rest, with collateralBoxes, its rows at mix_box. rewards (optional) is what sits in each pool’s mix_logic reward account, { <mixLogicHash>: <lovelace> }, as account_info reads it: the collateral’s mix takes that pool’s into its change, which this return brings back. Returns { txCbor, txHash, fee, lovelace, tokens, depositOutputs, inputs, merged, leftOut, tail }, leftOut being what waits for a later return. tail, there only when collateralPool was asked and the session’s own ADA pays for it, is the collateral’s mix: { txs, box, leaf, fee }, txs its deposit then its mix, as a chain’s (each marked tail, the mix giveme: giveme.my signs it once the deposit is on chain), both sent before this return, which sweeps what they leave; box the collateral’s box, leaf the box the mix made of it, and fee what both cost. fee and lovelace are then this return’s alone, lovelace without the collateral’s 5 ₳. Where the tail can’t be built, the collateral comes back with the rest. |
readDexOrder(requestJson) |
Whether an output at a contract is a DEX order the wallet can cancel itself, and the session’s own (seedelf_core::orders over the pinned orders.json): what the order check (checkOrder), a cancel’s signer and the look for what a Splash order’s partial fill left ask. { network, address, datum, session, inline, scriptRef } in: the output’s address bytes and its datum’s CBOR (inline, or the bytes its hash names), hex; the session’s bech32 address, a base address of its own payment and stake keys on this network (anything else throws); and, optional (false when left out), whether the output holds its datum inline and whether it carries a script. { known, protocol, ours, stakeSigns, reference, why } out. known: it sits at an order script orders.json pins on this network (otherwise the rest is empty). ours: cancelled by the session’s own key (its stake key’s for SundaeSwap V3, V4 and Stableswaps), paying the session alone, and in a form its script can spend: never one carrying a script, nor a Plutus V1 order holding its datum inline. stakeSigns: its cancel needs the stake key 2/i too. reference: the hash#index its script is read from, when by reference. why: why it can never be cancelled, or why its datum couldn’t be read (one nested past 128 levels isn’t decoded at all). Takes no keys. |
buildOrderCancel(requestJson) |
Stop’s cancel of a session’s DEX orders, built in the wallet (seedelf_core::orders::cancel_orders), never asked of Minswap. { network, params, session, orders: [{ utxo, datum }], funds, collateral, references } in: each order a Koios UTxO row with its datum’s CBOR, hex; funds, the session’s own UTxOs that help pay the fee (none with a datum or a script), its collateral among them or not; collateral, one of its UTxOs of ADA alone; references, Koios’s rows for the reference UTxOs the orders’ scripts are read from, spent or not (a spent one’s script, checked against its pinned hash, is carried in the transaction instead). A fund or collateral not at the session’s payment key is refused, and so is an order that isn’t the session’s at a pinned script, or in a form its script can’t spend. It cancels the first order and those of its Plutus version that can share its transaction (a Splash order goes alone, its exact refund first), everything going back to the session’s address. The fee comes from the orders’ ADA and the funds, and from the collateral only when they can’t pay it and a change output; a collateral spent so leaves an output of exactly 5 ADA behind where what’s left allows. The collateral covers 1.5 times the fee and must leave the least an output holds. Measured in the wallet with the V1, V2 and V3 cost models, its script data hash recomputed from its own witness bytes; an order script that refuses it is named, with its order. Returns it unsigned: { txCbor, txHash, fee, covers, stakeSigns }, covers the orders it cancels (hash#index; the next cancel takes the rest), stakeSigns that the session’s stake key signs too (signSessionTx). |
checkOrderCancels(requestJson) |
Before a session signs a swap, the dry run of Stop’s cancel of each order it places (seedelf_core::orders::check_cancels): each order alone, built as buildOrderCancel builds it once the swap is on chain, with stand-in funds and collateral of ADA alone at the session’s address, and run through the order’s real script in the wallet’s evaluator. { network, params, session, txCbor, orders, references } in: the swap as built (neither signed nor on chain), hex; orders, its order outputs’ indexes (the order check’s); references, as buildOrderCancel takes them (a Plutus V1 order needs none). { orders: [{ index, order, protocol, cancels, fee, why }] } out, one for each index asked, in order: order its hash#index once the swap is on chain; protocol the DEX whose script it sits at (null when it’s none the wallet knows); cancels whether its cancel built and its script ran it; fee that cancel’s fee (null when it didn’t build); why why it can’t be cancelled (null when it can): a datum its script can’t decode, its datum inline at a Plutus V1 script, a script on it, an output that isn’t an order, a reference row missing. A swap that can’t be read, or a session address that isn’t one, throws. Takes no keys. The worker’s inspect calls it for every swap that places orders (cancelsChecked), the runner’s and Review it myself’s alike. |
inspectSessionTx(accounts, requestJson), signSessionTx(accounts, requestJson) |
inspectDappTx and signDappTx for a transaction built for a session (a swap, a cancel), on its one-time account: keys is the session’s one path 0/i, and stakeIndex is i. Never governance. |
sessionDataSigner(accounts, requestJson), signSessionData(accounts, requestJson) |
dataSigner and signDappData for a site connected to a session (private CIP-30), with keys and stakeIndex as above. |
attachWitnesses(txCbor, witnessSet) |
A transaction someone else built (a session’s swap) with the wallet’s signatures (witnessSet, as signSessionTx gives them) added, ready to submit. The body and the builder’s witnesses are kept byte for byte. |
poolRef and width in a Lovejoin request |
poolRef names the token pool a request’s rows are of: { reference, seed, scripts }, its reference UTxO at Lovejoin’s holder (the NFT and the datum), the seed its launch spent ({ txHash, txIndex }), and rows at the holder that may carry its scripts. It’s trusted only once its scripts are derived from its seed and the bundled templates and match its datum, which is checked on every call. It’s optional wherever a request below reads a pool’s rows, and without it that’s the classic pool. width, optional in planLovejoin, lovejoinFunding, buildLovejoinChain and the public account’s two chains: how many boxes a mix takes, 3 or 4 (3 when absent). |
planLovejoin(accounts, requestJson) |
Lovejoin: how many boxes a session’s spare ADA pays for, before anything is built. { network, index, utxos, collateral, depth, again, collateralReserve, own } in, { boxes, spare, mixes, mixFees, legs } out. collateral is absent for a Bootstrap’s session (depth 0), which has none; collateralReserve, that the session was funded for its collateral’s mix (lovejoinCollateralReserve()), so its boxes are counted on what’s left after it; own, the session’s own transactions, whose UTxOs holding a token pool’s token pay for its boxes. A return across pools names them in legs, with fills and params, as buildLovejoinChain does (a plan reads no rows), and the answer’s legs gives each one’s boxes, in order. |
lovejoinFunding(requestJson) |
What mixing boxes boxes at depth takes, before anything is built: { network, boxes, depth, again } in, { lovelace, mixes, mixFees, token } out. lovelace pays for the boxes and their chain: a one-time account is funded with it, beside its collateral when it mixes, and beside lovejoinBootstrapReserve(paramsJson) for a Bootstrap from the private balance, or a collateral reserve where its collateral is mixed. token, a token pool’s: how much of its token the boxes take. A pool whose box ADA would make a sum pass what a u64 holds throws These boxes cost more ADA than there is. |
lovejoinCollateralReserve(), lovejoinDirectCollateralReserve(paramsJson) |
What a session is funded with besides, for its 5 ₳ collateral to be mixed on its way into a 5 ₳ pool, in lovelace, as a string. lovejoinCollateralReserve (1.5 ₳, core’s COLLATERAL_TAIL_RESERVE) is a mix’s or a swap’s, where something else pays for the sweep after it: the chain’s change, or the swap’s margin and fill. lovejoinDirectCollateralReserve is for a session whose return may come back directly with nothing else to pay (a site’s session, and a top-up that pays a new collateral), priced from paramsJson, one row of Koios’s epoch_params (core’s direct_tail_reserve: 2.8 ₳ at 4,310 lovelace a byte). Parameters it can’t read are refused. |
lovejoinBootstrapReserve(paramsJson) |
What a Bootstrap’s session paid from the private balance is funded with besides lovejoinFunding’s lovelace, for its way back, priced from one epoch_params row, in lovelace, as a string (core’s bootstrap_back_reserve: never less than 1.5 ₳, BOOTSTRAP_BACK_RESERVE, which today’s parameters ask; 1.8 ₳ at 6,465 lovelace a byte). With no collateral, its return is a sweep of the deposit’s change, whose Seedelf output must hold its least. |
lovejoinBootstrapMost(requestJson) |
The most boxes a Bootstrap paid from the private balance puts in at once: { network, params, most } in, most the most one deposit makes in the pool; a number out, 0 when not one fits. Each count’s deposit and its sweep back are built under params (core’s bootstrap_most), never estimated. |
buildLovejoinChain(accounts, key, requestJson) |
A session’s whole chain through Lovejoin, each transaction built, measured against the scripts and signed with its key: the deposit, the mixes, then the return; with again, the wallet’s boxes in the pool mixed again, with no deposit. The request: { network, params, index, utxos, collateral, pool, depth, boxes, merge, again, own, collateralPool, collateralBoxes, collateralReserve, rewards }, pool the boxes at mix_box. rewards (optional) is what sits in each pool’s mix_logic reward account, { <mixLogicHash>: <lovelace> }, as account_info reads it: the first mix in each pool, the collateral’s included, takes that pool’s whole into its change, every mix after it there withdraws 0, and returned counts it. collateral is absent only for a Bootstrap’s (depth 0), whose deposit runs no script: its return is then a sweep, never merged. collateralPool and collateralBoxes (optional) are the 5 ₳ pool the session’s collateral is mixed into on its way back, and its rows at mix_box; collateralReserve, that the session was funded for that mix, so its boxes are counted on what’s left after it. A return across pools names them in legs, [{ poolRef, pool, most }], the token pools first, each with its rows and the most boxes it has room for; fills, transactions beside the session’s own whose UTxOs holding a leg’s token its deposit may spend (a swap’s fill); and params. It puts one deposit into each pool, and mixes in each. Returns { txs: [{ kind, txCbor, txHash, fee, tail, giveme }], boxes, depth, fees, returned, tokens, merged, leaves, leftOut, skipped, legs, collateralTail }, txs in the order the worker sends them. A pool with too few boxes builds nothing and says why in skipped. Across pools, legs gives each leg’s boxes, in order, its leaves as many and in that order among leaves. collateralTail, { box, leaf, fee } as a return’s tail, is there when collateralPool was asked and what the chain left pays for it: its deposit and its mix (each marked tail; the mix giveme, which giveme.my signs once every transaction before it is on chain) go before the return, fees counts them, and returned leaves the collateral’s 5 ₳ out. A deposit into a token pool reads the pool’s reference UTxO, so the ledger refuses one into a pool that isn’t on chain. |
buildCollateralMix(accounts, key, requestJson) |
A session’s collateral’s mix built again once its deposit is on chain, with two boxes drawn fresh, and the return after it: a box it drew was spent by the time giveme.my was asked, or a lock wiped the chain’s progress before the mix went. { network, params, index, utxos, box, poolRef, pool, own, rewards } in, rewards as buildLovejoinChain’s: box the collateral’s box, which the deposit made, the wallet’s own in that pool; poolRef the 5 ₳ pool, and pool its rows at mix_box, less any a sent transaction of ours spends. The session’s largest UTxO of ADA alone (the deposit’s change) pays the mix’s fee, under giveme.my’s collateral. Returns a chain as buildLovejoinChain does: the mix (tail, giveme), then the return, a sweep of what’s left, with collateralTail. |
buildLovejoinFromAccount(account, key, requestJson), buildLovejoinAgainFromAccount(account, key, requestJson) |
Boxes from the public account straight into Lovejoin, the deposit and every mix; or the wallet’s boxes in the pool mixed again, paid by the public account, with no deposit. Built, measured and signed with the account’s keys. The request: { network, params, utxos, collateral, pool, depth, boxes, rewards }, utxos and collateral with their paths, as for a move-in, and rewards as buildLovejoinChain’s. Returns a chain as buildLovejoinChain does, with no return: returned is the change that stays in the account. Mixing again, one UTxO of ADA alone, the account’s largest, pays every mix: boxes of them go, or as many as it pays for where that’s fewer (the result’s boxes), and it’s refused only where it pays for none. |
lovejoinOwned(key, requestJson) |
The wallet’s boxes among the pool’s rows: { network, pool } in, { boxes, lovelace, others, otherBoxes, token } out, others being how many boxes a mix may take, and token a token pool’s, all the wallet’s boxes together. |
buildLovejoinWithdraw(key, requestJson), finishLovejoinWithdraw(requestJson) |
One of the wallet’s boxes into a fresh register: { network, params, pool, boxRef, rewards } (the first of the wallet’s boxes when boxRef is absent; rewards as buildLovejoinChain’s, which the register takes, as it does for the next two) in, the unsigned transaction and { txCbor, txHash, fee, lovelace, boxRef, token } out (token a token pool’s, into the same register), for giveme.my. finishLovejoinWithdraw then takes { txCbor, collateral }, collateral being giveme.my’s answer, checks its signature against giveme.my’s key, adds it, and returns { txCbor, txHash }, ready to submit. |
buildLovejoinWithdrawPaid(account, key, requestJson) |
One of the wallet’s boxes into a fresh register with the public account paying its fee, for a box that can’t pay its own way back (the escape hatch): { network, params, pool, boxRef, utxos, collateral, poolRef, rewards } in, utxos and collateral with their paths, as for a move-in; the largest of ADA alone pays, and the collateral is the account’s own, so no giveme.my. Built, measured and signed with the account’s keys: { txCbor, txHash, fee, lovelace, paid, boxRef, token } out, paid being what the account pays, the fee and what it made up. |
buildLovejoinWithdrawPrivate(key, requestJson) |
The same with a UTxO of the private balance paying (the default): { network, params, pool, boxRef, utxos, poolRef, rewards } in, utxos the private balance’s rows in the order to try them. The first of ADA alone that’s the wallet’s, that the wallet can evaluate, and that’s large enough pays; the rest are passed over. Measured in the wallet and unsigned, as any Seedelf spend: { txCbor, txHash, seed, fee, lovelace, spent, spentLovelace, boxRef, token } out, spent being the UTxO that paid (txHash#index), for giveme.my and then signScriptSpend. When none pays it throws Your private balance holds no UTxO of ADA alone that pays for this box's way back. |
lovejoinCandidate(requestJson) |
A row at Lovejoin’s holder, its cheap offline checks alone (its shape and its datum, and that it isn’t a 10 ₳ ADA pool), before anything proves it: { network, reference } in, { id, boxLovelace, token, mixBoxHash, mixLogicHash } out, id being its NFT’s policy, the pool’s id if it’s genuine. Throws why it isn’t a candidate. |
lovejoinLaunchCheck(requestJson) |
A candidate checked against the transaction that made it: { network, reference, inputs, scripts } in, the candidate’s row, what that transaction spent ([{ txHash, txIndex }]) and its outputs at the holder. Its seed is found among the inputs, its scripts derived and matched, and those at the holder read by reference. { pool, mixLogicStake } out: pool as lovejoinVerifyPool gives it, and mixLogicStake the reward account a standard launch registers. Throws why it isn’t a genuine pool. |
lovejoinVerifyPool(requestJson) |
A token pool the worker found, verified from the bundled templates: { network, pool } in, pool a poolRef. { id, version, boxLovelace, token, maxFee, mixBoxHash, mixLogicHash, feeHash, scriptsInline, seed, reference } out, version being classic or tokenV1. A script is read by reference only from a row at the holder that carries the script it derived, as Plutus V3, under no datum or one the wallet can read (nested within 128 levels); scriptsInline counts the scripts every transaction carries for want of one, about 0.12 ₳ a transaction more. Throws why it isn’t a pool the wallet reads. |
lovejoinMixLogic(requestJson) |
A pool’s mix_logic and the reward account it runs through, whose balance every mix and withdraw there takes: { network, poolRef } in, poolRef optional (the classic pool without it), { hash, stake } out, stake bech32. |
lovejoinUsable(requestJson) |
Whether a pool takes a new mix under today’s parameters: { network, params, poolRef, registered, backOnly, alone } in, registered being whether its mix_logic credential is (one account_info for every pool); with backOnly, only whether a box already there pays its own way back, the escape hatch’s question. { usable, why, has, needs, detail, boxMinimum, withdrawFee, back, alone } out: why is notRegistered, belowMinimum, cantComeBack or unchecked, with what a box holds and what the ledger asks where that’s why; back is what a box brings back into the private balance, its token aside. With alone, where a box comes back, alone says whether it then pays out part of itself on its own (S0d’s steps, built at the pool’s box value): false under S0d’s least, which the screens say wherever the pool is offered. A pool that can’t is still read: its boxes stay in view, and still come back. |
lovejoinBoxValue(requestJson) |
What a box of a pool the wallet launches may hold under the live parameters: { network, params, token } in (no token for an ADA pool), { least, minimum, suggested, most } out: the least at which a box comes back paying part of itself, measured by building its ways back, which a start’s review says it’s under; the network’s minimum for such a box, the only value a start is refused under, since no mix could make the box; the launch form’s suggestion, the least with a margin rounded up to 0.5 ₳; and, for a token pool, the most a box holds (9 ₳). |
buildLovejoinLaunch(key, requestJson) |
Starting a Lovejoin pool from the private balance (lovejoin::launch_apart), in one step. The request: { network, params, utxos, classes, token, boxLovelace, maxFee, register }, utxos the spendable contract UTxOs (checked as for a mint; only those of ADA alone pay), token the token every box holds and how much (none for an ADA pool, at any amount but the classic pool’s 10 ₳), maxFee the most a fee shard pays a mix, and register whether mix_logic’s credential is still to register. Measured and finished in the wallet, and the pool it makes is read back from its own bytes and verified as a stranger’s would be. Returns it unsigned, for giveme.my and signScriptSpend: { txCbor, txHash, seed, pool, locked, fee, changeLovelace, inputs, classesMixed, mixLogicStake, cantComeBack }, pool as lovejoinVerifyPool gives it, locked what it locks for good, { reference, mixBox, mixLogic, deposit, total }, and cantComeBack, where a box of the pool can’t pay its own way back, { has, needs }: said on the review, never refused. |
buildLovejoinLaunchFromAccount(account, requestJson) |
The same, paid by the public account (lovejoin::launch_from_account): { network, params, utxos, collateral, token, boxLovelace, maxFee, register, invalidHereafter } in, utxos and collateral with their paths, as for an account-paid mint (the collateral put up, never spent; without one, the launch puts up one of utxos). It never spends a UTxO carrying a reference script, or a datum the wallet can’t read. Measured in the wallet and signed with every input’s key and the collateral’s: { txCbor, txHash, pool, locked, fee, changeLovelace, changeTokens, inputs, collateral, mixLogicStake, cantComeBack } out. |
ogmiosUtxos(txCbor) |
A transaction’s outputs as Ogmios v6 UTxOs (JSON), for evaluateTransaction’s additionalUtxo: the network can then measure a child of it before it’s on chain. |
declaredCovers(txCbor, answerJson) |
Whether the budgets a transaction declares cover what Ogmios measured (answerJson, its evaluateTransaction answer): { covers, reason }, the reason when they don’t, a failed script included. The extension checks a Lovejoin chain’s first mix with it. |
cip30Utxos(rowsJson) |
The dApp connector (src/cip30.rs): Koios UTxO rows as CIP-30’s TransactionUnspentOutputs, hex each. The output is the legacy array unless it holds an inline datum or a reference script, which only the map form carries. A row whose reference script can’t be written whole is left out, as the worker leaves it out of getBalance (chunk 51, w2#4). |
cip30Value(lovelace, tokensJson), cip30ReadValue(hex) |
A balance as CIP-30’s Value (canonical order), and a Value a dApp asks for read back as { lovelace, tokens }, refused past 1,000 policies and tokens together. |
cip30Address(bech32) |
An address as CIP-30 hands it over: its bytes, hex. |
inspectDappTx(account, requestJson) |
What a dApp’s transaction does to the public account, for the signing prompt. The request: { network, txCbor, keys: [{ role, index }], inputs, partialSign, stakeDeposit, governance }, where inputs are the UTxOs it spends as far as the extension found them (Koios rows), stakeDeposit (optional) is what the stake key paid to register (Koios’s account_info.deposit), which an old deregistration certificate doesn’t say it returns, and governance says the site was given CIP-95, so the DRep key 3/0 signs its DRep certificates and votes. Returns the net change, who’s paid, the fee, the collateral at risk, minting, certificates (each with the stake key it names, credential, the account’s own or anyone’s: a registration’s, a stop’s or a delegation’s, alone or together, and a stake pool’s registration’s reward account’s; none for a script’s, a pool’s retirement, a DRep’s or the committee’s; 1.5.0’s cross-area review, X05, and 1.5.0’s last review, L1), withdrawals, votes (and how many are the account’s DRep’s), proposals (each one’s kind, its deposit and the reward account it goes back to, and a treasury withdrawal’s recipients, each stake key named as a certificate’s is), paidScripts (the scripts whose reward accounts it pays into, by hash, each once: a stake pool registration’s, a proposal’s deposit return and a treasury withdrawal’s payee, for the extension’s Lovejoin refusal), the contract UTxOs it spends as far as they were found, whoever’s (contractInputs, holding contractLovelace and contractTokens), what of that doesn’t reach the account (releasedLovelace, releasedTokens), whether one of the account’s keys is what a contract there can ask for (keyReleases) and whether a contract UTxO’s datum names one (namesKey), for the window’s release warning (architecture.md), a CIP-20 note and whether the metadata is what the body’s hash commits to (metadataMismatch, left out when it is), each payment’s output (txIndex) and, under a register only its key’s holder can spend, that register’s points (register), read from the bytes signed for the window’s checks (chunk 51, sign#1), which keys sign, unknown inputs, and whether the account’s signatures complete it. Throws for the other network, a collateral return to someone else, a transaction marked to fail, one that makes the stake key a pool’s owner, an old deregistration without stakeDeposit, a payment key’s or the DRep key’s signature over an input it can’t find, any signature over a transaction nothing ties to its network, or one over 64 KiB, nested past 128 levels, or with bytes after its end. |
signDappTx(account, requestJson) |
The same request, signed with every key of the account’s it needs: { witnessSet, summary }, the vkey witnesses only, in the transaction’s set encoding. Refuses without partialSign when anyone else must sign too. |
dataSigner(account, requestJson), signDappData(account, requestJson) |
CIP-8 for CIP-30’s signData: { network, keys, address, payload, governance } (the address in hex or bech32; with governance, it may name the account’s DRep, by its ID or its key’s enterprise address). dataSigner says which key signs, { address, key, role, index } with key payment (then its role and index), stake or drep, or null for an address that isn’t the account’s; signDappData returns { signature, key }, a COSE_Sign1 with the address in its protected header and the COSE_Key, hex. |
decodeTx(network, txCbor) |
Everything in a transaction’s bytes, as JSON, for the transaction view (src/decode.rs): inputs, outputs, datums, scripts, certificates, votes, redeemers and metadata. It reads no account and asks nothing of the network; network only names Seedelf Wallet’s own contract. Every amount, slot and budget is a decimal string. Throws in words for bytes it can’t read. |
messagingScan(key, envelopesJson) |
Seedelf Messaging (below): which envelopes of a batch are the key’s. A JSON array of hex envelopes in; out, a string (not JSON) of one digit an envelope, in order, 1 where it’s the key’s and 0 where it isn’t, as long as the batch whatever matched, each digit written the same way for a match and a miss, so the answer’s size and making say nothing of which matched. One that isn’t a v1 envelope with a valid p (its tag of w is any 32 bytes) isn’t a match. The worker scans a relay page 200 at a time, as it checks contract rows, and keeps the matches without a branch on a digit. |
messagingOpen(key, envelope) |
Which conversation an envelope (hex) is for, its message not decrypted: { cid, kind, t, to, replaces }, kind first-contact or session, and F’s t, to and replaces for a first-contact message (null for a session message). It says which records messagingReceive needs. |
messagingReceive(key, requestJson) |
An envelope taken under protocol.md §5 and §6’s rules. { network, envelope, now, handles, conversations, requests, tombstones, firstContactBits } in: network, the key’s; handles, the wallet’s Seedelfs, [{ name, registers: [{ generator, publicValue }] }], each with every register it has held, as datums hold them, from which the export computes each messaging register M_S = (h_S, [x_m]h_S) (protocol.md §21.3): a first message written to another register’s is invalid_base_proof; conversations, the records of the conversation messagingOpen named and of the one its replaces names, whichever the wallet holds; firstContactBits, for tests and tuning only (24 without it). Out, the one record it changed: { received: { kind: "message", cid, plaintext }, conversation } or { received: { kind: "request", cid, plaintext, new, evicted }, requests }, evicted the requests only a new request pushes out, never itself, so always empty for a join. Among its refusals, each changing nothing: invalid_keys_proof, a first message whose keys proof fails or a join on another header key than its request’s first; request_full, a join past its request’s share (16 messages, 64 KiB) or past 256 KiB of requests in all, which never pushes another out; and too_far_ahead, said only of a held conversation’s session message past the skipped keys’ bound that authenticates and whose envelope checks, a forgery there being decryption_failed. |
messagingStart(key, requestJson), messagingStartContinuing(key, requestJson) |
A new conversation, before its first-contact stamp: { cid, conversation, digest } out, digest what the stamp is over. To a Seedelf, { network, name, register: { generator, publicValue }, certificate, now } in: its asset name, 1 to 32 bytes, its register as the wallet’s own read of the contract gives it now, and its certificate from the relay’s list, the one good certificate for that register (protocol.md §21.5); the conversation is written to the messaging register the certificate binds to the Seedelf. Refused for a certificate that doesn’t check under network or names another Seedelf, by name or register (invalid_certificate, or a point’s own code), for a Seedelf of the key’s own (own_register), and for a name or register that isn’t valid. Or continuing an old conversation with its identities and no to, { conversation, now } in. |
messagingFindStamp(requestJson) |
One slice of a stamp’s search, so the worker yields between slices: { digest, bits, from, attempts } in, { nonce } out, null when no nonce of the slice has the work. A conversation’s digest at firstContactStampBits (24), or a post’s at the price the relay names. Past 32 bits it’s refused. |
messagingSetStamp(requestJson) |
The stamp a first-contact message carries, set: { conversation, nonce } in, { conversation, bits } out, bits the work the nonce shows. Until it’s set, a first-contact message is refused (unstamped). |
messagingSend(requestJson) |
The next message, sealed in its envelope: { conversation, plaintext } in, { conversation, envelope } out, to store together before posting (protocol.md §4.2). It takes no key: the record holds the chain. Before a reply, the writer’s share is 16 first-contact messages and 64 KiB of them, what the reader keeps of a request: one past it is refused, request_full, before the chain moves (firstContactLeft says what’s left). |
messagingAccept(key, requestJson), messagingReadRequest(key, requestJson) |
A request, { requests, cid }: accepted, { conversation, requests, continues } out, continues what its replaces amounted to, which the conversation’s record doesn’t keep; or its texts decrypted to show them, { messages: [{ at, plaintext }] } in arrival order, changing nothing. |
messagingDelete(requestJson), messagingExpire(requestJson) |
A conversation or request deleted: { cid, conversation, requests, tombstones } in, { deleted, requests, tombstones } out, its ID a tombstone until its t + 48 hours and 7 days, whatever the clock says meanwhile. A conversation’s record the crate doesn’t read (a development build’s, a later version’s, or damaged) is taken as absent: nothing of it is deleted, no tombstone holds its ID, and the wallet deletes the record itself. And what has had its time, skipped keys past their 48 hours and tombstones past their t + 48 hours and 7 days: { now, conversation, tombstones } in, each record given back. |
messagingReveal(key, requestJson), messagingCheckReveal(requestJson) |
The verified reveal (protocol.md §19), which the wallet sends as a message of kind 0x02 with messagingSend. The initiator’s, once answered: { network, conversation, name, register: { generator, publicValue }, certificate } in, the Seedelf’s asset name, its register now and its certificate, { reveal } out, 274 to 305 bytes, hex without the kind byte; refused before a reply or at the responder (reveal_not_allowed), for a certificate that doesn’t check or doesn’t name that Seedelf (invalid_certificate), and when the certificate’s m_S or the conversation’s identity isn’t the key’s (not_for_this_key), so the wallet shows only a Seedelf its own certificate binds to its key. The responder’s check: { network, conversation, reveal } in, { name, register, messaging } out when it parses and its proof verifies under that network’s chain, messaging the Seedelf’s m_S, refused otherwise (invalid_reveal, reveal_not_allowed, a parse’s code); that the chain gives the name that register, and that a good certificate names that m_S and none names another (protocol.md §21.5), are the wallet’s to check. Neither changes the record. |
messagingCertificate(seedelfKey, messagingKey, requestJson) |
The certificate of one of the wallet’s own Seedelfs, to post to the relay’s list (protocol.md §21.4): { network, name, register: { generator, publicValue } } in, the Seedelf’s asset name and its register now, { certificate } out, 273 to 304 bytes, hex. One Fiat–Shamir challenge over two Schnorr proofs, x for the Seedelf’s register and x_m for its messaging register M_S: the only call in Messages that takes the Seedelf key. Each call draws its own aux, so one made again is other bytes for the same m_S. Refused, before either key meets the register, for one key given as both (same_key) and a register that isn’t x’s (not_owned); and for a name or register that isn’t valid. It posts nothing. |
messagingCheckCertificate(requestJson) |
A certificate from the relay’s list checked, with no key: { network, certificate } in, { name, register, messaging } out, the Seedelf it names and its m_S, under that network’s chain; refused otherwise (invalid_certificate, unsupported_version, or a point’s own code). It’s good for the Seedelf only while the wallet’s own read of the contract gives the name that register (protocol.md §21.5): the worker’s to check. |
messagingValue(messagingKey, requestJson) |
The wallet’s own m_S = [x_m]h_S for one of its Seedelfs: { network, name, register: { generator, publicValue } } in, { messaging } out, from the messaging key alone. It’s what the wallet’s own certificate for that register names, so the switch tells a certificate of its own from one naming another key (protocol.md §21.8) without the Seedelf key. h_S is a hash of the Seedelf, so the value answers no one’s Diffie–Hellman question. |
messagingWithdrawal(messagingKey, requestJson) |
One of the wallet’s own certificates taken off the relay’s list (protocol.md §21.7), with the messaging key alone: { network, certificate } in, the certificate as the list holds it, { withdrawal, digest } out, the 98 bytes to post, hex (version, the network’s byte, the certificate’s listing digest under the pool’s name, and a Schnorr proof of x_m on its messaging register), and what the post’s stamp is solved over, SHA-256("Seedelf-Messaging\|v1\|unlisting-stamp\|" ‖ len(pool) ‖ pool ‖ withdrawal). Each call draws its own aux, so one made again is other bytes naming the same certificate. Refused for a certificate that doesn’t check, with its code, and for one whose m_S isn’t the key’s (not_for_this_key): another wallet’s, or the wallet’s own Seedelf certified under another messaging key. |
messagingConversationInfo(record), messagingRequestsInfo(record) |
What the screens show, without secrets: a conversation’s { cid, role, t, to, replaces, sendsFirstContact, stamp, missing, sentInChain, maxTextLen, firstContactLeft }, and each request’s { cid, t, to, continues, arrivals, bytes }, oldest first. maxTextLen is the next message’s room, 0 once the share is used up; firstContactLeft is what’s left of the writer’s share while it sends first-contact messages, { messages, bytes, perMessage }, each message taking one of messages and its text’s length (its kind byte included) and perMessage more of bytes (F’s length and 97), and null after a reply and at the responder. |
messagingRelayDigest(pool, envelope), messagingPostBody(requestJson) |
What a post’s stamp is over, the envelope in mainnet or preprod; and the bytes to post, { nonce, envelope } in, a Uint8Array out (protocol.md §17). |
messagingListingDigest(pool, certificate) |
A certificate’s listing digest, hex, in mainnet or preprod: what its post’s stamp is solved over, and what a removal in the relay’s list names it by (protocol.md §21.7). |
messagingConstants() |
The numbers the worker works by: { firstContactStampBits, maxStampBits, envelopeSizes, firstContactMaxAge, firstContactMaxAhead, skippedKeyLifetime, maxRequests, maxRequestBytes, maxRequestMessages, maxOneRequestBytes, maxAuthSteps, priceCeilingBits, requestsVersion }: a request’s share (16 messages, 65,536 bytes), the most keys a message past the skipped keys’ bound is stepped to learn whether it authenticates (4,096), the most work the wallet solves for a post (26 bits, protocol.md §20), and the version of the requests’ record this build writes. |
start(), __wbg_reset_state() |
The module’s start function, which does nothing, and wasm-bindgen’s reset (build.sh passes --experimental-reset-state-function). The extension replaces an instance that trapped with the reset (extension/src/background/wasm.ts), which ends by calling start. |
The one-time key of a script spend is HKDF-SHA-256 of the Seedelf scalar (salt seedelf-one-time-key-v1, info the 32-byte seed). The seed can wait in JavaScript between review and Send; the key is re-derived inside WebAssembly each time and never leaves it.
Seedelf Messaging’s exports (chunk 54’s 54d, src/messaging.rs, over seedelf-messaging) are stateless. Each that reads, writes or proves takes a MessagingKey, never a SeedelfKey (chunk 55’s 55d, protocol.md §21.6), and messagingCertificate takes both. A request’s network is preprod or mainnet, whose Seedelf policy the export takes from seedelf-core’s constants, never from JavaScript; any other throws, so the crate’s unknown_network is never an answer, and a key’s call throws for the other network than the key’s. Among the codes the certificates bring, invalid_certificate, not_owned, same_key and invalid_withdrawal: the last is the relay’s, a withdrawal that doesn’t check against the certificate it names, so the wallet, which only makes them, never gets it either. Each takes the records it needs as the wallet stores them, a conversation’s, the requests’ and the tombstones’ (protocol.md §16.5), and gives back the ones it changed, so the worker’s one queue decides every write and a stopped worker loses nothing it stored. Every byte string is hex, a message’s text included. A refusal is an answer, { "refused": "<code>" }, its code the crate’s Error in snake case (stamp_too_low, deleted, key_used_or_deleted and the rest, as the relay’s vectors name theirs); only a request that doesn’t read throws. A requests’ record the crate doesn’t read is a refusal too, from each export that reads it (messagingReceive, messagingAccept, messagingReadRequest, messagingDelete, messagingRequestsInfo): { "refused": "unsupported_state_version", "version": <its first byte> }, older than requestsVersion for a development build’s record, which the wallet drops, newer for a later version’s, which it keeps and never writes over; or invalid_state for one that doesn’t parse. A conversation’s record that doesn’t read throws, except in messagingDelete, which takes it as absent. A conversation’s record holds its secrets, so the wallet seals it; WebAssembly wipes its own copies, the requests and answers that carry one or a text included.
./build.sh # → pkg/seedelf_wasm.js, pkg/seedelf_wasm_bg.wasm, .d.ts
Requirements:
wasm32-unknown-unknown targetclang with a wasm32 backend, because blst is C codellvm-ar (Ubuntu names it llvm-ar-18 and similar; the script finds it)wasm-bindgen-cli at the exact version of the wasm-bindgen crate in Cargo.lock. The script checks the version and prints the install command.The output is an ES module (--target web). Load it with init() or initSync().
The build is reproducible: it takes only the crates Cargo.lock records (--locked), and no path on the machine goes into the module, so the same commit and toolchain (the pinned Rust and wasm-bindgen, and the same clang) give the same bytes (launch review #61). Nothing pins clang, which compiles blst’s C, so the script’s last line names it (C compiler: …) for the release record.
It’s built for size with the workspace’s wasm-release profile (opt-level = "z", LTO, one codegen unit, stripped). It checks integer overflow where core, crypto and koios compile their code, not where this crate does (a small call-free or generic core function compiled here wraps): where the line falls, and why no crate leans on it, is in the workspace’s CLAUDE.md. Nor where seedelf-messaging does: a trap locks the wallet, and messaging’s input is a stranger’s envelope, read again at every sync, so a missed overflow there would lock the wallet each time (the workspace Cargo.toml says why that’s the better failure). The CLI keeps the plain release profile. node bench.mjs [pkg-dir] prints a build’s size (raw, gzip, brotli), how long the module takes to compile, and the median time of a key derivation, the ownership check, a re-randomization, a proof, a transfer (buildTransfer) and a move-in.
| Build | Raw | gzip | Proof | Transfer |
|---|---|---|---|---|
release |
7,100 KB | 1,474 KB | 1.8 ms | 51 ms |
wasm-release |
2,632 KB | 797 KB | 1.8 ms | 53 ms |
Measured 2026-10-04, built with Rust 1.98.1 and wasm-bindgen 0.2.128, in Node 24.19.0’s V8, the engine Chrome runs the worker in: the median of eight bench.mjs runs. release is build.sh’s build with --profile release in place of wasm-release. The transfer is buildTransfer, which proves the inputs and measures the scripts in the wallet. The figures are for that day’s module, built before the profile checked overflow in core, crypto and koios. The module has grown since: bench.mjs gives today’s.
Seedelf Messaging (54d) added 155 KB raw, 52 KB gzipped and 36 KB brotli: 3,676 to 3,831 KB, 1,062 to 1,114 KB and 761 to 797 KB, bench.mjs on the module built just before it (f1eb8cda) and with it, 2026-11-21. The other calls’ times didn’t move.
wasm-opt -Oz isn’t used. Measured once, on an earlier and smaller module, it made the build 9% smaller raw but 6% larger gzipped than wasm-release alone. It hasn’t been measured since.
What a restore costs on a large contract: node --expose-gc scale.mjs [rows] [checked] writes a synthetic contract/snapshot answer of rows rows in the data layer’s row shape, parses it as one string as response.json() does, and checks checked of them the way the worker does (the register out of the datum, then isOwned, 200 a turn). Measured in Node 24.19.0:
| Rows | Answer | Parsed rows | Peak RSS | Check, every row |
|---|---|---|---|---|
| 100,000 | 47 MB | 105 MB | 243 MB | 1.2 min |
| 1,000,000 | 473 MB | 1,051 MB | 1,291 MB | 12.1 min |
A row is about 473 bytes and its check about 0.73 ms, almost all of it isOwned’s scalar multiplication. Parsing took 0.2 s and 1.5 s. Mainnet’s contract held 33 unspent rows on 2026-10-09.
What Seedelf Messaging’s scan and stamps cost (54d): node --expose-gc scale.mjs messaging [envelopes] [solves] makes a relay pool of envelopes session envelopes, one in 1,000 the key’s, and scans it as the worker will (messagingScan, 200 a call, a turn of the event loop between). It then opens one of the key’s and receives it with its conversation’s record, times a stamp’s attempt over 2^22, and solves solves first-contact stamps at 24 bits and four times as many at the relay’s 18, in slices of 2^16 attempts. Measured in Node 24.19.0, 2026-11-21, with messaging 15000 16:
| Envelopes | Scan, each | Scan, all | Open a match | Receive a match | An attempt | 18 bits, mean of 64 | 24 bits, mean of 16 |
|---|---|---|---|---|---|---|---|
| 15,000 | 0.97 ms | 14.6 s | 1.9 ms | 5.7 ms | 422 ns | 0.13 s | 6.4 s (longest 17.5 s) |
These are the module’s before protocol.md’s call 16, not measured since: its scan compares a tag, one SHA-256 of two blocks more beside the multiplication, and its answer is a digit an envelope. The same steps in a module worker in Chrome 157 gave 1.09 ms an envelope, 16.3 s in all, and 438 ns an attempt. A stamp’s time is a geometric draw, so 2^bits times an attempt (about 7.1 s at 24 bits) is the figure to plan by: protocol.md §8 and §17.3 have both runs.
From seedelf-platform/:
cargo test -p seedelf-wasm # native, the plain-Rust layer
./seedelf-web-wallet/wasm/build.sh
node --test "seedelf-web-wallet/wasm/tests/*.test.mjs" # the built package, from JS
CI (.github/workflows/web-wallet.yml) runs both: the native tests within cargo test --workspace --locked, then the build and the JS tests. Two native tests are ignored: session_test.rs’s record_the_extensions_session_swap_fixture, which rewrites the extension’s tests/fixtures/session-swap.json, so it runs only on purpose (cargo test -p seedelf-wasm --test session_test -- --ignored); and payment_parts_shapes_test.rs’s every_shape_goes_in_parts_the_ledger_takes, slow, which the release checks run (development.md).
Both suites check the same pinned vectors as seedelf-crypto, and the same recorded preprod data, so the WebAssembly build is known to match native Rust byte for byte:
seedelf-crypto’s random_register vectorseedelf-crypto/tests/vectors/seedelf_key_v1.json, and Messages’ key’s in seedelf_messaging_key_v1.json on both networks, never the Seedelf key the same entropy gives (messaging_test.rs, tests/messaging-key.test.mjs)seedelf-crypto/tests/vectors/cardano_account.json, verified against @cardano-sdk (Lace’s library)tests/entropy.test.mjs)tests/free_wipes_key.test.mjs, on the built package): before free() a key’s bytes are where its object keeps them, and after it none of them is left there, a MessagingKey’s as a SeedelfKey’s; scrubStack() overwrites every byte of the stack’s top 512 KiB and none below; after runs that end in a lock and a scrub, the whole memory is looked through for the keys, the keys they derive and what they came from; and the review’s sequences are run with their controls: what the free()s and the scrub alone leave in the heap, and that the instance the glue’s reset puts in place is a fresh one’s memory, with no run of any key. The extension’s tests/wallet-lock-scrub.test.ts holds when the worker scrubs, and tests/lock-renews-wasm.test.ts and tests/wasm-renew-glue.test.ts that a lock replaces the instance and zeroes the old memory.tests/move-in.test.mjs), with and without a slot they stop being valid at. The native tests also check that every witness verifies against the tx hash, that the signers are exactly the inputs’ payment keys, that a send pays exactly the address, a note on a send, several addresses in one send, and that a short amount goes up to its minimum (for transfers and withdrawals too).tests/mint.test.mjs). The native tests also check that every witness verifies, and that the signers are exactly the inputs’ and the collateral’s keys.tests/mint.test.mjs, with giveme.my’s recorded refusal from the extension’s tests/fixtures/mint-preprod.json). The native tests also finish one with the real preprod Ogmios evaluation recorded there, sign one with a stand-in collateral key and check every witness, and check that giveme.my’s real key refuses anything else.tests/transfer.test.mjs, from the extension’s tests/fixtures/transfer-preprod.json). The native tests also check that the payment is a fresh copy of the recipient’s register, that paying your own Seedelf is flagged, several Seedelfs in one transfer, and every refusal: a name that isn’t whole, a UTxO without that Seedelf or outside the contract, no register, and invalid, torsion or identity points.tests/withdraw.test.mjs, from the extension’s tests/fixtures/withdraw-preprod.json). The native tests also check several addresses at once, Max’s cap of 20, a removal back into the contract, isOwnAddress, which histories a withdrawal spends together, and every refusal.account_info, a send taking the rewards along, pool and DRep IDs read the way Koios names them, and the account’s own DRep: drepOf, a CIP-119 profile, and registering, voting and retiring (tests/staking.test.mjs, from the extension’s tests/fixtures/staking-preprod.json). The native tests also check which keys sign each one, and what the ledger would refuse.mix_box, and a datum as deep at a spent Splash order’s address, which readDexOrder reads as no order of the session’s: none makes a request unreadable or overflows the module’s stack, and the module reads a real order afterwards (tests/deep.test.mjs)cardano-cli debug transaction view on real preprod transactions and ones cardano-cli builds (decode_test.rs, from tests/fixtures/decode-txs.json, which tests/fixtures/record-decode.mjs records); tests/decode.test.mjs checks the bindingtests/reset.test.mjs; JS only, since the reset is wasm-bindgen’s glue)messaging_test.rs, tests/messaging.test.mjs): the session vectors’ first messages opened, received at the full 24-bit stamp, read back and accepted; both vector files’ stamps found in slices, and a post’s bytes; two wallets writing to each other through the records alone, a continuation, a deletion and its tombstone’s expiry, each refusal as its code; the reveal vectors’ checks through messagingCheckReveal, and a reveal made, sent and checked between two wallets, refused for another’s Seedelf or certificate, and read only under the network it was made under; each side with a Seedelf key and a messaging key, the writer starting on the reader’s certificate, and the reader taking a first message with its messaging key alone; certificates made, checked and refused (same_key, not_owned, a start’s invalid_certificate), the certificate vectors (messaging_certificate_v1.json), messagingValue as the wallet’s own certificate’s m_S, and a withdrawal of the wallet’s own certificate alone, checked as the relay checks it, its stamp’s digest recomputed; a MessagingKey’s class (tests/messaging-key.test.mjs): none of the funds methods, no other class taken by a messaging* export, and its network, strict at each constructor and held to every request that names one; the scan’s digit an envelope; a writer’s share at both ends (firstContactLeft, request_full); a join judged before any key (invalid_keys_proof, request_full) and pushing no request out; too_far_ahead only for a message that authenticates, within maxAuthSteps; and the development builds’ records (seedelf-messaging’s tests/fixtures/old_records_v1.json) refused by their version, a conversation’s taken as absent by messagingDelete. Natively, the constants are the session module’s own, and the tests hold the share’s, maxAuthSteps and requestsVersion to what the crate does as well as to their values; and a secret’s hex is decoded into one buffer of its length (src/messaging.rs’s own test). The protocol’s own tests are seedelf-messaging’s.And natively only:
cip30_test.rs): CIP-30’s encodings, reading a dApp’s transaction for the prompt, signing it, and CIP-8 data signatures, checked against Pallas’s own decoders and Ed25519 verification; and a site’s amount, read with a bound (read_value_test.rs)session_test.rs): the one-time accounts, a session’s return, and reading and signing a swap built for one; and a return taking a stranger’s UTxOs only when they pay their own way (return_cost_test.rs)src/lib.rs’s dex_order_tests): readDexOrder on every real order seedelf-core’s tests cancel, with the output’s form and a datum nested 100,000 levels deep, and checkOrderCancels on Minswap’s real preprod swap (tests/fixtures/minswap-swap-preprod.json). The cancels themselves, each DEX’s through its real script, are seedelf-core’s tests/orders_test.rslovejoin_test.rs, lovejoin_mainnet_test.rs): a session’s chain and the public account’s, signed and measured against the deployed preprod and mainnet scripts, and the boxes’ withdraws through giveme.myreadme_test.rs): the API table names every export, each js_name and js_class in src/