write_contract
Write data to smart contracts by calling state-changing functions, signing and submitting transactions that update blockchain state and pay gas.
Instructions
Write data to a smart contract by calling a state-changing function. This modifies blockchain state and requires gas payment and transaction signing.
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": {
"contractAddress": "<contractAddress>",
"abi": "<abi>",
"functionName": "<functionName>",
"args": "<args>",
"privateKey": "<privateKey>"
},
"name": "write_contract"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| abi | Yes | The ABI (Application Binary Interface) of the smart contract function, as a JSON array | |
| args | Yes | The arguments to pass to the function, as an array (e.g., ['0x1234...', '1000000000000000000']) | |
| privateKey | Yes | Private key of the sending account in hex format (with or without 0x prefix). SECURITY: This is used only for transaction signing and is not stored. | |
| functionName | Yes | The name of the function to call on the contract (e.g., 'transfer') | |
| contractAddress | Yes | The address of the smart contract to interact with |