A smart-contract wallet whose only owner is a hash-based key. There is no owner address, no admin, no upgrade path, no pause, and no elliptic-curve signature check in the wallet or its factory. The claim is that no elliptic-curve key can move this wallet. It is not a claim that the chain is safe from a signature break: the chain’s own keys and the token issuers’ keys are out of scope.
How a wallet works
One entry point, callable by anyone:
run(Action a, Sig sig)
Action = { address target, uint256 value, bytes data, uint256 nonce, uint256 deadline, uint256 gas }
In this order run checks: gas is within 30,000..5,000,000; nonce equals the wallet's nonce; block.timestamp <= deadline; deadline is at most 30 days past the current block (DeadlineTooFar, so no signature can stay valid for years); the leaf is in range and unused; the signature verifies (section 3.6). Any failure reverts and changes nothing. After that the leaf is marked used and the nonce goes up by one, then the wallet makes one call, target.call{gas: a.gas, value: a.value}(data), and emits
Ran(uint256 indexed nonce, uint256 indexed leaf, address indexed target, bool ok, bytes result)
A failing inner call does not undo the leaf or the nonce; ok is false. result is the target's return or revert data, cut to 256 bytes, so a target cannot make the submitter pay to copy a huge reply. A re-entrant call from the target sees the spent leaf and nonce already; replays are refused and the next signed action is accepted in order (both tested).
Just before the call, after the call data has been copied into memory, run requires gasleft() >= gas * 64 / 63 + 50,000, so the inner call really receives the signed gas (checked at the smallest accepted gas limit, including for 200 KB of data, test_S_signedGasDeliveredEvenForBigData). The check sits in the same assembly block as the call so a refactor of the code around it cannot separate them. If the submitter gave less, run reverts with NotEnoughGas and the leaf is NOT spent on chain (see limits: the signer treats it as spent anyway).
batch(Call[] calls) runs several calls in order, all or nothing. It accepts calls only from the wallet itself, so the only way in is one signed action whose target is the wallet. One leaf, one nonce and one verification then pay for the whole list: the SDK uses it to approve a token and open a tab under a single signature. If any call fails the batch reverts with BatchFailed(index, reason) (reason cut to 256 bytes), so a failed open cannot leave an approval behind; the leaf and nonce are still spent. The action's signed gas bounds the batch as a whole. Two separate actions would cost a second full verification and a second 3 to 6 KB of calldata, and would leave a standing approval if the second failed, so the batch is both cheaper and safer. Its cost is about 25 lines of wallet code reachable only through a signature.
setKey(newRoot, newPubSeed) rotates the key. It only accepts calls from the wallet itself, so the only way to reach it is a signed action whose target is the wallet. Afterwards the old key is refused, the new key starts with all 2^20 leaves unused, and the nonce carries on. A zero root is refused (the action then fails inside and still spends its leaf and nonce).
The wallet receives ETH through receive() and tokens by ordinary transfers. It moves anything out only through run. ETH sent with Solidity's transfer or send (which forward 2,300 gas) is refused: the wallet is a proxy and its cold delegatecall costs more than that stipend. The sender reverts and nothing is lost; use a plain call with gas.
Factory
PreimaWalletFactory deploys EIP-1167 minimal proxies of one locked PreimaWallet with CREATE2.
- salt used =
keccak256(abi.encode(root, pubSeed, salt)) - With the SDK,
saltiswalletSalt(index)(section 3.2), so words plus a wallet index give exactly one key and one address. predict(root, pubSeed, salt)gives the address before the wallet exists, so it can be funded first (tested with ETH and a token).create(root, pubSeed, salt)is open to anyone and gives the same wallet whoever calls it. If the wallet already exists it returns its address and does nothing else (cheap, no event, no revert), so a front-runner or a second process neither fails nor burns its gas limit. The returned wallet may since have rotated to another key, so a caller reads itsroot;WalletPayerdoes. A zero root is refused.isWallet(address)is true for wallets this factory made.- The implementation is locked:
run,init,setKeyand plain ETH transfers all revert on it. Clones are initialised once, by the factory only, in the same transaction that creates them.
The hash key
Winternitz one-time signatures (w = 16, 67 chains) in a two-layer Merkle tree: a top tree of 1024 one-time keys, each signing the root of a bottom tree of 1024 one-time keys. That gives 2^20 = 1,048,576 bottom leaves. keccak256 everywhere; every hash is tweaked by a public seed and an address word.
Notation: H(a || b ...) is keccak256 of the concatenation; every integer is a 32-byte big-endian word.
3.1 Tag strings (all preima.v1.*)
| Use | String | Value |
|---|---|---|
| master key | preima.v1.master | TAG_MASTER = keccak256(utf8(string)) |
| public seed | preima.v1.pubseed | TAG_SEED |
| secret chain starts | preima.v1.sk | TAG_SK |
| tab key | preima.v1.tabkey | TAG_TABKEY |
| factory salt of wallet i | preima.v1.walletsalt | TAG_WALLET_SALT |
| SDK top-tree cache seal | preima.v1.topcache | TAG_TOPCACHE, SDK file only (section 7) |
| signed digest | preima.v1.action | DIGEST_TAG |
| tab secrets (tabs spec, section 2.1) | preima.v1.tab | used with tabKey, not by the signer |
3.2 From the 24 words
- The words are 24 BIP39 English words: 32 bytes of
entropy, checksum enforced. master(i) = H(TAG_MASTER || entropy || i)for wallet indexi(default 0): signs for walletiand nothing else. Every index gives an unrelated master, so one set of words behind several wallets never shares a one-time leaf.walletSalt(i) = H(TAG_WALLET_SALT || i): the factory salt of walleti. Words andifix the root, the seed and the salt, so exactly one wallet address.tabKey = H(TAG_TABKEY || entropy): 32 bytes, makes tab secrets only. It cannot sign for the wallet and is unrelated to any master without the words, because the tags differ. It does not depend on the index: tab ids contain the wallet address, so tab secrets of two wallets already differ. A process that only pays needstabKeyand never the words.pubSeed(epoch) = H(TAG_SEED || master(i) || epoch)sk(epoch, layer, tree, leaf, chain) = H(TAG_SK || master(i) || epoch || layer || tree || leaf || chain). Layer 0 is the bottom (tree = b), layer 1 the top (tree = 0).
The epoch is SDK-side only (the chain stores a root and a seed). It starts at 0. A new epoch from the same words is an unrelated key and gives a way to rotate without new words, but new words are better (a leaked old epoch then teaches nothing about the new one).
3.3 Address words
- chain step:
adrsF = (1 << 248) | (layer << 240) | (tree << 40) | (leaf << 16) | (chain << 8) | step - leaf:
adrsL = (2 << 248) | (layer << 240) | (tree << 40) | leaf - tree node:
adrsT = (3 << 248) | (layer << 240) | (tree << 40) | (level << 32) | index
3.4 One layer
F(x) = H(seed || adrsF(layer, tree, leaf, chain, step) || x); chainx_0 = sk(...),x_{s+1} = F(x_s)withstep = s; the chain end isx_15.- leaf value
L = H(seed || adrsL || end_0 || ... || end_66)(69 words) - node
N(h, i) = H(seed || adrsT(layer, tree, h, i) || N(h-1, 2i) || N(h-1, 2i+1)),N(0, i) = L(i); the tree root isN(10, 0). - Digits of a digest
d:m_i = (d >> (252 - 4i)) & 0xFfor i = 0..63, checksumc = sum(15 - m_i),m_64 = (c >> 8) & 0xF,m_65 = (c >> 4) & 0xF,m_66 = c & 0xF. The signature isx_{m_i}of chain i; the verifier finishes each chain (stepsm_i..14) and hashes the ends into the leaf.
3.5 Hypertree and signature
A leaf id l (below 2^20) names bottom tree b = l >> 10 and index j = l & 1023. The wallet's root is the root of the top tree (layer 1, tree 0). Top leaf b only ever signs the bottom root R_b.
Sig = { leaf, chains[], path[], topChains[], topPath[] } (dynamic arrays): the WOTS signature of the digest by (0, b, j) (67 words), j's authentication path in bottom tree b (10 words), the WOTS signature of R_b by (1, 0, b) (67 words), b's path in the top tree (10 words). The last two arrays may be empty (section 3.6).
3.6 Verification, and the remembered bottom roots
The top layer only proves that bottom tree b's root belongs to the key, and that proof is the same for all 1024 leaves of the tree. So the wallet checks it once. For a signature with leaf in bottom tree b:
- it recomputes the bottom root
Rfrom the digest and the bottom layer (always); - if the wallet has no root remembered for
(root, b), the signature must carry the top layer: the wallet recomputes the account root fromRand the top layer, requires it to equalroot, and then remembersR(one storage write); - if a root is remembered,
Rmust equal it, and the top layer is not read (it may be sent, and then it is inert).
This verifies the same statement as before: the digest was signed by a leaf of a bottom tree that the account root commits to. A root is remembered only after the full top check passed in a transaction that completed, so a refused or out-of-gas first signature remembers nothing. Remembered roots belong to a key: after rotation the new key has none. bottomRoot(b) reads the remembered root. The SDK signer drops the top layer when the wallet's bottomRoot(b) equals its own root for that tree, and keeps it otherwise, which always works. Because leaves are used in order, 1023 of every 1024 signatures can be the short form.
The signed digest
actionHash = keccak256(abi.encode(target, value, keccak256(data)))
digest = keccak256(abi.encode(DIGEST_TAG, chainid, wallet, root, nonce, deadline, gas, actionHash))
Eight 32-byte words, abi.encode of (bytes32, uint256, address, bytes32, uint256, uint256, uint256, bytes32). The digest binds the chain, this wallet's address, the key (root), the nonce, the deadline, the gas the inner call must receive, and the call itself. PreimaWallet.actionDigest(a) returns it; the JS actionDigest returns the same bytes (checked on 29 signatures made by the JS signer, verified inside Solidity from contracts/test/fixtures/wallet-vectors.json, which sdk/test/wallet/gen-fixtures.mjs regenerates).
Calldata of run
run((address,uint256,bytes,uint256,uint256,uint256),(uint256,bytes32[],bytes32[],bytes32[],bytes32[])), selector keccak256(that string)[0..4]. Both tuples are dynamic. In words after the selector: 2 head words, the Action (6 head words, the data length, the data padded to 32 bytes), then the Sig (5 head words, then each array as a length word and its items: 68 + 11 + top).
- full signature (first from a bottom tree):
4 + 32 * (2 + 7 + ceil(len(data)/32) + 86 + 77)bytes - short signature (bottom layer only):
4 + 32 * (2 + 7 + ceil(len(data)/32) + 86)bytes, 77 words (2,464 bytes) fewer
Measured: sink call with 36 bytes of data 5,572 full, 3,108 short; approve 5,604 full; open on PreimaTabs 5,764 full; batched approve and open 6,276 full, 3,812 short. At 16 gas per non-zero byte, calldata alone is about 50,000 gas of intrinsic cost (short) to 90,000 (full), plus 21,000, and on an L2 the data may also be priced separately. Measure on the target chain before quoting a cost.
Gas, measured
forge test (solc 0.8.28, optimizer 200 runs, evm paris, no via_ir). EVM execution of one run call, without the 21,000 base and calldata bytes. "Before" is the first design (static signature, top layer checked every time); "after" is this build, measured again after the round-three changes (deadline cap, gas check moved into the call, idempotent create).
| Run | Before | After, first signature from a tree | After, later signatures |
|---|---|---|---|
| storage-writing target (sink.poke) | 440,589 | 470,328 | 219,718 |
| approve a token | 421,433 | 444,770 | not measured separately |
open a tab on PreimaTabs | 497,105 | not measured separately | 400,072 |
| request a close | 345,932 | not measured separately | 248,959 |
| approve and open, one batched signature | 560,119 | 585,844 | 379,845 |
| calldata, sink action | 5,284 bytes | 5,572 bytes | 3,108 bytes |
| calldata, batched approve and open | 5,988 bytes | 6,276 bytes | 3,812 bytes |
| verification alone (bad signature, then revert) | 320,746 | 334,583 | not applicable |
| smallest gas limit accepted for a 200,000-gas call | 624,645 | 641,663 | not measured |
A first signature from a bottom tree costs about 30,000 gas more than in the first design (the remembered root is a storage write and the arrays are dynamic). Every later signature from the same tree costs about 220,000 gas less than the first design and about 250,000 less than a first signature, and sends 2,464 fewer bytes. Over a tree's 1024 leaves the average saving against the first design is about 220,000 gas per action. Approve plus open as one batched signature is 379,845 gas on a known tree, against 560,119 before and against 918,538 for two separate actions in the first design (421,433 for the approve plus 497,105 for the open). "Not measured separately" rows were measured only in one order (approve first, then open and close on the known tree) in one test.
I tried rewriting the chain-step loop in hand-written assembly: it saved about 2,000 gas of 468,000, so the cost is the hashing itself (about 1,000 keccak steps across both layers plus Merkle paths), and the plainer code stayed. The same code under via_ir verified in about 310,000, so the profile was not changed. Packing the signature tighter is not safe to attempt blindly: every chain value is needed, and a shorter chain would weaken the scheme.
Default signed gas for the SDK helpers (what the inner call may use): approve 100,000, open 350,000, requestClose 100,000, token transfer 150,000, ETH transfer 50,000, rotate 100,000, batch overhead 30,000 plus the calls' own. They are generous and the call is charged only for what it uses, but a call that needs more than the signed gas fails and still spends the leaf and nonce, so measure real stock tokens on a fork before relying on the defaults.
Keys and files on the agent side
- The 24 words make the wallet key and
tabKey. Keep them out of the model's context: the SDK reads them from a file or env var (loadWords), keeps only the derived master key inside theHashKeyobject, and no function returns the words. tabKeyis for the paying process. It cannot sign for the wallet.- The leaf store (
FileLeafStore, a directory<path>.d) holds one empty marker file per spent leaf, in one subdirectory per bottom tree (leaves/<root>.<tree>/<leaf>, so no directory ever holds more than 1,024 names andnext()lists at most 1,024 tree directories and one tree), plus floor markers. A leaf is claimed by creating its marker with the exclusive flag, which the operating system lets exactly one creator do, and the marker (file and directory) is synced before the leaf is returned. There are no locks, no counter to overwrite and nothing to expire: two processes, a signer that stalled for an hour, or a restored half of the directory cannot be given one leaf twice (tested with real separate processes). Names are read with a strict pattern and bounded by the key's 2^20 leaves: a planted or corrupt name is ignored,raise()refuses a number above 2^20, andnext()throws at the last leaf instead of walking on. A signature that was made and then lost still counts as spent. Keep the words and the leaf directory together. A store must saydurable === true:WalletSignerandWalletPayeraccept nothing else (a store that says nothing, such as a wrapper that did not pass the flag on, is refused; aMemoryLeafStoresaysdurable = falseand needsallowVolatileStore, which is for tests). - Leaf directory layout version 2 (package 0.3.0; releases up to 0.2.x wrote version 1, one plain file
leaves/<root>.<n>per leaf). A directory says its version in alayoutfile, and this code opens only layout version 2: any other version, unreadable or unknown, is refused and nothing in the directory is changed. A directory with nolayoutfile (or an empty one, which is what a crash while writing it leaves) is treated as version 1 and migrated when it is first opened, in this order: (1) the guard entry for EVERY root named by an old marker or an old floor file, and for the key asked about, is written, synced and read back; (2) only then, for every old marker, the floor is raised strictly past it (synced); (3) only then are the old markers moved tolegacy-v1/as tombstones; (4) andlayoutis written last, through a temporary file and a rename, so it is never seen empty or half written. Every step can be repeated after a crash at any point, and a store object whose open failed tries again on its next call. A marker at or above 2^20 is not counted: it is what an old release leaves when it meets the guard. A guard entryleaves/<root>.1048576is written for every key, so a release that still reads layout version 1 and is pointed at a version 2 directory takes it for a spent last leaf and is handed a leaf at or above 2^20, which every signer refuses (checked against the 0.2.x store, commit5910e48, in real processes and at every file-system call of the upgrade). Because the guard comes first, an old process still running during the upgrade is refused from the moment the first guard is on disk; the only unprotected moment is a claim an old process had already started a few microseconds before that. Never run an older release on a directory a newer one has opened. - The top-tree cache file is optional and is not trusted.
HashKey.sealTopCache()writes the 1,024 public leaves withMAC = H(TAG_TOPCACHE || master(i) || index || epoch || pubSeed || leaves), a tag only the holder of the words can make, bound to the index, epoch and seed. On load the MAC is checked; a cache that fails (an altered leaf, the old plain format, another wallet index's or epoch's cache, a recomputed MAC) is ignored, the tree is rebuilt from the words and the file rewritten. Before the wallet is created the root is derived once more from the words with no cache, and before any address is reported the key must passselfCheck: it signs the top layer for a bottom root and the result must climb to its own root (no leaf is spent doing it). The cache is rewritten through a link-safe write: an exclusive, no-follow temporary file with a random name in the cache's own directory (which must be a real directory, owned by this user, not writable by others), refused if the target is a link, not a plain file, not ours, or the same file as the words file; andWalletPayer.createrefuses outright a cache path that is, or resolves to, the words file or lies inside it. The directory is resolved once, and it and every ancestor up to the root must be owned by this user or root and not writable by group or others (a sticky root-owned directory like/tmpis accepted as an ancestor); the write then works on the resolved path, so nobody but this user or root can swap a directory for a link between the check and the write (this user can, and no check could stop that). The cache and the scan hint are read without ever blocking or following a link: a missing file, a link, a FIFO, a device, a file of another user or an oversized one reads as absent. - Before each signature
WalletPayerreconciles the leaf store with the chain. It reads the wallet'sleavesUsedand itsRanandKeySetevents (paginated by block range, shrinking the range when a provider refuses one; viem's strict decoding; the scan can start from a hint file holding the block of the wallet's first event, which is never trusted over the logs). Every log must decode with a leaf in 0..2^20-1 or nothing is used. The distinct leaves seen for this key must EQUALleavesUsed(), otherwise the scan is incomplete (pruned or lagging logs, or a wrong hint) and no signature is made; after a rotation the events are attributed to the key that signed them (asetKeytransaction's ownRanbelongs to the old key). The next leaf is made strictly above every leaf seen, with a full margin of 1,024 added in three cases: the store is behind the chain, its directory is empty for a wallet that already existed (a lost or new directory; the creating payer is exempt), and the caller passedrestored: true. Before each leaf is spent the chain is askedleafUsed(candidate); the answer must be exactly true or false, onesign()skips at mostmaxSkip(256) leaves, and atruefor a leaf above the verified logs is refused before anything is written. The state is recorded only after the raise succeeded, so a failed raise is retried. If the chain cannot be read, or any check fails, nothing is signed and nothing is written, unless the caller setsoffline. Deadlines come from the latest block's timestamp (anowoverride exists for tests), so a wrong machine clock cannot make an action expired on arrival or valid for too long; the default life is 30 minutes and the wallet itself refuses anything past 30 days. WalletPayer(sdk/src/wallet/payer.js) implements the tab payer interface for this wallet.addressis the wallet; the words come from a file or an env var;openTabsigns ONE action (a batch of approve and open, or just open when the allowance already covers it);requestClosesigns one action; the wallet is created through the factory on first use. It checks the agent's tab id againsttabIdOf(wallet, seller, salt)before any leaf is spent, serialises actions (each needs the current nonce), and after the receipt checks theRanevent: an action that failed inside the wallet is reported as an error that says its leaf and nonce are spent. After a rotationrotateKey(newKey)rebuilds the new key from its words with no cache, runs its self-check, signs the rotation and then drives the same wallet address with the new key (a fresh leaf counter under the new root); a payer made later for the rotated key passes the wallet's address as thewalletoption, since an address predicted from a key follows that key.- The transaction submitter is an ordinary gas key. It holds only gas dust, can call only
run, and cannot move the wallet's money: it does not hold the words and cannot make a valid signature. A stolen gas key can at worst waste its own dust or hold back a signature it was given (see limits).
Limits, stated plainly
- Leaf count. 2^20 signatures per key, and each action uses one, including
approve,open,requestClose, a rotation, and every failed call. Verification and key rebuilding cost a bottom tree (about 1M hashes, a second or two) per 1024 leaves, which the signer caches while leaves are used in order. The last 1,024 leaves are a rotation reserve: ordinary actions are refused from leaf 1,047,552 on (before anything is spent), and only asetKeyrotation of the wallet may use them, so a key can always be rotated out; the reconciliation never raises the floor into the reserve. When leaves run low, rotate; the signer refuses to sign past the last leaf and says so. - A leaf signs once. Two different messages on one leaf make forgery of that leaf cheap enough to treat as a break (a collision in the one-time signature; about one pair in four is forgeable at roughly 2^40 work or less). The wallet refuses a used leaf, and the signer never reuses a leaf. On one device the exclusive per-leaf markers make a repeat impossible. The residual risk is a signature that was made, never landed, and whose leaf is then handed out again by a store that no longer holds its marker: limit 5 says exactly when that is and is not prevented.
- Twin wallets. The factory lets anyone create more wallets with your root and seed at another salt; each tracks used leaves on its own, so a leaf spent on one is fresh on the other. That only hurts if your own software signs for both from separate counters. The SDK derives a different key for every wallet index (section 3.2) and keys its leaf store by root, so SDK users never share a root; do not build wallets from
rootand an arbitrary salt by hand, and never use one words, index and epoch for two wallets. - A lost words file means a lost wallet. There is no recovery path, no guardian and no admin: nobody, including the Preima team, can move the funds. Withdraw or rotate while you still hold the words. A leaked words file is the same as handing over the wallet: anyone with the words can sign anything, instantly and without limit, and nothing on chain can stop it. Type or store the words only where no model or untrusted page can read them.
- A lost or restored leaf directory.
WalletPayerdoes NOT make a signature unless the logs it reads from the chain agree withleavesUsed(), and it puts the next leaf strictly above every leaf the chain has seen. What is and is not protected, exactly:
- Protected: a directory that is BEHIND the chain (restored from an older backup, or one that missed leaves signed on another machine that landed) is raised past the highest leaf the chain shows plus 1,024. A lost or brand new directory for a wallet that already exists starts 1,024 above everything the chain shows (so it starts at 1,024 on a wallet with nothing landed). A directory you restored and tell the payer about (
restored: true) is put a full margin above the chain even if it is level. - Protected: a leaf the chain itself shows as used is never signed. Every RPC answer is validated before anything is written (strict decoding, leaves in range, counts that agree) and one
sign()skips at most 256 leaves. A hostile or broken RPC that gives one consistent answer can still push the floor up, which burns leaves (never reuses one), but it cannot push it into the last 1,024 leaves, which stay available for a rotation. - NOT protected: a restored directory that is exactly LEVEL with the chain, if you do not say
restored: true. It cannot be told from a current directory, so a signature made after the backup that never landed (reverted, expired, dropped) can be made again on its leaf with a different digest. Always passrestored: trueafter restoring a backup. - NOT protected: signatures that were made and never landed on a machine whose directory is lost, beyond the 1,024-leaf margin, and the single case of a lost directory on a wallet this payer did not create when two such fresh directories start together at the same point (they will pick the same first leaf if neither has landed anything; start one at a time, and let the first land).
- The MCP server takes it as
PREIMA_WALLET_RESTORED=1(orwalletRestoredin its config file): set it for ONE start after restoring a backup, then unset it. restored: truehas no effect together withoffline: true(nothing is read from the chain then); use one or the other. "This payer created the wallet", which skips the empty-directory margin, rests on onegetCodeanswer, so use a trusted RPC.- Needs an RPC that serves
eth_getLogsfor the wallet's address (blocks are scanned in ranges, so provider caps are survived, but the scan must return every log). Withofflinenone of this runs: use it only for a directory you know is current. - Other code that signs with the words directly (not through
WalletPayer) gets none of this: useWalletSignerwith anisLeafUsedhook and callraiseafter a restore. - Cost:
next()andpeek()list at most 1,024 tree directories plus one tree directory (up to 1,024 names), however many leaves are spent (the first design listed every marker, about 8 seconds each at a million). The log scan reads the whole event history of the wallet once per process start, then only new blocks.
- A signature that never landed can still land until its deadline, and then does what the owner signed, at that nonce, if nothing else took the nonce. Keep deadlines short (the SDK default is 30 minutes, the wallet caps them at 30 days). A replacement signed for the same nonce loses a race against it. Wait for the deadline or resubmit the same signature.
- Submission is in nonce order, one at a time. The nonce is read from the wallet; a submitter that sends two actions at once will see the second revert until the first lands.
- If the submitter supplies too little gas,
runreverts withNotEnoughGasand nothing is spent on chain, but the signature is public to that submitter. The signer treats the leaf as spent anyway and signs the retry with a new leaf. A malicious submitter can hold or drop a signature; it cannot change it. - The signed
gasis a promise to the inner call, bounded 30,000..5,000,000 for the whole call. A token whose transfer needs more than the signed gas fails and still spends the leaf and nonce. Measure first. - A signature is up to 6.3 KB (3.1 KB once the tree is known) and a run costs about 220,000 to 590,000 gas. Agents should batch intent into few wallet actions (open large tabs, not many small ones, and approve plus open in one batch) rather than one action per payment, which is what the tabs design is for.
- A remembered bottom root is per key and per tree. If a first signature from a tree never lands and the signer assumed it had, the next one reverts with a shape error and nothing is spent on chain; the SDK avoids this by reading
bottomRoot(b)from a provider before it decides to drop the top layer. Once a tree is remembered the top part of a signature is not read, so the bytes of a valid signature are malleable; nothing keys off signature bytes, but an indexer should not either. - ETH sent with a 2,300-gas
transferorsendis refused (section 1). The sender reverts and keeps its ETH; payers that can only use those calls cannot pay this wallet. - A process running as the same user can defeat any file check. Everything the signer and payer do to protect files (exclusive no-follow writes, refusing links, ownership and permission checks on the directory and its ancestors, strict reads) stops OTHER users and group- or world-writable places. It cannot stop a program running as the same user as the wallet process, such as a model with file tools working in the same account: that program can swap a directory for a link between a check and a write, replace the leaf directory, or read the words file the process itself reads. Keep the words file, the leaf directory and the cache in directories no such program is given, run the agent under its own account, and treat anything that can run code as you as having the wallet.
- Scope of the claim. The wallet's owner is a hash key.
PreimaTabstakes no signature. The chain's sequencer and bridge keys, and token issuers' keys (USDG, stock tokens), are elliptic-curve keys outside this design. - Reviewed independently in eight rounds, not an audit, nothing proven formally. The tests cover each refusal path, a cross-check against the JS signer, and an independent signer written from this document; they are not a proof. Deployed contracts are listed on the home page.