Skip to main content

kaia_call

POST

Executes a contract's read-only method without creating or submitting a transaction. Primarily used to read the current state of a specific smart contract. State changes from the call do not occur.

🚧 Is the response taking a long time? Response time may vary based on function complexity!

When executing a smart contract function at a specific state, response time may increase depending on the function's complexity.

If you want faster responses, optimize the function being executed and minimize the function's execution result.

param[0]
callObjectobjectrequired
Call object for transaction simulation. May include the following fields.
  • from: Enter the transaction's from address as a string.
  • to : Enter the transaction's to address as a string.
  • gas : Enter the gas limit for the transaction as a hexadecimal string. For smart contract calls, you can enter 0x0 since no gas is consumed.
  • gasPrice : Enter the gas price per unit as a hexadecimal string.
  • value : The value field of the transaction.
  • data : The method signature hash of the transaction to execute. Can be referenced from the ABI.
fromstring
Enter the transaction's from address as a string.
tostring
Enter the transaction's to address as a string.
gasstring
Enter the gas limit for the transaction as a hexadecimal string. For smart contract calls, you can enter 0x0 since no gas is consumed.
gasPricestring
Enter the gas price per unit as a hexadecimal string.
valuestring
The value field of the transaction.
datastring
The method signature hash of the transaction to execute. Can be referenced from the ABI.
param[1]
blockNumberOrHashOrTagstringrequired
Use one of block hash, block number, or block tag to specify the block.
  • Block number: Hexadecimal string (e.g. "0x1")
  • Block hash: 64-digit hexadecimal string (e.g. "0x39008d07edf93c03bb9d1cfc80598fcf63f441ec86e9de3733fa6a484980ca48")]
  • Block tag: Enum string (e.g. "latest", "earliest", "pending")
    • earliest: The oldest available block on the chain.
    • finalized: A recently finalized block that can no longer be changed. Primarily used in proof-of-stake (PoS) blockchains.
    • safe: A recent block considered safe by the network (immune to reorgs).
    • latest: The most recent block on the chain (may be subject to reorgs).
    • pending: The next block to be mined, including pending transactions in the mempool.
param[2]
stateOverrideSetobjectrequired
Allows overriding the balance, nonce, code, and state of the smart contract being called for simulation at call time without changing actual values on the blockchain. May include the following fields.
  • balance: Hex string to override the account balance.
  • nonce: Hex string to override the account's nonce value.
  • code: Hex string for fake EVM bytecode to inject into the account.
  • state: Key-value pairs to override the account's storage state. Each key and value is expressed as a hex string.
  • stateDiff: Key-value pairs to override individual storage slots in the account's storage state. Similar to state but used when targeting only specific slot changes.
Responses
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://kaia-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "kaia_call",
"params": [
{
"to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"data": "0x70a08231000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
},
"latest",
{}
]
}'