Deploying & Managing Your Contract

Deploy your own dedicated MpcFirewall contract on NEAR with custom allowlists, spend thresholds, and DAO governance.

Deploy & Initialize Command

Deploy an isolated contract account for your own organization or AI treasury with custom chain IDs, vendor allowlists, and spend thresholds:

bashDeploy & Initialize Your Own Instance
near contract deploy <your-firewall>.testnet \
  use-file contracts/mpc-firewall/target/wasm32-unknown-unknown/release/mpc_firewall.wasm \
  with-init-call new json-args '{
    "owner": "<owner>.testnet",
    "mpc_signer_contract": "v1.signer-prod.testnet",
    "derivation_path": "ethereum,agent-treasury-1",
    "policy": {
      "authorized_agents": ["<agent>.testnet"],
      "allowed_chain_ids": [8453, 84532, 42161],
      "allowed_targets": ["0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"],
      "blocked_addresses": [],
      "allowed_recipients": ["0x1111111111111111111111111111111111111111"],
      "max_native_wei": 500000000000000000,
      "auto_approve_native_wei": 100000000000000000,
      "max_daily_native_wei": 1000000000000000000,
      "max_token_amount": 500000000,
      "auto_approve_token_amount": 100000000,
      "max_daily_token_amount": 1000000000,
      "allow_unlimited_approvals": false,
      "allow_set_approval_for_all": false,
      "allow_unknown_selectors": false,
      "max_btc_output_sats": 100000,
      "max_daily_btc_sats": 500000,
      "allowed_btc_scripts": ["00141111111111111111111111111111111111111111"],
      "dao_account": "mpc-firewall-council.sputnikv2.testnet"
    }
  }' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' \
  sign-as <your-firewall>.testnet network-config testnet sign-with-keychain send

Smart Contract Method Reference

MethodWho Can CallBehavior
new(...)Deployer (#[init])Sets owner, MPC signer contract, derivation path, and OnChainPolicy
verify_and_sign_evm(raw_unsigned_tx_hex, tx_id)Authorized Agent / DAO / OwnerDecodes EVM RLP + ABI recursively, enforces rules/caps, hashes keccak256, calls v1.signer.sign
verify_and_sign_btc_bip143(raw_unsigned_btc_hex, tx_id, bip143)Authorized Agent / DAO / OwnerChecks BTC scripts & caps, computes BIP-143 sighash preimage, calls v1.signer.sign
verify_and_sign_btc(raw_unsigned_btc_hex, tx_id)Authorized Agent / DAO / OwnerChecks BTC caps/scripts and signs raw double-SHA256 digest
dao_approve_escalated(tx_id)DAO / OwnerDispatches a queued PendingDaoApproval request after SputnikDAO vote
add_authorized_agent / remove_authorized_agent / update_policyOwner / DAOUpdates allowed agent accounts and active policy limits
get_policy() / get_escalated_tx(tx_id)Anyone (View)Reads live policy rules or escalated transaction status
on_mpc_sign_complete(...)Contract Only (#[private])Rolls back daily spend accumulators if v1.signer fails