What am I holding across the pools, and how much is this key actually allowed to spend?
▸ get_identity {}
→ {
"identity": "a4c1f94d2b8e6f03a17c55e9dd2a4b8c0f3e1d9a2b4c6d8e0f1a2b3c4d567d9",
"network": "niles",
"mode": "writes"
}
▸ get_spend_policy {}
→ {
"identity": "a4c1f94d2b8e6f03a17c55e9dd2a4b8c0f3e1d9a2b4c6d8e0f1a2b3c4d567d9",
"keyFound": true,
"role": "agent",
"policy": {
"version": 1,
"rules": { "TRX-NILE:#native": { "perTxMax": "150000000" } }
},
"note": "Per-tx ceiling 150 TRX on niles native."
}
Reading the ceiling off the ledger before I touch anything: 150 TRX per transaction, and the key is attached as a scoped agent role. Every move below has to fit under that number.
▸ get_balances {}
→ {
"TRX-NILE": [
" { "symbol": "TRX", "token": null, "decimals": 6, "raw": "12480770000", "reserved": "0", "available": "12480770000" },
" { "symbol": "USDT", "token": "9b28202c…bb06c", "decimals": 6, "raw": "0", "reserved": "0", "available": "0" }
]
}
12,480.77 TRX available on niles, none of it reserved by a resting order. No USDT yet - so the whole job is a swap.
I want USDT. Swap about 600 TRX at whatever the book offers, keep slippage under half a percent.
▸ list_tokens {}
→ {
"TRX-NILE": [
" { "symbol": "TRX", "token": null, "decimals": 6, "chargeable": false },
" { "symbol": "USDT", "token": "9b28202c90af764ffa36279857a6d7cd928bb06c", "decimals": 6, "chargeable": true }
]
}
USDT is 9b28…bb06c on niles. It is chargeable - a USDT transfer carries the fee - so the cheap path here is native TRX there and back.
▸ get_order_book {}
→ [
" { "hash": "d9a12c…5b3c", "give": { "chain": "niles", "amount": "5000000000" }, "want": { "chain": "niles", "token": "9b28…bb06c", "amount": "208500000" } },
" { "hash": "3f7a9c…e6d1", "give": { "chain": "niles", "amount": "3000000000" }, "want": { "chain": "niles", "token": "9b28…bb06c", "amount": "125880000" } },
" { "hash": "b84e0a…9c02", "give": { "chain": "niles", "amount": "3500000000" }, "want": { "chain": "niles", "token": "9b28…bb06c", "amount": "147350000" } }
]
Best ask is 5,000 TRX against 208.50 USDT - a rate of about 0.0417 USDT per TRX. I will trade against the book as it stands, with 50 basis points of slippage allowed.
▸ market_order { "give": { "chain": "niles", "amount": "600" }, "wantAsset": { "network": "niles", "token": "0x9b28202c…bb06c" }, "maxSlippageBps": 50 }
→ {
"status": "partial",
"give": { "raw": "548200000", "decimals": 6, "amount": "548.20" },
"want": { "raw": "22859940", "decimals": 6, "amount": "22.86" },
"unfilledGive": { "raw": "51800000", "decimals": 6, "amount": "51.80" }
}
Filled 548.20 TRX for 22.86 USDT at ~0.0417. The book had no more depth, so the last 51.80 TRX came back as spendable - nothing left half in a resting order, nothing wasted.
In parallel, the verifier agent re-reads the same books from a second key. A verifier key cannot raise transfers - the money contracts refuse that outright - so it can check a run and confirm it, never spend on its own. That split is enforced on-ledger, not by convention.
Re-reads the book and balances for the trade as it landed.
Reconciled: 548.20 TRX out, 22.86 USDT in, the last 51.80 TRX back as spendable, nothing reserved.
Countersigns the trade record.
Park 2,000 TRX as a resting sell for USDT at or above the rate we just saw. Leave it until a taker crosses it or I say otherwise.
▸ create_order { "give": { "chain": "niles", "amount": "2000" }, "want": { "chain": "niles", "token": "0x9b28202c…bb06c", "amount": "84.40" } }
→ {
"status": "ok",
"orderHash": "7a41f90e…c3d8",
"order": { "give": { "amount": "2000" }, "want": { "amount": "84.40" } }
}
2,000 TRX are resting at a limit of 84.40 USDT (0.0422/TRX). The balance they cover shows as reserved while it sits - and it sells at that rate or not at all.
Re-read the book - did it cross while we were talking?
▸ get_order_book {}
→ [
" { "hash": "3f7a9c…e6d1", "give": { "chain": "niles", "amount": "3000000000" }, "want": { "chain": "niles", "token": "9b28…bb06c", "amount": "125880000" } },
" { "hash": "b84e0a…9c02", "give": { "chain": "niles", "amount": "3500000000" }, "want": { "chain": "niles", "token": "9b28…bb06c", "amount": "147350000" } }
]
Our hash is gone from the book - a taker crossed it at the limit. 2,000 TRX out, 84.40 USDT in. That is the resting order doing the job it was placed for.
The weekly pay run: send 200 TRX to the ops identity over on niles.
Before signing: 200 TRX is over the key's 150 ceiling, and the contract checks that before the identity's approval gate even comes into play. Let it refuse us cleanly.
▸ transfer_on_ledger { "to": "eb10c71f…399", "chain": "niles", "amount": "200" }
→ {
"status": "error",
"error": {
"code": "POLICY_REFUSED",
"message": "200 TRX exceeds this key's per-transaction ceiling of 150 TRX. The contract refused the transfer; nothing was attempted.",
"retryable": false,
"policy": true
}
}
Refused by the contract, before anything moved - not by me, and not because the request looked wrong. A number the ledger owns is what stopped it. That is the whole point.
Fair - make it 120 TRX. Under the ceiling, and anything over 100 waits on the verifier. Send it.
▸ transfer_on_ledger { "to": "eb10c71f…399", "chain": "niles", "amount": "120" }
→ {
"status": "awaiting_cosign",
"umid": "c8417a5b…aa11",
"message": "The transfer was recorded but NO MONEY HAS MOVED. 120 TRX crosses the identity's co-sign threshold of 100 TRX, so it is held until a second key confirms it. Report this as 'not sent, approval pending'."
}
Recorded as a proposal - and I want to be plain about what that means: your funds have NOT moved. 120 TRX clears the ceiling but crosses the 100 TRX co-sign threshold, so nothing settles until your second key confirms. There is no tool on this server that could approve it myself - by design. I am reporting this as awaiting approval, not as sent.
Reads the proposal c8417a5b…aa11 against the run: 120 TRX, recipient on the allowlist, inside the ceiling.
Confirms it - a verifier key can affirm a proposal it did not raise, and only a confirming key releases it. The chain enforces that, not good manners.
The release is not mine to make - my key was never able to, and no spend policy could change that. The second key lives with the verifier, and I can only watch the settlement land:
▸ get_transfer { "umid": "c8417a5b…aa11" }
→ {
"status": "settled",
"txid": "9f2e6a1c4d8b5f07a3c9e1d2b4e6f180c7a9d3e5b1f2c4a6d8e0b7d9f1a3c5e7",
"confirmed": { "success": true }
}
Settled. 120 TRX moved the moment the verifier confirmed - the agent ran the whole flow, the verifier cleared the one move that crossed the line, and no single agent held both halves.
Good. The two of you stay on the books and I stay out of it - that is the loop.