MonmouthMonmouth Docs

Precompiles Overview

Overview

Monmouth includes five custom precompiles that provide protocol-level capabilities for agent operations. These are not smart contracts — they're built directly into the execution environment for maximum performance.

Precompile Registry

AddressNameDescription
0x1000AI InferenceOn-chain AI model inference for validation and scoring
0x1001Vector SimilarityCosine similarity computation for agent matching
0x1002Intent ParserParse and validate intent structures
0x1003SVM RouterCross-chain operations via Solana VM
0x4200Message PasserCross-chain messaging and asset transfers

Why Precompiles?

Precompiles run as native code in the execution environment rather than as EVM bytecode. This provides:

  • Performance: 10–100x faster than equivalent smart contract logic
  • Gas efficiency: Fixed, predictable gas costs
  • Native integration: Direct access to chain state and primitives
  • Security: Audited and hardened as part of the protocol

Common Usage

All precompiles are accessible via standard EVM call or through the Wallet SDK:

import { MonmouthWallet } from '@monmouth/wallet-sdk'
 
const wallet = new MonmouthWallet({ ... })
 
// High-level SDK usage (recommended)
const result = await wallet.executeIntent({
  type: 'swap',
  fromToken: 'ETH',
  toToken: 'USDC',
  amount: '1 ETH',
})
 
// Low-level precompile access
const similarity = await wallet.precompile('0x1001').call({
  vectorA: [...],
  vectorB: [...],
})

Gas Costs

PrecompileBase GasNotes
AI Inference50,000+10,000 per model parameter
Vector Similarity15,000+1,000 per dimension
Intent Parser10,000+2,000 per nested intent
SVM Router21,000+5,000 per account
Message Passer30,000Varies by message size

On this page