Policies, Boundaries & Hardening

Default spend limits, supported DeFi/Bitcoin formats, honest fail-closed boundaries, replay protection, and production environment flags.

Supported Formats & Honest Boundaries

Supported Calldata & Envelopes

EVM EIP-1559, EIP-2930, and Legacy RLP; ERC-20 (transfer, approve, increaseAllowance, transferFrom, permit), setApprovalForAll, nested multicall (depth ≤ 3), Gnosis Safe execTransaction, Uniswap Permit2 & UniversalRouter (V3_SWAP_EXACT_IN / SWEEP), and Bitcoin P2WPKH/P2PKH/P2SH/P2WSH/P2TR + BIP-143.

Fail-Closed Boundary (No Silent Pass)

If an agent calls a custom DeFi contract whose 4-byte selector is not in the supported decoder set, MpcFirewall classifies it as UNKNOWN_CONTRACT_CALL and rejects it by default rather than letting unknown bytes slip through (allowUnknownSelectors: false).

Default Policy Limits

Allowed Chains: Base (8453), Base Sepolia (84532), Arbitrum (42161), Ethereum Sepolia (11155111)
Tokens: Auto-sign ≤ 100 USDC • Max per TX: 500 USDC • Daily cap: 1,000 USDC
Native Gas: Auto-sign ≤ 0.1 ETH • Max per TX: 0.5 ETH • Daily cap: 1.0 ETH (includes max fee bribe guard)
Bitcoin: Max output 100,000 sats • Daily cap: 500,000 sats

Production Environment Flags

VariableBehavior
REQUIRE_ADMIN_AUTH + MPC_FIREWALL_ADMIN_TOKENLocks PATCH/POST /api/policy behind constant-time Bearer / x-admin-token verification
NEARAI_API_KEY + STRICT_LIVE_TEE=trueRequires live NEAR AI Cloud TEE (cloud-api.near.ai/v1); fails closed with ERR_TEE_UNAVAILABLE if unreachable
NEAR_INTENTS_BASE_URL / NEAR_INTENTS_API_KEYConfigures 1Click quote requests with explicit CONFIDENTIAL_INTENTS or INTENTS routing
MPC_FIREWALL_DATA_DIRCustom directory for persistent runtime state (defaults to .mpc-firewall-data locally, os.tmpdir() on Netlify)

Replay Guard & Hosting Notes

On-chain, processed_tx_ids and processed_payloads block replaying identical signed bytes (ERR_REPLAY_DETECTED). Note that stateless serverless deployments (like Netlify) store Node-side counters inside os.tmpdir(); production teams should enforce spend caps primarily via the deployed NEAR smart contract or attach persistent storage via MPC_FIREWALL_DATA_DIR.

Violation Error Codes

ERR_INVALID_RAW_TXERR_CHAIN_ID_NOT_ALLOWEDERR_BLOCKED_ADDRESSERR_UNAPPROVED_TARGET_CONTRACTERR_UNAPPROVED_RECIPIENTERR_UNLIMITED_APPROVALERR_APPROVAL_EXCEEDS_MAXERR_SET_APPROVAL_FOR_ALL_BLOCKEDERR_DELEGATECALL_BLOCKEDERR_NESTED_MULTICALL_VIOLATIONERR_UNKNOWN_SELECTOR_BLOCKEDERR_NATIVE_VALUE_EXCEEDS_MAXERR_DAILY_NATIVE_CAP_EXCEEDEDERR_DAILY_TOKEN_CAP_EXCEEDEDERR_BTC_OUTPUT_EXCEEDS_CAPERR_DAILY_BTC_CAP_EXCEEDEDERR_BTC_UNAPPROVED_OUTPUT_SCRIPTERR_REPLAY_DETECTEDERR_TEE_UNAVAILABLEERR_TEE_CRITICAL_RISK