evm_send_contract_transaction
Broadcasts a gas-paid transaction to execute a smart contract write function, enabling token transfers, staking, swaps, and NFT minting on supported EVM chains.
Instructions
Send transaction to smart contract to execute write function (modifies state, requires gas).
Broadcasts transaction to blockchain that modifies contract state. Used for token transfers, staking, swaps, NFT minting, and any operation that changes on-chain data. Transaction must be confirmed by network.
CRITICAL RULES:
Modifies blockchain state (write operation)
Requires gas payment in native token
Transaction is irreversible once confirmed
Must have correct ABI and function signature
Parameters must match exactly (type and order)
Private key grants transaction signing authority
Optional value parameter to send native tokens with call
PARAMETERS:
chain: EVM chain to execute transaction on (required)
Must have gas in native token
Gas costs vary by chain and function complexity
contractAddress: Smart contract address (required)
Format: 0x followed by 40 hex characters
Must be deployed contract
Examples: DEX routers, NFT contracts, staking pools
abi: Contract Application Binary Interface (required)
JSON array defining contract interface
Must include function being called
Get from block explorer or project docs
Defines function signature for encoding
functionName: Name of function to execute (required)
Must be state-changing function (not view/pure)
Case-sensitive, exact match required
Examples: "transfer", "approve", "swap", "stake"
params: Function parameters array (optional)
Must match function signature exactly
Correct types and order critical
Empty array [] if no parameters
Examples: ["0xAddress", "1000"], []
value: Native token amount to send (optional)
In ether units (e.g., "0.1" = 0.1 ETH/POL/etc.)
Used for payable functions only
Most functions don't need this (default: "0")
Examples: "0.1", "1.5", "0"
privateKey: Transaction signer's private key (required, KEEP SECRET)
Format: 0x followed by 64 hex characters
Must have gas for transaction
Grants full signing authority
Never expose, share, or log this value
EXAMPLES: ✅ Stake tokens in DeFi protocol (Polygon): {chain: "polygon", contractAddress: "0xStakingContract...", abi: [...], functionName: "stake", params: ["1000000000000000000"], value: "0", privateKey: "0xac0974..."}
✅ Execute DEX swap (Arbitrum): {chain: "arbitrum", contractAddress: "0xRouterV2...", abi: [...], functionName: "swapExactTokensForTokens", params: ["1000000", "950000", ["0xToken0", "0xToken1"], "0xRecipient", "1234567890"], privateKey: "0x..."}
✅ Mint NFT with payment (Ethereum): {chain: "ethereum", contractAddress: "0xNFT...", abi: [...], functionName: "mint", params: ["1"], value: "0.05", privateKey: "0x..."}
❌ Invalid - insufficient gas: {chain: "ethereum", ...} // No ETH for gas
❌ Invalid - wrong parameter types: {params: [1000, "0xAddress"]} // Number instead of string
SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559
CRITICAL GAS CONSIDERATIONS:
Ethereum: High gas costs, use gas oracle for timing
Polygon/BSC: Very low gas, safe for frequent transactions
Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum
Avalanche: Dynamic fees, can spike during congestion
Always check gas price before executing transactions
TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.
OUTPUT STRUCTURE: • success: Boolean indicating transaction success • chain: Chain where transaction executed • transactionHash: Transaction hash for tracking • contractAddress: Contract called • functionName: Function executed • from: Sender address (derived from privateKey) • gasUsed: Gas consumed by transaction • blockNumber: Block containing transaction • executionTime: Time taken in milliseconds
COMMON MISTAKES:
Not having sufficient gas for transaction
Wrong ABI (function signature mismatch)
Incorrect parameter types or order
Forgetting to approve tokens before swap/transfer
Using view/pure functions (use evm_call_contract instead)
Not waiting for transaction confirmation
USE CASES:
Execute DEX token swaps
Stake tokens in DeFi protocols
Mint or transfer NFTs
Claim rewards from contracts
Interact with lending protocols
Call custom contract functions
TRANSACTION FLOW:
Check gas balance (evm_get_balance)
Approve tokens if needed (evm_approve_token)
Encode function call with ABI
Sign transaction with private key
Broadcast to network
Wait for confirmation
GAS ESTIMATION:
Simple functions: 50,000-100,000 gas
Complex functions (swaps): 150,000-300,000 gas
Very complex (multi-operation): 300,000-500,000 gas
Use evm_estimate_gas before executing
PAYABLE FUNCTIONS: Functions that accept native tokens (ETH/POL):
Specify value parameter in ether units
Contract must mark function as "payable"
Common in: NFT minting, deposits, purchases
Example: Mint NFT for 0.05 ETH
NON-PAYABLE FUNCTIONS: Most functions don't accept native tokens:
Leave value as "0" or omit
Use token approvals instead (ERC20)
Attempting to send value will fail
GETTING CONTRACT ABI:
Block explorer (Etherscan/PolygonScan) - verified contracts
Project GitHub repository
Project documentation
npm packages (@uniswap/v2-periphery)
SECURITY NOTES:
Verify contract address carefully (phishing risk)
Check function name and parameters
Test with small amounts first
Understand what function does before calling
Monitor transaction on block explorer
Keep private keys secure
ABI REQUIREMENT: Full function ABI entry needed: { "name": "transfer", "type": "function", "stateMutability": "nonpayable", "inputs": [ {"name": "recipient", "type": "address"}, {"name": "amount", "type": "uint256"} ], "outputs": [{"name": "", "type": "bool"}] }
Running on Linux.
LINUX-SPECIFIC NOTES:
Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)
Python 3 is typically 'python3' command
GNU tools are standard
Use 'xdg-open' command to open files/applications
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chain": "<chain>",
"contractAddress": "<contractAddress>",
"abi": "<abi>",
"functionName": "<functionName>",
"privateKey": "<privateKey>"
},
"name": "evm_send_contract_transaction"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| abi | Yes | Contract ABI (JSON array) | |
| chain | Yes | EVM chain to execute on | |
| value | No | ETH amount to send with transaction (optional, in ether) | |
| params | No | Function parameters (optional) | |
| privateKey | Yes | Private key to sign transaction (0x...) | |
| functionName | Yes | Function name to call | |
| contractAddress | Yes | Smart contract address (0x...) |