debug_traceCall - Celo

This method traces a call without creating a transaction on the Celo network. This is useful for simulating and debugging contract calls before submitting transactions.

Parameters

ParameterTypeRequiredDescription
callObjectobjectYesTransaction call object
blockNumberstringYesBlock number or "latest"
optionsobjectNoTracer configuration

Request Example

cURL

bashcurl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "debug_traceCall",
  "params": [
    {
      "to": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
      "data": "0x70a08231000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f8bb45"
    },
    "latest",
    {"tracer": "callTracer"}
  ]
}'

debug_traceCall.js

javascriptconst axios = require('axios');

const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';

const payload = {
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'debug_traceCall',
  params: [
    {
      to: '0x765DE816845861e75A25fCA122bb6898B8B1282a',
      data: '0x70a08231000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f8bb45'
    },
    'latest',
    { tracer: 'callTracer' }
  ]
};

axios.post(url, payload, {
  headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(JSON.stringify(response.data, null, 2)))
.catch(error => console.error(error));

debug_traceCall.py

pythonimport requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = {
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "debug_traceCall",
    "params": [
        {
            "to": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
            "data": "0x70a08231000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f8bb45"
        },
        "latest",
        {"tracer": "callTracer"}
    ]
}

response = requests.post(url, headers={"Content-Type": "application/json"}, json=payload)
print(json.dumps(response.json(), indent=2))

Response Example

Response (JSON)

json{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": {
    "type": "CALL",
    "from": "0x0000000000000000000000000000000000000000",
    "to": "0x765de816845861e75a25fca122bb6898b8b1282a",
    "gas": "0x2faf080",
    "gasUsed": "0x5a0",
    "input": "0x70a08231...",
    "output": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"
  }
}

Response Definition

FieldTypeDescription
resultobjectExecution trace

Use Cases

  • Simulate contract calls
  • Debug before submitting transactions
  • Analyze gas usage
  • Test cUSD/cEUR interactions

Error Handling

Error CodeDescription
-32602Invalid params
-32603Internal error
-32000Execution error