Leash
An agent wallet that cryptographically cannot overspend.
Not a rule the agent is asked to respect. A key it does not have.
Locked, measured
Both Leash accounts on NEAR testnet hold no keys, so nothing can upgrade the contract or sign around it.
The path of a request
Leash is a NEAR contract that exclusively owns a Solana address and will only sign transfers that pass its policy. Agents call the contract. The contract calls the MPC signer. The agent never holds the key.
Why the agent cannot go around it
Under NEAR Chain Signatures the foreign key is derived from (predecessor_account_id, path): the immediate caller and a path string, and nothing else. When the contract calls sign(), the contract is the predecessor, so the derived Solana address belongs to the contract’s account. No other account can be the predecessor for it.
The agent never hands over signable bytes. It supplies parameters, and the contract constructs the Solana transfer itself. The agent cannot express a transfer the policy did not authorise.
The derived key follows the account, not the code. The guarantee requires a locked account: zero full-access keys.
The policy object
Per agent account. Fields as defined in contract/src/policy.rs, set by the owner with set_agent_policy.
WINDOW_MS = 24 h).Refusal variants in the contract:
UnknownAgent AgentDisabled ZeroAmount OverPerTxLimit OverWindowLimit RecipientNotAllowed RecipientMalformed SessionExpired
SPL tokens have a separate per-mint rule set (set_mint_rule), with its own limits and destinations.
Testnet proof
59HB5memEzCQMXoWe6mD7KX3ysvYMZoVBHPXVyt4tr64sha256 3d8dae96c0eea6ee999c333031ae9b6152174c017830046cf7737a1eae91bf11, derived from the bytes; the RPC code_hash agrees (block 277685695)Block rows are heights as recorded by the build; the source lists no block hashes, so they are not linked.
Use it from anywhere
Leash is the spend rail for TrenchFu's own agents: the same contract is the planned rail wherever a TrenchFu product lets an agent move funds.
An agent is a NEAR account the owner has registered. It calls one method with parameters, never bytes. From the repo harness (harness/land_transfer.py):
near contract call-function as-transaction leash-b0c503d6.testnet request_transfer \
json-args '{"recipient":"<base58>","lamports":"1000000","recent_blockhash":"<blockhash>"}' \
prepaid-gas '300.0 Tgas' attached-deposit '1 yoctoNEAR' \
sign-as <agent-account> network-config testnet
A refusal returns a verdict (LEASH_REFUSED) and is written to a bounded ring: read it with get_recent. Also readable: get_agent_policy, get_totals, list_agents, get_solana_address. SPL tokens: request_spl_transfer.
example pending a standalone examples/ for other harnesses and chains does not exist yet.
Status
trenchfu.near; this page carries the mainnet reading the moment the contract exists. Repo: github.com/trenchfu/leash, public; ./verify.sh rebuilds the deployed bytes and checks both accounts.Where it grew
Every fact on this page comes from one of these. The repo is public at github.com/trenchfu/leash; each source below links to it. The apex lists the wider record.
- ContractThe policy object and its refusals, in
contract/src/policy.rs.live on testnet - The path of a request and the attack on Leash.public repo
- HarnessThe script behind the use example,
harness/land_transfer.py.live on testnet - Design notes kept under
docs/.public repo - The block readings and the open items listed under Status.public repo