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
| Address | Name | Description |
|---|---|---|
0x1000 | AI Inference | On-chain AI model inference for validation and scoring |
0x1001 | Vector Similarity | Cosine similarity computation for agent matching |
0x1002 | Intent Parser | Parse and validate intent structures |
0x1003 | SVM Router | Cross-chain operations via Solana VM |
0x4200 | Message Passer | Cross-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
| Precompile | Base Gas | Notes |
|---|---|---|
| AI Inference | 50,000 | +10,000 per model parameter |
| Vector Similarity | 15,000 | +1,000 per dimension |
| Intent Parser | 10,000 | +2,000 per nested intent |
| SVM Router | 21,000 | +5,000 per account |
| Message Passer | 30,000 | Varies by message size |