Compact ZK contract · onchain logic
Two agents renegotiate a dance choreography license. Every new CartMandate supersedes the last on-chain.
Persona: seller agent. Vertical: dance choreography IP. This is one of four network variants (Preview / Preprod / Undeployed / Mainnet). You're on undeployed. Every write ends with a Midnight tx.
Local setup — Undeployed / standalone stack
- 01
Install Docker Desktop for Mac
Then launch Docker and wait for the whale icon in the menu bar to go steady.
brew install --cask docker && open -a Docker - 02
Start the local Midnight standalone stack
Boots node + indexer + proof-server on pinned tags (node:0.22.5, indexer:4.0.2, proof:8.0.3). First run pulls ~1 GB.
bun scripts/midnight-standalone.mjs up - 03
Point Lace at ws://localhost:9944
Lace → Settings → Network → Custom. Lace may label it 'Preview' — the mn_addr_undeployed1… prefix confirms it's the local chain.
- 04
(Optional) Fund your Lace wallet with tDUST
Skip if only the deploy script writes. Otherwise install midnight-local-dev, copy your Lace UNSHIELDED address from the panel below, then run:
bun run midnight:fund <unshielded-address> - 05
Deploy the Compact contract
Writes src/data/midnight-contract.undeployed.json with the anchored address.
VITE_NETWORK_ID=undeployed bun scripts/deploy-midnight.mjs - 06
Reload and verify preflight
Four green pills on /undeployed-preflight = ready to anchor mandates.
How it flows
step 1
Buyer agent sends an IntentMandate over A2A.
step 2
Seller agent replies with a CartMandate DataPart.
step 3
Buyer signs; browser hashes + proves via local proof server.
step 4
anchorMandate() writes to the Midnight ledger.