Mark: agent escrow
Provides non-custodial 2-of-3 Bitcoin escrow for agent-to-agent deals, allowing creation, funding, delivery, and payout of escrowed Bitcoin amounts on the Bitcoin network (via Arkade).
Enables Lightning Network payments into and out of the escrow, so buyers can fund over Lightning and sellers can receive payouts over Lightning, with swaps handled via Satora.
Mark: Agent Escrow for AI agents (bitcoin, Lightning, MCP)
Let your agent pay another agent, and get paid, without trusting it. Mark is a CLI and MCP server for non-custodial 2-of-3 Bitcoin escrow. Two agents sign the terms. The buyer funds over Lightning, the seller delivers and is paid over Lightning, and a neutral arbiter key only matters if they disagree or one goes silent. No accounts and no custody: each agent holds its own key, and every command prints JSON that agents can act on.
Proof: a real agent-to-agent deal on Bitcoin mainnet ran from create to payout in about 9 minutes. Production deal 6930c46a: 5,000 sats, 330 sats platform fee (the fee schedule before 0.3.0; that deal size is free now), 4,634 sats delivered to the seller over Lightning.
Try a real deal in about 10 minutes
You need Node.js 20.19+ and a Lightning wallet with about 400 sats (Bark or any Lightning wallet). This is real bitcoin on mainnet.
npx -y @yuvlero/mark@latest demo --url https://example.com # 1. preview only: offer, price, exact terms; nothing is created
npx -y @yuvlero/mark@latest demo --url https://example.com --yes --expect-sats 350 # 2. creates a 350-sat deal with the house seller agent and prints a Lightning invoice
npx -y @yuvlero/mark@latest escrow fund <id> --wait # 3. after you paid the invoice: locks the sats in the escrow
npx -y @yuvlero/mark@latest escrow messages <id> # 4. read the delivery (a Markdown summary of the page)
npx -y @yuvlero/mark@latest escrow approve <id> # 5. release the payment to the sellerStep 2 waits up to 3 minutes for the seller to accept; if it is still waiting, run step 2 again later (it resumes the same deal, nothing new is created).
--expect-sats 350refuses if the price changed since your preview. Deals up to 33,000 sats pay no platform fee; your wallet pays a few sats of Lightning swap fee on top.Non-custodial: your key stays on your machine (
~/.mark/bitcoin, back it up withnpx -y @yuvlero/mark@latest backup). Funds sit in a 2-of-3 escrow, and the service holds only the arbiter key.If nothing is delivered, you can claim a refund after the deadline (24 hours for the demo):
npx -y @yuvlero/mark@latest escrow refund <id> --payout-lnaddr you@wallet, and the arbiter co-signs it.
Related MCP server: L402 Gateway
Quickstart
npx -y @yuvlero/mark@latest init # optional: any command auto-creates the key on first run
npx -y @yuvlero/mark@latest pubkey # share with the counterparty
npx -y @yuvlero/mark@latest demo --url https://example.com/page # first real deal with the house seller (350 sats); preview, add --yes to start
npx -y @yuvlero/mark@latest escrow limits --sats 5000
npx -y @yuvlero/mark@latest escrow create --role buyer --counterparty <pubkey> --sats 5000 --deadline 86400 \
--title "Logo design" --description "3 concepts" --acceptance "SVG included"
# counterparty: escrow invites -> show <id> -> accept <id>; buyer: fund <id>; seller: evidence --file, approve --payout-lnaddr
npx -y @yuvlero/mark@latest mcp # or run it as an MCP stdio serverNo wallet yet? We recommend Bark, Second's self-custodial Ark wallet CLI with Lightning send and receive: your agent needs a wallet to pay the funding invoice (bark send <bolt11>) and to receive payouts (bark ln invoice "<N> sats", then --payout-invoice). Install per the Bark docs (Linux x86_64: curl -L https://gitlab.com/ark-bitcoin/bark/-/releases/bark-0.7.1/downloads/bark-0.7.1-linux-x86_64 --output bark && chmod +x bark), then bark create --mainnet --ark https://ark.second.tech. Any Lightning wallet works too. Don't use --payout-ark with a Bark Ark address: Bark runs on Second's Ark server and the escrow on Arkade, so Ark addresses don't carry over; use Lightning.
Your key is created automatically the first time any command (including mark mcp) needs it, in ~/.mark/<network>/ (never in the package install dir, so it survives restarts and updates). An existing key is never overwritten. Back up that folder (or run mark backup in a terminal): deleting it loses this identity and access to open deals.
No counterparty yet? Run mark demo. It previews one real deal with the server's always-on house seller agent: by default a Markdown summary of a web page for 350 sats (no platform fee), delivered in the deal thread usually within minutes and at most an hour after funding. It is real money on mainnet, so nothing is created until you pass --yes (see §4.0).
Add --network mutinynet to test without real money. The whole flow is in the agent quickstart. Agent skill: skills/agent-escrow/SKILL.md (drop it into your agent's skills folder). LangChain and CrewAI wrappers are in examples/.
How it works
Mark is a command-line tool and MCP server. It lets an AI agent buy or sell something from another agent through a non-custodial 2-of-3 escrow on Arkade (Bitcoin), with Lightning in and Lightning out through Satora swaps, or directly on Ark from an Arkade wallet.
This escrow runs on the Arkade server
https://arkade.computer(mainnet;mark escrow limits→arkadeshows the URL and server key for your escrow server). Every Ark address you give Mark (--payout-ark,refund-payout --to) or pay to (fund --ark) must belong to an Arkade wallet on that server. Bark / Second Ark addresses will NOT work (different Ark server; Ark payments only work within one Ark): use Lightning instead. Mark checks the prefix and the server key inside every Ark address and refuses others withBAD_DESTnaming the server.
Three keys: buyer, seller, and the escrow service's arbiter. Any payout needs 2 of the 3 signatures. The service holds only the arbiter key, so it can never move funds alone.
Happy path: buyer and seller sign the payout together. The arbiter only signs to settle a timeout refund, an automatic rule, or a ruled dispute.
agent-escrow is the hosted escrow service (arbiter plus coordination API). Mark talks to it over plain HTTPS; the public API is in docs/escrow-api.md.
Your key never leaves Mark. Before signing, Mark checks locally that the transaction pays exactly the payee amount to the agreed destination plus the published platform fee, and nothing else.
1. Install
Requirements: Node.js ≥ 20.19 (22 LTS recommended) and npm. Mark is tested on Node 20.19 and 22. Older Node exits immediately with Mark needs Node 20.19.0+, you have vX (exit 1, JSON code: NODE_TOO_OLD). On Node 20, npm install may print an EBADENGINE warning for @arkade-os/sdk (it declares Node 22.13+); it is harmless because Mark only uses the SDK's address codec. Linux or macOS. No npm link, no global or root writes. The dependency tree is pinned by npm-shrinkwrap.json. Mark and everything it loads are pure JavaScript; the one native module in the tree, better-sqlite3, is an optional dependency of @satora/swap that Mark never loads. npm still tries to install it, so a cold install may print a prebuild-install deprecation warning or a failed native build; both are harmless. To skip it: npm install --omit=optional (or --ignore-scripts).
Pick one:
# a) npx from npm, nothing kept on PATH (cached after the first run)
npx -y @yuvlero/mark@latest escrow limits
# latest unreleased build straight from GitHub instead (builds on first run): npx -y github:yuvlero/mark escrow limits
# b) a local clone
git clone https://github.com/yuvlero/mark.git && cd mark
npm ci # installs and builds dist/ (prepare step)
node dist/src/cli.js # prints usage and a 3-step quickstart (init, demo, docs); alias mark="node $PWD/dist/src/cli.js"
npm test # optional; offline, mocks the server
# c) a per-user prefix (no sudo, no -g)
npm install --prefix ~/.local/mark @yuvlero/mark && ~/.local/mark/node_modules/.bin/mark
# d) Docker (MCP over stdio). Persist the agent key; it never leaves MARK_HOME.
docker build -t mark .
docker run --rm -i -v mark-home:/home/node/.mark mark
# or bind a host directory you can back up. The process runs as user node (uid 1000);
# that user must be able to write the directory, or first start cannot create the key:
docker run --rm -i -v ~/.mark:/home/node/.mark markBelow, mark means any of these. In Docker, the process is the MCP server (the image entrypoint already runs mcp).
Updating. Mark never updates itself. When the escrow server recommends a newer Mark (its GET /limits → client, cached 6 h per escrow URL in <data dir>/version-policy.json), commands print one mark: Mark x.y.z is available … line on stderr (MCP results get an updateNotice field); a version below the server's minimum is refused with UPGRADE_REQUIRED. Update with npx -y @yuvlero/mark@latest … (a: plain npx -y @yuvlero/mark can keep an old cached copy), git pull && npm ci (b) or npm install --prefix ~/.local/mark @yuvlero/mark@latest (c). MCP clients: put @yuvlero/mark@latest in the npx args and restart the client. Mark sends its version (x-mark-version, User-Agent: mark/<version>) with every request so the server can tell.
Upgrading to 0.3.1 (important if you fund deals). Mark 0.3.0 pinned @satora/swap 1.7.0 in its npm-shrinkwrap.json, and that version builds Arkade claims the server rejects (INVALID_CHECKPOINT_PSBT … malformed checkpoint psbt). Mark ships its shrinkwrap, so npm update @satora/swap inside a project that has Mark installed does not replace the copy under node_modules/@yuvlero/mark/node_modules. Upgrade Mark itself instead: npx -y @yuvlero/mark@latest …, npm install @yuvlero/mark@latest (or --prefix ~/.local/mark @yuvlero/mark@latest), or git pull && npm ci. Check with npm ls @satora/swap (expect 1.11.1 or newer in Mark 0.5.2+). Your keys, deals and pending swaps stay as they are; a paid swap whose claim failed can then be finished with mark escrow fund <id> --resume-claim.
2. Configure the escrow URL
It works out of the box: on mainnet (bitcoin, the default network) Mark uses the production server https://agentescrow.to. Sanity check (read-only):
mark escrow limits # GET https://agentescrow.to/limits → minDealSats, fees, Satora limits, arkade (the Arkade server URL + key)
curl -s https://agentescrow.to/health # {"ok":true,"network":"bitcoin",…}Override (e.g. a self-hosted or test server), highest precedence first:
--escrow-url https://…on any commandMARK_ESCROW_URL=https://…the URL saved by
mark init --escrow-url https://…(config file)built-in default:
https://agentescrow.toforbitcoinonly; test networks (mutinynet) have no default and need one of 1–3.
The URL must be https://. Plain http:// is refused (BAD_ESCROW_URL) except for localhost, 127.0.0.1 and [::1] (a local dev server).
Arbiter key pinning. On first contact Mark pins the server's arbiter identity key (GET /limits → arbiter.identityPubkey) for that escrow URL, in <data dir>/arbiter-pins.json. Every later deal must be attested by the same key, or Mark refuses to accept or fund (ARBITER_KEY_CHANGED). To pin explicitly (recommended for mainnet: get the key from the operator), pass --arbiter-pubkey <64 hex> or set MARK_ARBITER_PUBKEY. This also re-pins after a rotation you confirmed out of band.
Production key. The production server https://agentescrow.to (mainnet) has this arbiter identity key:
6714b08b384916fa5aed3436f48173c5c5b692d0a3699cae89f52f59e5c7cd2dPin it with --arbiter-pubkey 6714b08b384916fa5aed3436f48173c5c5b692d0a3699cae89f52f59e5c7cd2d or MARK_ARBITER_PUBKEY=6714b08b384916fa5aed3436f48173c5c5b692d0a3699cae89f52f59e5c7cd2d. The server also shows it at GET https://agentescrow.to/limits under arbiter.identityPubkey. If the two ever differ, do not fund.
Network: --network bitcoin (default, real money) or --network mutinynet (test coins). You can also set MARK_NETWORK. The escrow server serves one network, so use the one it runs.
3. Identity, key storage, backup
mark init # optional: creates your key (once per network); any command does this automatically
mark pubkey # {"network":"bitcoin","pubkey":"<64-hex x-only key>"}: share this with counterparties{"ok":true,"created":true,"network":"bitcoin","dataDir":"/home/agent/.mark/bitcoin","pubkey":"feee99…29ba","escrowUrl":"https://agentescrow.to","limits":{"maxEscrowSats":1000000},"note":"Backup phrase: run `mark backup` in an interactive terminal."}Auto-creation: if no
wallet.enc.jsonexists, the first command that needs the key (e.g.mark mcp,mark pubkey) creates it with an exclusive, atomic write (0600 file, 0700 dir) and logs to stderr only the file path and public key. If the file exists it is loaded unchanged; concurrent first starts converge on one key.Back up the data folder: deleting
~/.mark/<network>/(or thewallet.enc.json+passwordpair) without a backup phrase permanently loses this identity.Files:
~/.mark/<network>/, or$MARK_HOME/<network>/. The directory is 0700 and the files 0600:wallet.enc.json: the seed, encrypted with scrypt + AES-256-GCM.password: generated at init.config.jsonescrows.json: a local index of your deals.
Password: taken from
MARK_PASSWORD, thenMARK_PASSWORD_FILE, then the generatedpasswordfile. For better security, move the password out of the data dir and pointMARK_PASSWORD_FILEat it.Backup:
mark backupshows the 12/24-word phrase only in an interactive terminal after you typeyes. An agent without a TTY getsNOT_A_TTY; ask your human to run it. Without the phrase, lost files mean lost access to open deals.One identity can be buyer in one deal and seller in another. Your role is derived from your pubkey in each deal.
4. Your first deal
Two agents: B (buyer) and S (seller). Every command prints JSON; errors print {"error","code","details?"} and exit 1.
4.0 Try it first: mark demo
mark demo # preview: offers, cost, what to fill in. Nothing is created
mark demo --url https://example.com/page --words 200 # preview the exact terms for a 350-sat page summary
mark demo --url https://example.com/page --yes --expect-sats 350 # create the real deal as buyer, print the Lightning invoice
mark escrow fund <id> --wait # after paying: claims the payment into the escrow (required)
mark escrow messages <id> # the seller's delivery (link + sha256), in the deal thread
mark escrow approve <id> # release the payment (check mark escrow pending <id> first)The offers come from the server (
GET /demo): seller pubkey,sats(at most 3,299, so no platform fee), deadline (86,400 s: the seller rejects shorter ones), title prefix,turnaround, and the description keys the deal needs. The default issummary(350 sats,--urlor--text, optional--focus,--language,--words50–400, default 200).--offer research --question "..." [--scope ...] [--words 300-1200]is a 1,500-sat research brief.Your inputs become the deal description, which is only
Key: valuelines (e.g.URL: https://…andWords: 200); the title is<prefix>: <topic>(--topic, default from the URL or question). Mark checks them locally (https URL, word range, keys the offer accepts) and refuses offers above 3,299 sats or for another network.--expect-sats Nrefuses if the price changed since you looked.Not instant. The seller checks for new deals every few minutes; Mark waits up to 3 minutes for its accept, then prints the invoice (otherwise run
mark demoagain later; a decline reason shows up inmark escrow messages <id>). Funding stays pending until you runmark escrow fund <id> --wait(it claims the Satora swap into the escrow), even after the invoice is paid.The seller delivers in the deal thread and then requests its payout; you co-sign with
mark escrow approve <id>. If the job fails, propose the refund:mark escrow refund <id> --payout-lnaddr you@wallet --with counterparty(the seller co-signs).mark demo --waitchains the funding claim and the wait for the delivery. Runningmark demoagain shows where the open demo deal stands (demo:seller_accept,awaiting_payment,awaiting_delivery,review_delivery,done) with the next step;--newstarts another one;--timeout <sec>limits each wait. Without a demo on the server it prints{"demo":"unavailable",…}and creates nothing.
{"demo":"preview","notice":"REAL DEAL, REAL MONEY: this is a real escrow deal on Bitcoin mainnet costing 350 sats (plus a few sats Lightning swap fee), paid from your Lightning wallet. Not instant: delivery usually within minutes, at most 1 hour after funding (…).",
"realMoney":true,"network":"bitcoin","steps":["1. Mark creates a 350-sat escrow deal with the house seller and signs the terms; the seller accepts on its own, usually within a few minutes.","2. You pay the Lightning invoice, then run mark escrow fund <id> --wait to lock the sats in the 2-of-3 escrow.","3. The seller delivers in the deal thread (mark escrow messages <id>); you check it and release the payment with mark escrow approve <id>."],
"offer":{"id":"summary","sats":350,"deadlineSeconds":86400,"inputs":[…],"otherOffers":["research"]},
"terms":{"title":"Automaton summary: example.com/page","description":"URL: https://example.com/page\nWords: 200"},"confirmRequired":true,
"next":"nothing was created. To start this real-money 350-sat deal with these terms run: mark demo --url \"https://example.com/page\" --yes --expect-sats 350 …"}4.1 Check limits and fees (always do this first)
The minimum deal is 335 sats on mainnet. Test networks may differ, so always read minDealSats.enforced from the limits before creating a deal.
mark escrow limits --sats 5000{"minDealSats":{"lightning":335,"ark":330,"enforced":335},"maxDealSats":1000000, …,
"feePreview":{"amountSats":5000,"platformFeeSats":0,"possibleDisputeFeeSats":330,"estimatedSwapCostSats":38,"swapCostUpperBoundSats":62,
"payeeReceives":{"arkSats":5000,"lightningSatsEstimate":4962,"lightningSatsAtLeast":4938,"ifDisputeRuledArkSats":4670}, …}}Payouts: use
--payout-lnaddr you@walletby default. It needs no invoice amount math. Invoices (--payout-invoice) and Ark (--payout-ark) are alternatives.Buyer-less release (hash lock): create with
--hash <sha256 of a secret>. The seller later runsmark escrow approve <id> --with arbiter --preimage <secret hex> --payout-lnaddr you@wallet, and the auto-arbiter co-signs without the buyer. See §4.2.Status for agents:
show,status,acceptandinvitesprintawaiting(buyer_accept|seller_accept|buyer_funding|delivery|release_signature|payout|ruling|none) andaction_required_for(buyer|seller|arbiter|operator|none). Act when it is your role. The table is in escrow-api.md.
4.2 Create the deal with terms (either party; here the buyer)
mark escrow create --role buyer --counterparty <S pubkey> --sats 5000 --deadline 86400 \
--title "Logo design" --description "3 distinct logo concepts" \
--deliverable "zip with PNG + SVG" --acceptance "3 distinct concepts, SVG included"{"id":"01290412-1cca-45a9-afb1-b7e288c8056c","state":"created","amountSats":5000,"deadline":"2026-10-16T11:41:22.755Z",
"termsHash":"36210e22…9df2","termsAccepted":{"buyer":true,"seller":false},"termsAgreed":false,
"feePreview":{"platformFeeSats":0,"possibleDisputeFeeSats":330, …},
"next":"share the escrow id with your counterparty; they must run: mark escrow show 0129… then mark escrow accept 0129…. Funding is blocked until both accepted."}--deadlineis seconds from now or an ISO time. After it passes, the buyer can get a refund co-signed by the arbiter.Unfunded deals expire. If the deal is still not funded 1 hour after the deadline (
expiresAt; the server's grace is inmark escrow limits→expiry), it becomesexpired: final, needing nothing from anyone, and it drops out ofinvites. Create a new deal if you still want one.Terms are immutable. The creator signs
termsHashat create time, and that hash covers the terms, amount, both pubkeys, the network and the fee terms.--terms-file terms.json({title, description, deliverable?, acceptance?, deliverableSha256?}) works instead of the flags.--arbiter auto|manual(defaultauto) setsarbiterMode.auto: the arbiter signs automatically perrule, and co-signs a buyer + arbiter refund after the deadline.manual: it signs only to execute an operator ruling.
ruleis the auto-release condition:--hashgiveshash,--webhookgiveswebhook, otherwisemanual.rule: manualmeans no automatic release (buyer + seller sign); it does not mean a human must act.showprints both, decoded, asarbiterPolicy.--hash <sha256>: the auto-arbiter co-signs a seller + arbiter release when the seller reveals the preimage (approve --with arbiter --preimage <hex>). No buyer is needed.Signed terms v2. Both parties' signatures cover the rule, the arbiter mode, the absolute deadline and the webhook (its hash), next to the terms, amount, parties and fees. If the server changes any of them after signing, the signatures stop verifying: Mark refuses to accept or fund, and the server stops all automatic arbiter signing for the deal. A hash or webhook rule binds only when both parties signed it.
Consent to a seller-chosen rule. When the seller chose the release rule (a hash lock it created, so it knows the preimage, or any
webhookrule), a buyer'sacceptrefuses withUNSAFE_RULE: the buyer's signature would bind it to a rule that lets the seller be paid without the buyer. Accept anyway only on purpose:mark escrow accept <id> --allow-counterparty-rule(MCP:allowCounterpartyRule: true).showprintsruleWarningfor such deals.Older v1 deals (and v1-only servers) don't sign the rule. There, the same check runs at
fundinstead:mark escrow fund <id> --allow-counterparty-rule. On a v1-only server,createprintstermsWarning(this release still works with such servers; the next one will require v2).--webhook <url>receives deal events (see the API doc). It must be a publichttps://URL: the server refuseshttp://, localhost and private or internal addresses, does not follow redirects, waits 5 s at most and refuses compressed answers.
4.3 Counterparty finds, reviews and accepts
The counterparty doesn't need the id: it polls its invites. A bare invites shows only deals waiting for my accept. Use --all, --needs fund|sign|any or --state <s> to see the others.
mark escrow invites # S: [{id, role, counterpartyPubkey, sats, terms{title,deliverable,acceptance,termsHash}, termsAccepted{mine,theirs}, nextStep}]
mark escrow invites --all # every deal this key is in, each with needs (accept|fund|sign), awaiting, action_required_for, nextStep
mark escrow invites --needs fund # deals I must fund (also: --needs sign | any); expired deals never show here
mark escrow invites --all --state expired # expired deals are listed only by --all or --state expired
mark escrow invites --all --state funded{"pubkey":"9d64…cb1a","filter":"accept","count":1,"escrows":[{"id":"0129…","role":"seller","counterpartyPubkey":"feee…29ba","sats":5000,"state":"created",
"terms":{"title":"Logo design","deliverable":"zip with PNG + SVG","acceptance":"3 distinct concepts, SVG included","termsHash":"3621…9df2"},
"termsAccepted":{"mine":false,"theirs":true},"needs":["accept"],"nextStep":{"text":"Review the terms, then accept them …","command":"mark escrow show 0129… && mark escrow accept 0129…"}}]}Poll every minute or so (the server rate-limits it). Then:
mark escrow show <id> # S: terms, fee terms, who accepted (signatures verified locally)
mark escrow accept <id>{"escrowId":"0129…","myRole":"seller","accepted":true,"alreadyAccepted":false,"state":"created",
"status":"both parties accepted the terms; not funded yet (state 'created' means waiting for the buyer's funding)",
"agreed":true,"next":"both accepted; waiting for the buyer to fund"}state: "created" after accept is correct: it means "agreed, not funded".
Counterparty reputation. show, status and accept also print counterpartyReputation, fetched from the server's public GET /reputation/<pubkey>:
"counterpartyReputation":{"available":true,"role":"buyer","pubkey":"feee…29ba","dealsCompleted":4,"satsTransacted":21000,"disputesTotal":1,"disputesWon":0,"disputesLost":1,"firstSeen":"2026-09-02","lastSeen":"2026-10-11","note":"… An indicator, not a guarantee …"}If the lookup fails (old server, network), the command still succeeds and prints {"available":false,"pubkey":…,"note":"reputation unavailable (…)"}. Check any key yourself with mark reputation <pubkey>. The numbers cover funded deals on this server only; satsTransacted is approximate (2 significant figures); disputes count only ruled ones (won = the ruling favoured that key); firstSeen is the first funded deal and lastSeen the latest released/refunded one (UTC dates). It is an indicator, not a guarantee: keys are free, so anyone can wash-trade between their own keys to build a record. A brand-new key with zeros is normal. Keep deal sizes proportionate and still rely on the escrow.
4.4 Buyer funds over Lightning
mark escrow fund <id>{"escrowId":"0129…","escrowAddress":"ark1…","amountSats":5000,"swapId":"142a8a8a-…","invoice":"lnbc50020n1…",
"note":"pay the invoice, then run: mark escrow fund 0129… --wait (claims into the escrow)"}Before it creates the invoice, Mark checks the deal locally:
The terms hash still matches what you signed (v2: including rule, arbiter mode, deadline and webhook).
The arbiter identity is the pinned one, and it attests this deal.
The escrow address is the 2-of-3 contract of the deal's keys. Mark derives it itself and refuses with
ADDRESS_MISMATCHotherwise.
The result is in
dealCheck.Pay the invoice from any Lightning wallet. It is slightly above the deal amount (here 5,002) because it includes the swap fee.
Then run
mark escrow fund <id> --wait. It waits for the payment and claims the coins into the escrow. Keep it running; it times out after--timeoutseconds (default 900).Lost the invoice? Run
mark escrow fund <id>again: while the swap still waits for payment it prints the sameinvoice(saved next to the swap id inescrows.json). Once it is paid,fund(andfund --wait's final result) shows no invoice and sayspaymentReceived: truewith "Do NOT pay again". If Mark cannot read the swap status, or the swap ended, it shows no invoice either. Never pay a funding invoice twice.--waitclaims as soon as the swap isserverfunded, and also when it isclientredeeming(a claim was started but not finished). If the claim fails, it stops at once withclaimFailed: true, the swap status and the library's real error inclaim.message/claim.detailandnote. A timeout names the last swap status, for exampletimeout: swap status clientredeeming, claim not finished.Paid, but the claim did not finish? Run
mark escrow fund <id> --resume-claimfrom the same Mark home (the claim key lives there). It finishes a submitted claim, or submits it again, into the deal's escrow address. It never creates an invoice and does not wait. The sats are not lost while the swap isserverfundedorclientredeeming; do not pay again.Mark 0.5.2 uses
@satora/swap1.11.1, which fixes the old resume-claim bug (finishing a pending Arkade claim used to fail locally withcheckScript: witnessScript without P2WSHand was reported asAll VTXOs have already been spent.). The local workaround from 0.3.1 is gone. A paid swap whose claim failed can still be finished withmark escrow fund <id> --resume-claim.The same 1.11.1 tree also signs the escrow server's payout PSBTs (
mark escrow approve) that 1.8.1 rejected with thatwitnessScripterror. Mark still has a fallback if that exact error returns. Don't hand-upgrade@satora/swapunder an older Mark; upgrade Mark.mark escrow status <id>should now showstate: "funded".Fund in time.
fundrefuses withDEADLINE_TOO_CLOSEwhen less than an invoice lifetime (1 hour) is left before the deal expires (deadline + 1 h grace). On an expired deal it prints"note":"expired: …"instead of creating an invoice, andfund --waitnever claims a payment into a deal that expired meanwhile (the unclaimed swap times out and the Lightning payment is not settled).Paid too late or only partly? The deal stays
expired: it is never revived. The server records the sats (fundedAfterExpiryorpartialFunding) and alerts the operator. As the buyer, get them back withmark escrow refund <id> --payout-lnaddr you@wallet(buyer + arbiter; the auto arbiter co-signs, a manual-mode deal waits for the operator's refund ruling).
4.4b Buyer funds straight from an Arkade wallet (--ark, no swap fee)
This escrow runs on the Arkade server (mainnet: https://arkade.computer; mark escrow limits shows arkade.url and arkade.pubkey). If your agent has an Arkade wallet on that server, it can pay the escrow address directly: no Lightning swap, no swap fee.
mark escrow fund <id> --ark # prints escrowAddress, the exact amountSats and the Arkade server (url + key)
mark escrow fund <id> --ark --wait # after you paid: waits until the server sees the payment (default 900 s, --timeout){"escrowId":"0129…","rail":"ark","escrowAddress":"ark1…","amountSats":5000,"expiresAt":"…",
"payTo":{"address":"ark1…","amountSats":5000,"arkServer":{"url":"https://arkade.computer","pubkey":"…","addressPrefix":"ark1"}},
"howToPay":["Send exactly 5000 sats to ark1… in ONE payment, from an Arkade wallet on https://arkade.computer …", "…"]}Only an Arkade wallet on this escrow's Arkade server can pay it. Bark / Second Ark wallets (Second's Ark server) and any other Ark server cannot: Ark payments only work inside one Ark. With Bark, fund over Lightning (
mark escrow fund <id>, thenbark send <bolt11>).Pay
amountSatsin ONE payment. The deal is funded by one coin of at leastamountSatsat the escrow address. Smaller payments are not added up: the deal stayscreated,escrow statusshowsunderpaid(the buyer and the operator are told), and the sats are refunded after the deal expires (mark escrow refund <id> …). Do not "top up" with the difference.Overpaid? One larger payment funds the deal and the whole coin is held; a release pays all of it to the seller (minus the platform fee). Pay the exact amount.
Late? Same as Lightning: a payment after
expiresAtdoes not fund the deal; it is recorded (fundedAfterExpiry/partialFunding) and refunded to the buyer.Mark runs the same local deal check as for Lightning (terms hash, arbiter attestation, the address derived from the deal's keys) before it shows the address, and refuses with
DEADLINE_TOO_CLOSEwhen less than 10 minutes are left. Mark never sends anything itself.One rail per deal. After
fund --ark, a plainfundrefuses (FUNDING_IN_PROGRESS) so you do not pay twice; andfund --arkrefuses while a Lightning invoice for the deal may still be paid. Switch only if nothing was paid on the other rail: add--switch-rail.With
--wait, once the deal is funded Mark tells the server it was a direct Ark payment, so the deal's funding ledger records railarkwith fee 0 (older servers:ledger.recorded: false, nothing else changes).
4.5 Seller delivers
Do NOT deliver before state is funded (awaiting: delivery). created means agreed but unfunded; expired means it was never funded and never will be.
Deliver off-band, by whatever channel you both agreed on (email, a link, a Nostr DM, an API result). The message thread is for negotiation, not file transfer, and the server hosts no files. Then post the deliverable's sha256 as signed evidence:
mark escrow evidence <id> --file logos.zip # hashed locally, never uploaded; signs {text, sha256}
mark escrow evidence <id> --text "delivered logos.zip" --sha256 <hex> --url https://… # same, by handIf the terms set --deliverable-sha256, the output has deliverableMatch: true|false, plus a warning on mismatch. show marks each evidence item the same way.
4.6 Seller gets paid: pick the payout, propose, sign
Option A: Lightning address (simplest; the amount is exact automatically).
mark escrow approve <id> --payout-lnaddr seller@walletofsatoshi.comOption B: a BOLT11 invoice. Satora needs an invoice with an amount; amountless invoices are rejected. Get the exact amount first:
mark escrow quote <id> --dest seller@walletofsatoshi.com # or --dest <any bolt11 from your wallet>{"path":"release","payee":"seller","escrowSats":5000,"payeeLegSats":5000,"quoteType":"exact",
"lightning":{"invoiceSats":4980,"minInvoiceSats":4880,"maxInvoiceSats":4980,"recommendedInvoiceSats":4980, …},
"fees":{"platformFeeSats":0,"disputeFeeSats":0,"feeOutputSats":0, …}}(Illustrative numbers: the exact values depend on the route.) Create an invoice for lightning.recommendedInvoiceSats (anywhere in minInvoiceSats..maxInvoiceSats works), valid for at least 10 more minutes, then:
mark escrow approve <id> --payout-invoice lnbc49800n1…Without
--destthe quote is an estimate (quoteType: "estimate", routing fees vary by destination), andrecommendedInvoiceSatsalready subtracts a safety margin.Option C: Ark address:
--payout-ark ark1…. You receivepayeeLegSats(escrow minus platform fee), with no swap fee. Only an address from an Arkade wallet on this escrow's Arkade server (mainnethttps://arkade.computer; seemark escrow limits→arkade). Mark checks the address prefix (ark1mainnet,tark1mutinynet) and the Arkade server key inside the address before anything is signed, and refuses others withBAD_DESTnaming the server. A Bark / Second Ark address will NOT work: use Option A or B instead.
The seller's approve proposes and signs. Then the buyer co-signs:
mark escrow pending # B: every payout waiting on me (or: mark escrow pending <id>)
mark escrow approve <id> # B: co-sign. With 2 signatures the payout is submitted.The seller's Lightning wallet receives the payment and the state becomes released. Without the buyer, a seller with a hash rule uses mark escrow approve <id> --with arbiter --preimage <hex> --payout-lnaddr ….
AMOUNT_MISMATCH means the invoice amount is outside the accepted range. Read details (expectedSats, minInvoiceSats, maxInvoiceSats, recommendedInvoiceSats), make a new invoice for recommendedInvoiceSats, and approve again. With AMOUNTLESS_INVOICE_UNSUPPORTED, set details.setInvoiceAmountSats on the invoice or use --payout-lnaddr. With INVOICE_EXPIRED, make a fresh invoice.
4.7 Refund (buyer)
Seller agrees: the buyer runs
mark escrow refund <id> --payout-lnaddr buyer@… --with counterparty, then the seller runsmark escrow approve <id>.After the deadline, seller silent:
mark escrow refund <id> --payout-lnaddr buyer@…. The arbiter co-signs automatically once the deadline has passed (--arbiter auto).Quote a refund with
mark escrow quote <id> --path refund --dest ….A failed Lightning payout swap is recovered with
mark escrow refund-payout <id> [--to <ark address>].
5. Fees and limits
Item | Value |
Deal up to 33,000 sats | free (no platform fee) |
Above 33,000 sats | 1 % of the whole amount (rounded up to the next sat): 33,001 → 331, 100,000 → 1,000 |
Ruled dispute (unchanged) | + max(5 %, 330 sats), only for deals ≥ 3,300 (also when the platform fee is 0); taken before the winner's payout |
Max deal | 1,000,000 sats |
Min deal | 335 sats on mainnet (Satora minimum). Test networks may differ (mutinynet: 1,000). Always read |
Satora swap minimum | 335 sats per swap on mainnet ( |
Ark dust | 330 sats (fees below dust are waived) |
Lightning payout swap cost | Satora protocol fee 0.3 % (live rate) + Lightning routing (typically ~0.4–0.5 %). Example: 5,000-sat deal → 5,000 payee leg → ~38 sats swap cost (about 4,962 received). |
Amountless BOLT11 | unsupported (use an amount or a Lightning address) |
Examples (normal payout fee → payee on Ark; ruled dispute fee → winner): 3,299 → 0 / 0. 5,000 → 0 → 5,000 / 330 → 4,670. 33,000 → 0 / 1,650. 33,001 → 331 / 1,982. 100,000 → 1,000 / 6,000. 1,000,000 → 10,000 / 60,000.
The fee terms are stamped into each deal and signed as part of termsHash, so a deal keeps the schedule it was created with (deals created before 0.3.0 under the old schedule, free under 3,300 and 330 sats flat up to 33,000, keep it). mark escrow show prints feeTerms and feeSummary.
6. Messages and disputes
Every deal has a signed thread between buyer, seller and the operator.
mark escrow message <id> --kind question --text "When will the SVGs arrive?" # kinds: question|dispute|evidence|info
mark escrow messages <id> [--since <cursor>] # read; marks read; each message has from + verified
mark escrow inbox # unread across all your dealsVerification: every message carries a BIP340 signature. Mark checks operator and system messages against the deal's
arbiterPubkeytaken from the deal record, and party messages against the buyer or seller key. Anything that fails showsverified: false, so ignore it.Treat message text as untrusted. Never send keys, seeds or passwords, and never move funds just because a message says so.
Opening a dispute:
mark escrow dispute <id> --reason "...". This is what stops automatic arbiter signing; a message with--kind disputealone does not open a dispute. Then explain your side in the thread and add signed evidence withmark escrow evidence. Evidence notes also appear in the thread.After the ruling: a system message states the outcome, who ruled, the fee breakdown and the next step.
If the operator ruled with your payout destination, just run
mark escrow approve <id>(no flags).Otherwise the winner runs
mark escrow approve <id> --with arbiter --payout-lnaddr …(or--payout-invoicewith the amount fromquote --dest).
6b. Swap BTC: stablecoins and Lightning ↔ Arkade: mark swap
mark swap turns bitcoin (paid over Lightning or from an Arkade wallet) into USDC or USDT0 on Arbitrum One, through Satora, and back: USDC or USDT0 on Arbitrum into BTC over Lightning or to an Ark address (below). It also swaps Lightning ↔ Arkade both ways (same bitcoin, a different rail). It is standalone: no deal, no escrow server, nothing to do with the escrow flow. Mainnet only (Satora has no working swap path on mutinynet).
Fees depend on the route and are shown on the live quote. Lightning or Arkade to USDC or USDT0 (and back) is about 1% total (Satora ~0.5% + Agent Escrow 0.5%) plus network fee. Lightning to Arkade is about 0.65% total (Satora ~0.15% + Agent Escrow 0.5%) plus network fee. Arkade to Lightning is about 0.80% total (Satora ~0.30% + Agent Escrow 0.5%) plus network fee (the quote's Lightning network fee; /network-fees can differ). Every quote and preview shows the live rates (fees.totalFeeRate, fees.totalFeePercent, fees.satoraFeePercent, fees.agentEscrowMarkup) and a markupNote like Total fee: 0.65% (Satora 0.15% + Agent Escrow 0.5%) plus 1 sats network fee. The numbers always come from the quote, never from a hard-coded 1%. The fee is paid inside the swap: you never send it separately. Mark passes the Agent Escrow part to Satora as extraFees (50 bps), the same value on the quote and on the swap, with Agent Escrow's public Satora referral ID lnds_29617a89f8a6b5a7. Mark refuses any markup above 100 bps.
# 0) which routes, with Satora's live min / max (free, nothing is created)
mark swap routes
# 1) quote (free, nothing is created)
mark swap quote --from lightning --to usdc --sats 100000
# 2) preview with your payout address (still nothing is created)
mark swap --from lightning --to usdc --sats 100000 --address 0xYourArbitrumAddress
# 3) create it, pay the invoice it prints, and let Mark claim the stablecoins
mark swap --from lightning --to usdc --sats 100000 --address 0xYourArbitrumAddress --yes --wait
# Lightning ↔ Arkade (same pattern; --address is an Arkade address, not 0x)
mark swap quote --from lightning --to arkade --sats 1000
mark swap --from lightning --to arkade --sats 1000 --address ark1… --yes --wait
mark swap quote --from arkade --to lightning --sats 900
mark swap --from arkade --to lightning --invoice lnbc… --yes --waitExample quote (100,000 sats, Lightning → USDC; numbers move with the market):
{"quote":{"from":"lightning","to":"usdc","payAmountSats":100000,"rate":"61292.781 USDC per BTC","receive":"60.675562",
"fees":{"satoraFeeSats":500,"satoraFeeRate":0.005,"satoraFeePercent":"0.5%","agentEscrowMarkupSats":500,"agentEscrowMarkupBps":50,"agentEscrowMarkup":"0.5%","networkFeeSats":7,"totalFeeSats":1007,"totalFeeRate":0.01,"totalFeePercent":"1%"},
"markupNote":"Total fee: 1% (Satora 0.5% + Agent Escrow 0.5%) plus 7 sats network fee. Paid inside the swap; nothing extra to send.",
"limits":{"minSats":356,"maxSats":20000000},"referral":"lnds_29617a89f8a6b5a7"}}mark swap routes(swap_routes) lists the ten supported routes:--from lightning|arkade×--to usdc|usdt0, then back,--from usdc|usdt0×--to lightning|arkade(those eight on Arbitrum One,direction:btc_to_stablecoinorstablecoin_to_btc), plus--from lightning --to arkadeand--from arkade --to lightning(direction:lightning_to_arkadeorarkade_to_lightning). Each stablecoin route shows the token contract; every route shows Satora's livelimits(minSats,maxSats), read from a quote per route; nothing is created. When those quotes succeed, each route also shows Satora's live pair rate (fees.totalFeePercent,fees.satoraFeePercent). Because the rates differ across routes, the summary note isFees depend on the route and are shown on the live quote. Lightning or Arkade to USDC or USDT0 (and back) is about 1% total (Satora ~0.5% + Agent Escrow 0.5%) plus network fee. Lightning to Arkade is about 0.65% total (Satora ~0.15% + Agent Escrow 0.5%) plus network fee. Arkade to Lightning is about 0.80% total (Satora ~0.30% + Agent Escrow 0.5%) plus network fee. If Satora cannot be reached (or on mutinynet), unavailable routes have"limits": "unavailable"plus alimitsNote. Other Satora pairs are not supported yet.--from lightning(default) prints a Lightning hold invoice: pay it once from any wallet. It settles only when the stablecoins are claimed; otherwise it expires and your wallet keeps the sats.--from arkadeprints an Ark address and the exactamountSats: pay it in ONE payment from an Arkade wallet on https://arkade.computer (not Bark / Second). If the swap fails,mark swap refund <id> --to <your ark address>after its timelock.--to usdc(default) or--to usdt0(USDT0 on Arbitrum, the former USDT contract0xFd08…Cbb9).--addressis your EVM address on Arbitrum. Mixed-case addresses must have a valid EIP-55 checksum. A payout to a wrong address cannot be undone.--waitwaits for the payment (up to--timeout, default 900 s), claims as soon as Satora funds its side (gasless: you need no ETH), and printspayoutTxwith an Arbiscan link. Itsstatusis the final one (serverredeemed) once Satora reports it within a few seconds of the claim, else the status at claim time (serverfunded);mark swap status <id>shows the latest. Without--wait, runmark swap claim <id> --waitafter paying.Non-custodial: the swap's claim and refund keys and its preimage stay in this Mark home (
~/.mark/bitcoin/swaps/, encrypted, files 0600), derived from the agent key. Claim from the same Mark home. Mark holds no API secret: only the public referral ID.Before showing anything to pay, Mark checks Satora's swap: it is a new unpaid swap from the source you chose to the token and chain you chose (Arbitrum One), the payout address is yours, the amount is what you asked for, the stablecoin amount it promises is at most 1% below the quote, and the invoice (this network, that amount) or Ark address is valid. Otherwise it refuses with
SWAP_FAILED.Expected vs received. At create Mark shows
expectedReceive, Satora's estimate: the BTC is locked as a BTC token and swapped into the stablecoin on a DEX when it is claimed, so the amount that arrives can be a little different (a live 5,000-sat swap: 3.03146 USDC expected, 3.022431 arrived). After the payout,received(andreceivedUnits) is read from the payout transaction's token transfer to your address; if the receipt cannot be read yet,receivedNotesays so and no amount is claimed.mark swap status <id>(read-only) andmark swap claim <id>(safe to repeat) work on any swap this home created. Once a payment is seen (clientfundingseen,clientfunded) they say so: do not pay again.
First mainnet test (small): mark swap quote --sats 5000, then mark swap --sats 5000 --address <your 0x address> --yes --wait, pay the invoice (about 5,000 sats), check payoutTx on Arbiscan and the USDC in your wallet (about 3 USDC at today's rate, minus the fees shown).
Stablecoins back to BTC (gasless)
mark swap --from usdc|usdt0 --to lightning|arkade swaps USDC or USDT0 on Arbitrum One into BTC. Gasless: you need no EVM wallet in Mark and no ETH. Same total fee (about 1%: Satora ~0.5% + Agent Escrow 0.5%, plus network fee), same referral ID and extraFees on the quote and the swap, same 100 bps cap; the quote shows the live rates and the fee in sats.
# quote (free): send 1.5 USDC, paid out over Lightning
mark swap quote --from usdc --to lightning --amount 1.5
# Lightning payout to an invoice you made (the invoice fixes the sats; no --amount)
mark swap --from usdc --to lightning --invoice lnbc24200n1… --yes --wait
# or to an Ark address from an Arkade wallet on https://arkade.computer
mark swap --from usdc --to arkade --address ark1… --amount 1.5 --yes --waitHow it works:
Mark creates the swap with
gasless: true. The depositor is this Mark home's own EVM key, derived from the agent key and kept in the encrypted swap storage (~/.mark/bitcoin/swaps/), never printed.Before showing anything, Mark checks Satora's answer: a new gasless swap on Arbitrum One (chain 42161), from the token you chose (its contract), depositing to this Mark home's own address, for exactly the
--amount(or at most 1% above the quote for an invoice), paying out to exactly your invoice or your Ark address (on the swap's Arkade server), with the sats at most 1% below the quote. OtherwiseSWAP_FAILED: deposit nothing.It prints
deposit:address,amount,token,contract,chainId. Send that amount of that token on Arbitrum One to that address, in ONE transfer, from any wallet or exchange that sends ERC-20s on Arbitrum. If the address already holds some of the token,deposit.sendis only the missing part ("send NOTHING" if it holds enough).Once the deposit is there, Mark locks it (
fundSwapGasless): on Arbitrum the Satora client submits a paymaster-sponsored transaction from the deposit key (no ETH, no server relay). With--waitMark watches the address and does this itself; else runmark swap fund <id> [--wait]. It funds at most once: concurrent calls share one funding, and a submitted or uncertain funding is never signed again (only a clear refusal before anything is submitted allows a retry); if Satora never sees it,mark swap recoverworks 30 minutes after the attempt. Mark funds only while the payout invoice has at least 5 minutes left. Once funds are seen, Mark never tells anyone to deposit again. Before creating the swap, Mark checks that this funding path is available, and refuses rather than show a deposit address that could not be moved later.Satora pays the invoice (Lightning) or funds the Ark payout, which Mark claims to your Ark address.
--wait(default--timeout1800 s) ends with"swap":"done".
All swaps from a stablecoin in one Mark home share that deposit address, so Mark allows one waiting deposit at a time (SWAP_OPEN_DEPOSIT). At create Mark records the confirmed payout target, token and amount in the Mark home; every later status, fund, claim, refund or recover checks Satora's answer against that record and this home's own deposit address, and refuses with SWAP_FAILED (showing no deposit address) if anything changed. If the record is missing (or the swap is from another Mark home), status shows only the swap's state with no deposit address, amount or token, and fund and claim refuse; refund and recover still work without it, since they only return funds through this home's own key to an address you give. Mark funds only while the payout invoice has at least 5 minutes left (else it points you to mark swap recover), and refuses an invoice already used for another swap in the same home.
Recovery. If the swap ends without a payout after the deposit was locked, mark swap refund <id> (no --to) gets it back to the deposit address, gasless: Satora's collaborative refund first, else the sponsored refund after the timelock. Stablecoins sitting at the deposit address (never locked, or refunded) are sent to your own address with mark swap recover <id> --to <your 0x address>. That is a normal ERC-20 transfer from the deposit address, so it needs a little Arbitrum ETH there for gas; Mark says how much (about 0.00001 ETH) and moves nothing until it is there. mark swap status <id> shows the deposit seen so far and the next step.
Not supported: Lightning addresses as the payout (Satora would fetch their invoice itself, and Mark could not tell it from anyone else's invoice for the same amount; make a BOLT11 invoice in your wallet instead), funding from your own EVM wallet with a key file (the gasless path needs no wallet), and on-chain bitcoin payouts.
7. Command reference
Global flags: --network bitcoin|mutinynet, --escrow-url URL (https; http only for localhost, 127.0.0.1 or [::1]), --arbiter-pubkey <hex> (explicit arbiter identity pin; env MARK_ARBITER_PUBKEY). Operator-only env MARK_HOUSE_KEY: sent as x-escrow-house so the escrow operator's own runs are counted as house traffic (sent only to https://agentescrow.to, an https origin in MARK_HOUSE_ORIGIN, or loopback; leave it unset).
Command | What it does |
| Create the key and config for the network |
| Your x-only pubkey |
| House-seller demo: one real small deal (default: 350-sat page summary). Preview without |
| Public reputation of a key on this server: |
| Show the backup phrase (interactive terminal only) |
| Run as an MCP stdio server |
| Create and sign terms |
| Terms, fee terms, acceptances (verified), evidence (with |
| Verify |
| Limits, fee schedule, fee preview |
| Lightning invoice to fund (shown again while unpaid); |
| Direct Ark payment, no swap fee: prints |
| Paid, but the claim into the escrow failed or did not finish ( |
| Full deal state, proposals, events, local swap status, |
| Payout amounts; exact with |
| Pending payout proposals and payout details. No id: across all my deals (local + server listing |
| Payee: propose and sign. Co-signer: sign (no payout flags) |
| Buyer proposes a refund |
| Recover a failed Lightning payout swap |
| Open a dispute (the operator rules) |
| Signed evidence note ( |
| Read the thread |
| Post to the thread |
| Unread messages across your deals |
| Deals for my key: waiting for my accept (default), or all / filtered. Each item has |
| Quote BTC → stablecoin on Arbitrum: rate, what you receive, and the fees (about 1% total: Satora ~0.5% + Agent Escrow 0.5%, plus network fee; live rates are in the quote). Nothing is created |
| Quote Lightning → Arkade: sats you pay, sats you receive, and the fees (about 0.65% total: Satora ~0.15% + Agent Escrow 0.5%, plus network fee; live rates are in the quote). Nothing is created |
| Quote Arkade → Lightning: sats to send (or the invoice Satora will pay), and the fees (about 0.80% total: Satora ~0.30% + Agent Escrow 0.5%, plus the quote's Lightning network fee). Nothing is created |
| Every route Mark supports (ten routes: Lightning / Arkade ⇄ USDC / USDT0 on Arbitrum, plus Lightning ↔ Arkade): token contract and chain on the stablecoin routes, and Satora's live min / max sats on every route. Fees depend on the route and are shown on the live quote (about 1% total for Lightning or Arkade to USDC or USDT0 and back; about 0.65% total for Lightning to Arkade; about 0.80% total for Arkade to Lightning; plus network fee; live pair rates when Satora can be reached). Read-only |
| Preview (no |
| Lightning → Arkade: preview, or create and print a hold invoice; |
| Arkade → Lightning: preview, or create and print the Arkade address and exact sats to send (not Bark); Satora pays the invoice. About 0.80% total plus the quote's network fee |
| Swap status (read-only), amount, |
| Claim a paid swap's stablecoins to its address, or a Lightning-to-Arkade swap's Ark payout (safe to repeat). Arkade-to-Lightning has nothing to claim (Satora pays the invoice) |
| Stablecoin → BTC, gasless: preview (no |
| Swap from a stablecoin: lock the deposit into the swap (gasless, at most once) |
| Arkade-funded swap that did not pay out: refund after its timelock |
| Swap from a stablecoin whose locked deposit did not pay out: back to the deposit address (gasless) |
| Swap from a stablecoin: send the stablecoins at the deposit address to your address (needs a little Arbitrum ETH there) |
Usage mistakes return {"code":"USAGE","error":"…","details":{"usage":…}} before any network call.
8. Agent tools (MCP)
Run mark mcp [--network …] [--escrow-url …] as a stdio MCP server. Example client config: {"mcpServers":{"mark":{"command":"npx","args":["-y","@yuvlero/mark@latest","mcp"]}}} (or {"command":"mark","args":["mcp"]} if installed) (mainnet uses https://agentescrow.to; add "env":{"MARK_ESCROW_URL":"https://…"} to override).
Tool | Equivalent |
|
|
|
|
|
|
| same names (each includes |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| messages |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9. Error codes
Code | Meaning / what to do |
| Wrong command or flags; see |
| Rare: the key is auto-created; run |
| Only on networks without a default (e.g. mutinynet): set |
| Server down or wrong URL; retry later |
| This Mark is older than the escrow server accepts (HTTP 426). Update: |
| Your pubkey is neither buyer nor seller of this deal |
| Unknown deal or proposal id |
| Deal size outside |
|
|
| The demo needs an input (e.g. |
| Invalid create input |
| Server terms differ from what Mark computed; do not accept or fund. If Mark printed an update notice, update Mark first and retry |
| Funding is blocked until both parties run |
| The server's deal hash is not the one you signed; do not fund |
| The server's escrow address is not the contract of the deal's keys; do not fund, report it |
| The server's arbiter identity is not the pinned one (or is gone). Possible impersonation: do not fund. Re-pin only after confirming the new key with the operator: |
| The deal's arbiter key / address is not signed by the pinned identity; do not accept or fund |
| The seller chose an automatic release rule; accepting (v2) or funding (v1) needs |
| Invalid escrow URL, or |
| Legacy deal without terms (nothing to accept) |
| Action not allowed in the current state (e.g. dispute before funding, release on an expired deal) |
| The deal expired unfunded (deadline + grace passed); it cannot be accepted or funded. Create a new deal |
|
|
| Invoice amount out of range; use |
| Put |
| Invoice expires in under 10 min; make a new one |
| Undecodable, wrong-network invoice or bad address |
| Swap provider unreachable or the Lightning address does not resolve; retry |
| Wrong signer set; the payee proposes (seller releases, buyer refunds) |
| No pending proposal for you |
| The tx does not pay exactly payee + published fee; Mark refused to sign. Report it |
| A ruling changed the fee; the payee must propose again |
| Bad signature or clock skew over 10 minutes; check the system clock |
| Too many messages (20 per 10 minutes); wait |
| Empty, too long (4,000) or contains control characters |
| Wrong |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Satora did not create the swap, or what it created does not match what you confirmed (payout address, amount, invoice / Ark address, deposit address). Do not pay or deposit; an unpaid swap just expires. Retry |
10. Security notes
Your seed is encrypted at rest. The password file sits next to it by default, so protect the host or move the password out with
MARK_PASSWORD_FILE.Mark refuses to sign unless the outputs are exactly payee leg to the proposal destination plus fee to the fee address in the signed terms.
Mark recomputes
termsHashand verifies every acceptance signature locally. It never trusts the server's word. With terms v2 the signatures also cover the release rule, arbiter mode, deadline and webhook.Mark derives the escrow address itself from the deal's keys and refuses to fund a different one. It pins the server's arbiter identity key and checks its signature on every deal.
Escrow URLs must be
https://(plainhttp://only tolocalhost,127.0.0.1or[::1]). The same rule applies to the Arkade server URL an escrow server reports in/limits: anything else falls back to Mark's network preset.For Lightning payouts, your Mark creates the swap and keeps its refund key. For funding, your Mark keeps the claim key. The server never holds them.
Payout invoices are checked by Mark and the server: amount range, network, and at least 10 minutes of validity left.
Never paste your backup phrase, password or wallet file into chat, messages or evidence.
Start on
--network mutinynet(test coins) if you want a dry run.
11. FAQ
Why does
acceptsaystate: created? "Created" means the escrow is not funded yet. Checkagreed: trueandnext.Why is the funding invoice more than the deal amount? It includes the Lightning→Ark swap fee.
Why is my Lightning payout less than
payeeLegSats? The Ark→Lightning swap fee (Satora protocol and routing). Ark payouts have no swap fee.Can I use an amountless invoice? No. Use
quote --destand an invoice forrecommendedInvoiceSats, or a Lightning address.What if the seller never delivers? After the deadline,
mark escrow refund <id> --payout-…; the arbiter co-signs.What if we disagree?
mark escrow dispute, then messages and evidence. The operator rules and the winner gets paid (minus the dispute fee).Does the service hold my money? No. The funds sit in a 2-of-3 Ark contract; the service holds only one key.
Can I script it without Mark? Yes: docs/escrow-api.md documents the HTTP API and signing.
Development
npm ci && npm test # builds, then runs the unit tests (HTTP mocked)Layout: src/cli.ts, src/mcp.ts (thin adapters) → src/core/ (use-cases, terms, fees) → src/api/escrowApi.ts (the only HTTP client). Also src/crypto/ (keystore, PSBT checks), src/swap/ (Satora) and src/lightning/ (BOLT11 checks).
Available Tools
30 toolsescrow_acceptA
Accept the deal terms: verifies termsHash, the escrow address and the arbiter key locally, then signs termsHash with this agent's key (terms v2: the signature also covers the release rule, arbiter mode and deadline). Required from both parties before funding. A buyer is refused (UNSAFE_RULE) when the seller chose an automatic release rule (hash lock / webhook); pass allowCounterpartyRule=true only after the user explicitly agrees
Inputs: id (required), allowCounterpartyRule.
escrow_approveB
Sign a pending proposal, or (as payee) propose with a payout: payoutInvoice (fresh BOLT11 for the quote's recommendedInvoiceSats). A co-signer passes no payout, payoutLnaddr, or payoutArk
Inputs: id (required), kind, with, preimage, +3 more.
escrow_createA
Start an escrowed deal with another agent so you can pay it (role buyer) or get paid by it (role seller) without trusting it: non-custodial 2-of-3 bitcoin escrow, funded and paid out over Lightning. Terms you write here are signed by both sides and are what the arbiter rules on. Check escrow_limits and escrow_reputation first; next the counterparty calls escrow_accept, then the buyer calls escrow_fund.
Inputs: role (required), sats (required), terms (required), deadline (required), +3 more.
escrow_demoA
No counterparty yet? Make a first real escrowed purchase from the always-on house seller agent (default offer: 350 sats). First real deal with the escrow server's always-on house seller agent (default offer: a Markdown summary of one public web page for 350 sats; also research for 1,500; no platform fee). REAL MONEY on mainnet, and not instant: the seller checks every few minutes and delivers within the offer's turnaround. Without confirm=true it only previews (offer, cost, inputs, exact terms) and creates nothing. Inputs become the deal description's Key: value lines (url, words, ...; validated locally). With confirm=true it creates the deal as buyer, waits for the seller's accept and returns the Lightning funding invoice; after paying, call escrow_fund with wait=true (that claims the payment into the escrow; funding stays pending until then). The seller delivers in the deal thread (escrow_messages); then release with escrow_approve. Call again to see where the demo deal stands (it resumes; fresh=true starts a new one)
Inputs: url, text, wait, focus, +9 more.
escrow_disputeC
Open a dispute (arbiter auto-signing stops; admin rules)
Inputs: id (required), reason.
escrow_evidenceA
Add a signed, timestamped evidence note to a deal (seller: post the deliverable sha256 after delivering off-band; for the arbiter in a dispute)
Inputs: id (required), url, file, note, +2 more.
escrow_fundA
Buyer: get the Lightning invoice that funds the escrow; after paying, call again with wait=true to lock the funds. Or rail=ark: direct Ark payment with no swap fee: returns the escrow address, the exact sats and the Arkade server (url + key); pay it in ONE payment from an Arkade wallet on that server (Bark / Second cannot pay it: use Lightning), then call with rail=ark, wait=true; smaller payments are not added up (status shows underpaid), a larger one is held whole. Switching rails after one was started needs switchRail=true (only if nothing was paid on the other rail). Refuses (DEADLINE_TOO_CLOSE) when the deal expires (deadline + 1 h grace) within an invoice lifetime for Lightning, or within 10 minutes for rail=ark; an expired deal reports state expired. Refuses (UNSAFE_RULE) a deal whose auto-release rule the seller chose (a hash lock it created, or a webhook rule): the seller could be paid without you. Pass allowCounterpartyRule=true only after the user explicitly agrees. A later call shows the same invoice again while it is unpaid, and says paymentReceived (do NOT pay again) once it is paid. If a claim fails (claimFailed, note) or times out at swap status serverfunded/clientredeeming, call again with resumeClaim=true: it finishes or retries the claim of the paid swap into the escrow and never creates an invoice.
Inputs: id (required), rail, wait, switchRail, +2 more.
escrow_inboxA
Unread messages across this agent's deals (operator replies, system notices)
Inputs: no named parameters.
escrow_invitesB
Deals created for this agent's key that wait for its accept (no id needed). all=true lists every deal this key is in; needs filters accept|fund|sign|any; state filters by deal state. Each item has awaiting, action_required_for and nextStep (newer servers also send deadlineCountdown for your role)
Inputs: all, needs, state.
escrow_limitsA
Server limits: arkade (the Arkade server URL and key this escrow runs on; Ark addresses must come from an Arkade wallet there, not Bark/Second), minimum deal size for Lightning and Ark payouts, platform fee schedule (free up to 33000 sats, then 1% of the whole amount; ruled dispute +max(5%,330) from 3300), free tier, Satora min/max, Ark dust. With sats: upfront fee preview (platform fee, possible dispute fee, estimated swap cost, min/max deal)
Inputs: sats.
escrow_messageA
Post a signed message to a deal's thread (ask the operator a question, explain a dispute, point to evidence). A dispute message does NOT open a dispute: use escrow_dispute for that
Inputs: id (required), text (required), kind, replyTo.
escrow_messagesB
Read a deal's support thread with the operator (signatures verified: operator against the deal's arbiter key). since = cursor from the last read
Inputs: id (required), since.
escrow_pendingA
Pending payout proposals and their payout details (read-only). Without id: across all this agent's deals, with what each awaits and the co-sign command
Inputs: id.
escrow_quoteC
Payout quote: exact payout sats, recommendedInvoiceSats (create the BOLT11 for this) and the accepted min/maxInvoiceSats range
Inputs: id (required), dest, path.
escrow_refundC
Buyer: propose refund with a fresh payout (arbiter co-signs after deadline)
Inputs: id (required), payoutArk, payoutLnaddr, payoutInvoice.
escrow_refund_payoutC
Refund a failed Lightning payout swap to an Ark address (from an Arkade wallet on this escrow's Arkade server)
Inputs: id (required), to.
escrow_reputationA
Check a counterparty before you pay or accept a deal. Public reputation of a pubkey on this escrow server: dealsCompleted, satsTransacted (approx, 2 significant figures), ruled disputesWon/Lost, firstSeen (first funded deal), lastSeen (latest released/refunded deal; null if none). Funded deals only. An indicator, not a guarantee (wash trading between one's own keys is possible). escrow_show/escrow_status/escrow_accept include the counterparty's automatically
Inputs: pubkey (required).
escrow_showC
Deal terms (what it is for), who accepted (signatures verified locally), evidence, awaiting / action_required_for / arbiterPolicy, and deadlineCountdown: the auto-refund deadline, disputeBy and secondsLeft with a note for your role (a seller who delivered to a silent buyer must dispute before disputeBy)
Inputs: id (required).
escrow_statusC
Escrow state, proposals, events, and deadlineCountdown (auto-refund deadline, disputeBy, secondsLeft, a note for your role)
Inputs: id (required).
pubkeyB
This agent's escrow public key (x-only hex)
Inputs: no named parameters.
swap_claimA
Claim a paid swap's stablecoins to the address set at create and return payoutTx, or a swap from a stablecoin's Ark payout (safe to repeat; never pays anything). wait=true: first wait (up to 15 min) until Satora funds its side. Never funds a swap from a stablecoin: use swap_fund for that
Inputs: id (required), wait.
swap_createA
Swap BTC through Satora: Lightning or Arkade into USDC or USDT0 on Arbitrum, or Lightning ↔ Arkade. Fees are shown in the quote (Fees depend on the route and are shown on the live quote. Lightning or Arkade to USDC or USDT0 (and back) is about 1% total (Satora ~0.5% + Agent Escrow 0.5%) plus network fee. Lightning to Arkade is about 0.65% total (Satora ~0.15% + Agent Escrow 0.5%) plus network fee. Arkade to Lightning is about 0.80% total (Satora ~0.30% + Agent Escrow 0.5%) plus network fee). REAL MONEY on mainnet. Without confirm: preview only. With confirm: creates the swap and returns what to pay once (a Lightning invoice, an Ark address + exact sats, or both for the rail). After paying a Lightning- or Arkade-to-stablecoin swap, or a Lightning-to-Arkade swap, call swap_claim with wait=true. After paying an Arkade-to-Lightning swap, call swap_status (or swap_claim with wait=true) to wait for Satora to pay the invoice; there is nothing for you to claim. Non-custodial: the claim key stays in this Mark home
Inputs: to, from, sats, address, +2 more.
swap_fundB
Swap from a stablecoin: once the deposit is at its deposit address, lock it into the swap (gasless; at most once; no ETH). wait=true: wait (up to 30 min) for the deposit, fund, then wait for the payout. Never asks for a second deposit
Inputs: id (required), wait.
swap_quoteB
Quote a swap of BTC through Satora: Lightning or Arkade into USDC or USDT0 on Arbitrum, or Lightning ↔ Arkade. Fees depend on the route and are shown on the live quote (Fees depend on the route and are shown on the live quote. Lightning or Arkade to USDC or USDT0 (and back) is about 1% total (Satora ~0.5% + Agent Escrow 0.5%) plus network fee. Lightning to Arkade is about 0.65% total (Satora ~0.15% + Agent Escrow 0.5%) plus network fee. Arkade to Lightning is about 0.80% total (Satora ~0.30% + Agent Escrow 0.5%) plus network fee). Nothing is created
Inputs: to, from, sats, address, +1 more.
swap_recoverA
Swap from a stablecoin: send the stablecoins sitting at its deposit address (unfunded, failed or refunded swap) to your own 0x address on Arbitrum. Needs a little Arbitrum ETH at the deposit address for gas (it says how much)
Inputs: id (required), to (required).
swap_refundA
Refund a swap that did not pay out. Arkade-funded: after its timelock, to to, an Ark address from an Arkade wallet on https://arkade.computer (Lightning swaps need no refund). From a stablecoin: omit to; the locked deposit goes back to the deposit address (gasless), then use swap_recover
Inputs: id (required), to.
swap_routesA
Every swap route Mark supports (BTC from Lightning or Arkade into USDC or USDT0 on Arbitrum and back, plus Lightning ↔ Arkade) with Satora's live min/max sats. Fees depend on the route and are shown on the live quote. Lightning or Arkade to USDC or USDT0 (and back) is about 1% total (Satora ~0.5% + Agent Escrow 0.5%) plus network fee. Lightning to Arkade is about 0.65% total (Satora ~0.15% + Agent Escrow 0.5%) plus network fee. Arkade to Lightning is about 0.80% total (Satora ~0.30% + Agent Escrow 0.5%) plus network fee. When Satora can be reached each route also shows the live pair rate. Read-only: nothing is created. Limits are "unavailable" if Satora cannot be reached
Inputs: no named parameters.
swap_statusA
Status of a swap_create or swap_to_btc_create swap (read-only): the payout tx once claimed; for a swap from a stablecoin, the deposit seen so far and what to do next
Inputs: id (required).
swap_to_btc_createA
Swap USDC or USDT0 on Arbitrum into BTC over Lightning or to an Ark address (Satora; about 1% total (Satora ~0.5% + Agent Escrow 0.5%) plus network fee, shown in the quote). REAL MONEY. Gasless: no wallet or ETH needed. Without confirm: preview only. With confirm: creates the swap, checks it, and returns deposit.address, the exact amount and the token: send that once (one ERC-20 transfer on Arbitrum One), then call swap_fund with wait=true. Never send twice
Inputs: from (required), to, amount, address, +2 more.
swap_to_btc_quoteA
Quote a swap of USDC or USDT0 on Arbitrum into BTC over Lightning or to an Ark address (Satora): what you send, the sats you receive, and the fees (about 1% total (Satora ~0.5% + Agent Escrow 0.5%) plus network fee; live rates are in the quote). Nothing is created
Inputs: from (required), to, amount, address, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Several clusters overlap heavily: escrow_show, escrow_status, escrow_invites, and escrow_pending all return deal or payout state; escrow_message, escrow_messages, escrow_inbox, and escrow_evidence form a confusing messaging/evidence cluster; swap_quote and swap_routes also overlap. The lengthy descriptions mitigate some confusion, but an agent can easily misselect among these read/status tools.
The escrow_ and swap_ namespaces are consistent, and most names follow a verb_noun pattern. However, read tools mix nouns and verbs (pubkey, escrow_inbox, escrow_messages, escrow_status, escrow_show), escrow_message and escrow_messages differ only by plural, and swap_to_btc_create breaks the swap_<verb> pattern.
With 30 tools, the surface is heavy for an agent escrow server; the escrow and swap domains are large, but many read/status/messaging tools overlap enough that they do not each clearly earn a distinct place. A more consolidated read/state interface would substantially reduce the tool count.
Coverage is broad: escrow create/accept/fund/approve/dispute/refund, messaging and evidence, reputation, limits, demo, plus swap routes/quotes/create/status/claim/fund/refund/recover. Minor gaps exist, such as no explicit escrow cancel/close or direct arbiter-ruling tool, but core workflows are covered.
Maintenance
Related MCP Connectors
Non-custodial RFQ and atomic swap settlement for AI agents. Escrow onchain, signed receipts.
Marketplace where AI agents buy/sell skills over Bitcoin Lightning with escrow-backed verification.
Marketplace where AI agents buy/sell skills over Bitcoin Lightning with escrow-backed verification.
Escrow middleman for any deal between people or AI agents: USDC held in an audited contract.
Related MCP Servers
- AlicenseAqualityDmaintenanceNon-custodial on-chain escrow + AI arbitration for agent-to-agent USDC payments on Base. Seven tools wrap a verified EscrowV1 contract — create, deliver, confirm, dispute, resolve — with read-only introspection if no wallet key is provided.72MIT
- AlicenseAqualityCmaintenanceEnables AI agents to manage Bitcoin micropayments, service offers, and escrow contracts through MCP tools, without requiring a Lightning node.8MIT
- AlicenseAqualityCmaintenancePrivate escrow for AI agent work on Beam mainnet an agent locks payment, the worker locks collateral, and delivery settles on hash match or review, with M of N arbitrator voting and slashable worker bonds as the dispute backstop. 22 tools cover the full contract lifecycle, and dispute voting is deliberately not an agent tool, so an agent can never rule in its own favour.26MIT
- AlicenseNot gradedqualityDmaintenanceMulti-party escrow and settlement for autonomous agent transactions with x402 micropayments and dispute resolution on Base, Ethereum, or Solana.MIT