Loops Housenearx402

NEAR HACKATHON
Team
1 member- STOwner
steven
Overview
Private policy, public proof. An AI agent on NEAR pays per x402 call only after the contract verifies a Groth16 proof that the spend is allowed.
Give an AI agent a wallet today, and one prompt injection makes it pay whoever the text tells it to.
nearx402 is a spend-policy wallet for AI agents that pay x402 APIs, settled on NEAR. The money sits in a NEAR contract, not with the agent, whose only key is a function-call key limited to one method, pay_zk. Finance sets a daily cap, a per-call limit and a vendor allowlist, and those rules stay off chain: the agent proves with a Groth16 proof that a payment obeys them, and the contract verifies the proof through NEAR’s alt_bn128 host functions before it transfers the tokens itself. The vendor’s facilitator settles only against what the chain shows. Every payment and every blocked attempt is logged on chain, and a circuit breaker freezes an agent that keeps trying.
It hides the policy, not the payments: budget, per-call limit and vendor list are held only as commitments, while vendor and amount stay public. The agent knows its policy; it just cannot break it.
Running on NEAR testnet with a mock token: the contract nearx402-policy.testnet, the agent’s single pay_zk key, and a recorded run where the agent paid a vendor (41.44 Tgas, proof verified on chain) and two attempts to redirect a payment to an attacker were rejected with no token moved. Hashes are in the README. A read-only dashboard at https://nearx402.svmtech.xyz verifies the deployment from the chain and shows the audit log. The whole flow also runs locally in one command on a NEAR sandbox, with no accounts or funds.
Limits: the testnet contract is not locked, so the team’s key holder must be trusted not to replace its code; the ZK circuit has no third-party audit and its setup ran on one machine.
Built during NEAR HACKATHON 2026 with near-sdk, near-sandbox, arkworks and axum, with help from Claude Code and reviewed with Codex.