satchel-nft
v0.3.1
Published
Check that a Satchel NFT, one wallet on 16 EVM chains signed through NEAR Chain Signatures, is provably clean before you buy it; mint, list, buy and send from one. A library and a CLI.
Maintainers
Readme
satchel-nft
Satchel is an NFT on NEAR that is a wallet: only whoever owns satchel #N can have its address signed for, on 16 EVM chains, through NEAR Chain Signatures. Selling the NFT sells the wallet. But a transaction, an approval or a raw signature (a permit, say) made before the sale still works on its chain, so before you buy one, you want to know that the seller can't still move what's inside. This package answers that question with the clean transfer report, and signs Satchel's transactions. The web app at satchelnft.xyz runs on this same code.
It is a library and a command line tool. Node 22 or later; the library is an ES module.
Not audited. A mainnet satchel holds real funds: keep in one only what you can afford to lose.
Check a satchel before you buy it
npx satchel-nft verify --network mainnet 1Satchel #1 on v1.satchel-nft.near (mainnet)
owner satchel-nft.near, address 0xdC269Ead17B522d49db2ceFD38CEF0C5413868F9, record version 1
[PASS] The contract can't sign behind the record
No access keys, so no one can redeploy it or sign as it
Code hash 94x4MmZKXGetffqJJVePLTdFkJvsmeXRLmi74Mdp2Lph is the reproducible build of commit 87148c6
Signs only through v1.signer
[PASS] No signed transaction is still pending
Base: signed up to nonce 0, finalized nonce is 1
[PASS] No approval left behind
No approval was ever signed for this token
[PASS] Nothing the record can't explain
0 raw signatures, 0 unclassified calls, 0 approvals over the cap
PROVABLY CLEAN (checked 2026-11-09T15:10:40.555Z)
read from https://rpc.mainnet.fastnear.com, https://base-rpc.publicnode.comIt exits 0 only when the report reads PROVABLY CLEAN. No wallet and no keys: it reads NEAR and
each EVM chain the satchel's record lists, at a finalized block.
| Check | Passes when | | --- | --- | | The contract can't sign behind the record | The contract account has no access keys, its code hash is the reproducible build, and it signs only through the canonical Chain Signatures contract | | No signed transaction is still pending | On every chain, the address's nonce at a finalized block is above the highest nonce the contract ever signed | | No approval left behind | Every approval the contract signed reads as revoked on chain | | Nothing the record can't explain | No raw signatures, no calls the contract couldn't classify, no approvals over the cap |
Commands
satchel-nft <command> [options]| Command | What it does |
| --- | --- |
| verify <id> | The clean transfer report. Exits 0 only when it reads PROVABLY CLEAN |
| show <id> | Owner, address, listing, and what it holds on the network's EVM chains: the native coin, and USDC, USDT and WETH since 0.2.0 |
| history <id> | Its mint, owners, signatures, listings and sales, each with its NEAR transaction, from FastNEAR's transaction index. The report doesn't use it (new in 0.2.0) |
| record <id> | The signing record, as the contract returns it |
| market | Every listing, with its report's verdict |
| mint | Mints a satchel for 0.1 NEAR |
| list <id> <price> | Lists it for <price> NEAR. It can't sign anything until it is sold or delisted |
| delist <id> | Takes it off the market |
| buy <id> | Buys it at its listed price, only if its report reads PROVABLY CLEAN |
| transfer <id> <account> | Gives it to another NEAR account |
| send <id> --chain <chain> --to <0x address> --value <amount> [--data <0x calldata>] | Sends from its address on one of the network's EVM chains |
| dao finish <near tx> | For a satchel a Sputnik DAO owns: reads the MPC signature from the receipts of the vote that ran sign_evm, checks the hash and the signer, and broadcasts. Needs no key (new in 0.2.0) |
| Option | |
| --- | --- |
| --network testnet\|mainnet | The NEAR network. Testnet unless you say mainnet |
| --json | Prints JSON, for scripts and bots. Errors print {"error": "…"} |
| --as <account> | The NEAR account that signs. Every sign command needs it |
| --yes | Signs without asking. Needed when there is no terminal to ask in |
| --accept-not-clean | Lets buy go ahead when the report does not read PROVABLY CLEAN |
| --keychain legacy\|os | Where the near CLI keeps the key: ~/.near-credentials (the default) or the OS keychain |
| --near-cli <path> | The near CLI to sign with. Default: $NEAR_CLI, or near in one of your PATH's absolute folders, never the current folder. On Windows, give the path of near.exe: npm's near.cmd can't run without a shell |
A command refuses options that belong to another one, so satchel-nft buy 4 --value 1 is an error,
not a purchase.
Exit codes: 0 done (for verify, clean); 1 the answer is no: not clean, refused, or failed on
chain; 2 it could not run: bad arguments, an RPC for the wrong network, no near CLI, no terminal
to ask in; 3 it sent a transaction but couldn't read what happened to it. On 3, check the
transaction it names (with --json, nearTx or evmTx) before you run the command again.
Signing
The sign commands use the near CLI (near-cli-rs), which keeps your key. This package never reads a key. For each transaction it:
- has the near CLI sign it without sending it (
display), running it by its absolute path, which it shows you; - decodes what the near CLI signed and checks the signer, the receiver, the method, its arguments, the gas and the deposit against what you asked for, and refuses anything else;
- shows you that transaction and asks
Send it? Type yes to send:. Onlyyessends it; anything else, or input that ends, is a no.--yesskips the question; - sends it over RPC and waits until every receipt is final.
Before signing, it also refuses what would fail or lose something: an account from the other network, a satchel you don't own, a contract that doesn't pass its own check, a receiver that doesn't exist, a purchase whose report isn't clean.
Listing satchel #7 on testnet, with its owner's key in ~/.near-credentials. This run passed
--yes, since the shell it ran in had no terminal to ask in; without it, the question comes after
the transaction and before Sending. The output, with the home folder shortened to <you>:
npx satchel-nft list 7 0.5 --as satchel-nft.testnetThe near CLI (C:\Users\<you>\.cargo\bin\near.exe) signed, on NEAR testnet, as satchel-nft.testnet (key ed25519:FqmLsnuhrwC7jFqzHCiNzUcZ6qQ1a23y4jasFJwRpS8w):
v1.satchel-nft.testnet.list({"price":"500000000000000000000000","token_id":"7"})
deposit 1 yoctoNEAR, gas 30 Tgas
Lists satchel #7 for 0.5 NEAR at record version 1.
It can't sign anything until it is sold, delisted or transferred.
Sending 6nsbk52HkRK7KV2SbcauHJxX84jaUm1WFsQMgmMrSSMc…
Listed satchel #7 for 0.5 NEAR: https://testnet.nearblocks.io/txns/6nsbk52HkRK7KV2SbcauHJxX84jaUm1WFsQMgmMrSSMcGit Bash's own window (mintty) can give Node no terminal. If a sign command says there is none to ask in, run it from PowerShell or cmd to be asked.
send builds the EVM transaction, checks that the contract hashes it the same way, has the near CLI
sign sign_evm, checks that the signature from the MPC network recovers to the satchel's address,
and broadcasts it:
npx satchel-nft send 7 --chain sepolia --to 0x000000000000000000000000000000000000dEaD --value 0.0001 --as satchel-nft.testnetOnce the contract has signed, the signature is public in its NEAR receipt, so anyone can broadcast
that transaction. If the broadcast or its receipt fails, send exits 3 with the transaction's hash
and its nonce: check it before you send again, or you may pay twice. Until a transaction at that
nonce is final, the satchel is not clean.
Trust
The report is as honest as the RPCs it reads. The defaults are public nodes, named in every report.
To read from nodes you trust, set NEAR_RPC=<url> and RPC_<chain id>=<url>, like RPC_8453 for
Base. A NEAR RPC that serves the other network stops the run; an EVM RPC that serves another chain
counts as unreadable, so the report can't read clean. A satchel's address comes from no RPC: the
package derives its key from the MPC network's root key, pinned in TESTNET and MAINNET, the
contract and the path, as the MPC contract's derived_public_key view does (0.1.0 still reads that
view through the NEAR RPC). Which satchel is yours, the id mint returns and each satchel's owner,
still comes from the NEAR RPC: before funding much, check the owner on NearBlocks or your own node.
A send's fees and nonce come from the chain's RPC. The prompt shows both before you agree; with
--yes, nothing caps the fees.
What a report can't see, and every attack it is built against, is in the repository's threat model.
Library
import { MAINNET, buildReport } from "satchel-nft";
const report = await buildReport(MAINNET, "1");
if (report?.verdict === "clean") {
// report.listing.record_version is what a purchase must name
}| Export | What it is |
| --- | --- |
| TESTNET, MAINNET, CHAINS | Each network's contract, MPC contract and its root key (new in 0.2.0), NEAR RPC and reproducible build; the 16 EVM chains |
| buildReport(net, id) | The clean transfer report for one satchel, or null if there is none |
| contractFacts(net) | The deployment's own facts, to share across many reports |
| satchel(net) | Reads: get, tokensFor, listings (one page, which can be short with more after it), allListings (every live listing; new in 0.2.0), totalSupply, mpcContract, signingHash |
| satchelTx(net) | Transactions in the near-connect and wallet-selector format: mint, list, delist, buy, transfer, signEvm |
| tokenAddress(net, path) | A satchel's EVM address: the key the MPC network derives for it, computed from the pinned root key without a read (since 0.2.0; 0.1.0 reads it from the MPC contract) |
| deriveMpcKey(rootKey, predecessor, path) | The key the MPC network holds for path when predecessor asks, as derived_public_key returns it (new in 0.2.0) |
| sendFromSatchel(request, deps) | The send flow, with each step's check, for any wallet you pass in deps |
| assertDeployment(net), assertReceiver(net, account) | The checks the app and the CLI run before signing |
| checkHolder(net, proof), roomMessage(net, id, account, issuedAt) | The holder room's gate: whether a signed NEP-413 proof comes from a full-access key of the account that owns the satchel at a final NEAR block, and the message it must sign (new in 0.2.0) |
| verifyNep413(signed), nep413Hash(payload) | NEP-413 message signatures: the hash a wallet signs, and a strict ed25519 check of one (new in 0.2.0) |
| handoverKit(report) | What to do before selling a satchel, one step per check of its report that doesn't pass. Its commands pin [email protected], which has each of them (new in 0.2.0; 0.3.0 pins @0.2.0, and 0.2.0 @0.1.0) |
| contents(net, address), chainContents(chain, address), TOKENS | What an address holds on the network's EVM chains: the native coin, and USDC, USDT and WETH at their listed addresses. Display only: the report doesn't read it (new in 0.2.0) |
| tokenHistory(net, id), describeEntry(entry) | A satchel's mint, owners, signatures, listings and sales, from FastNEAR's transaction index, and one line for each. Display only (new in 0.2.0) |
| daoProposal(net), daoVote(id, kind), sputnikDao(net, dao), nonceClash(…) | A Sputnik DAO's add_proposal arguments for sign_evm and nft_transfer, its act_proposal arguments, its reads, and the open proposal that already signs a nonce (new in 0.2.0; version, config, recentProposals and the bounty reads are new in 0.3.0) |
| signatureFromReceipts(net, tx), finishSignEvm(net, nearTx, deps) | The MPC signature in a transaction's receipts, and the dao finish flow (new in 0.2.0) |
| fixPlan(inputs), readFixInputs(report, record), revokeCalldata | Make it clean: the sends of 0 from the satchel that would make its report read clean, a revoke for each live approval and a send to its own address for each open nonce, and what each costs in approval slots. fixPlan reads nothing; readFixInputs reads each chain's latest block (new in 0.3.0) |
| accountTransactions(net, accountId, maxTransactions?) | Any account's transactions from FastNEAR's transaction index, newest first; a read the index rate-limits is sent again (new in 0.3.0) |
What changed in 0.3.1
A patch. The only code change is the version in the commands the package prints.
- This README lists the library as it is. 0.3.0's README named
indexPost, which the package doesn't export, and only three of the eight new Sputnik DAO reads. The library table now givesaccountTransactions(net, accountId, maxTransactions?), and "What changed in 0.3.0" names all eight:version,config,recentProposals,lastBountyId,bounties,allBounties,bountyClaimsandbountyClaimCount. - The commands it prints pin
[email protected], where 0.3.0's pinned@0.2.0: the handover kit's, and the terminal command infixPlan's note for a chain with more open nonces than the app sends one by one. 0.3.0 is the release the docs pin, and itsverifyprints satchel #9's approval and revoke as one line, as the app does.
What changed in 0.3.0
- Make it clean, in the library.
fixPlanturns a report that doesn't pass into the sends that fix it: a revoke for each approval still live (revokeCalldatabuilds the call) and a send of 0 to the satchel's own address for each open nonce, with what each costs in approval slots.readFixInputsreads what it needs. satchelnft.xyz's Make it clean card runs on them, and they cleaned testnet satchel #9 on 2026-11-12. - Check 3 joins rows that read the same. Approval rows that name the same chain, contract,
token and spender and read the same share one line, ending "(N record rows)". 0.2.0 printed
satchel #9's approval and its revoke as two identical lines. Every row still counts toward the
verdict, and
chainskeeps one entry per row. historyreads through a busy index. A request FastNEAR's transaction index answers with 408, 429 or 5xx, or doesn't answer, is sent again, up to 5 sends, waiting as its Retry-After asks, up to 8 s. A revoke,approve(spender, 0), reads "a revoke (approve of 0)", where 0.2.0 said "an approval".- The handover kit pins
[email protected](0.2.0 pinned 0.1.0) and points at the app's Make it clean card for each revoke and nonce spend. - New in the library:
fixPlan,readFixInputs,revokeCalldata,accountTransactions, and the Sputnik DAO readsversion,config,recentProposals,lastBountyId,bounties,allBounties,bountyClaimsandbountyClaimCount.
What changed in 0.2.0
- New commands:
history <id>prints a satchel's timeline.dao finish <near tx>broadcasts what a Sputnik DAO's vote had a satchel sign.showalso lists USDC, USDT and WETH, and each balance in its--jsonhas atokensarray. marketlists every live listing. 0.1.0 stopped at the first page that came back under 100 rows, so it could miss listings once the contract held more than 100, stale ones included.- A satchel's address comes from no RPC.
tokenAddressderives the key from the MPC network's root key pinned inTESTNETandMAINNET; 0.1.0 read it from the MPC contract through the NEAR RPC. Same addresses: the tests check testnet satchels #1 to #8 and mainnet #1 against what the MPC contract returned. - New in the library: the holder room's gate (
checkHolder,roomMessage,verifyNep413), the handover kit, what an address holds, a satchel's history, Sputnik DAO helpers andsatchel(net).allListings(). The pending and approvals checks list each chain's status inchains. Lower-level helpers are exported too, among themformatAmount,rpcFor,viewAt,accessKeyAt,finalBlockandNEAR_ARCHIVAL_RPC, andnearRpctakes an optionalAbortSignaland RPC URL. - If you build your own
Network: it now needsmpcRootKeyandtxApi. SpreadingTESTNETorMAINNETkeeps them.tokenAddressderives frommpcRootKeyandcontract, not frommpc, so aNetworkthat pointsmpcat another MPC contract needs that contract's root key too. - A pipe that closes early no longer crashes the command. In 0.1.0,
satchel-nft show --network mainnet 1 | trueprinted an EPIPE stack trace and exited 1, andverify --bogus 2>&1 | trueexited 1 instead of 2. Now the printing stops, on stdout and stderr, and the command keeps its own exit code: those exit 0 and 2, andverify 5 | truestill exits 1. In bash,${PIPESTATUS[0]}holds the command's code;$?holds the reader's. - New dependencies:
@noble/curvesand@noble/hashes, for the key derivation and NEP-413.
Links
- App: satchelnft.xyz
- Repository, contract and every claim with the command that checks it: github.com/duongnq2798/satchel
- License: MIT
