EVM API

The EVM Execution endpoint allows you to execute EVM bytecode and state modifications through a proxy to the underlying JSON-RPC interface. This endpoint supports the same methods as the Ethereum JSON-RPC API, so for the full overview of available method calls please refer to their documentation.


POST/api

Execute an EVM Call

This endpoint executes an EVM call with the given parameters.

Body Parameters

  • Name
    jsonrpc
    Type
    string
    Description

    The JSON-RPC version. By default, it is set to "2.0".

  • Name
    id
    Type
    string
    Description

    The unique identifier for the request.

  • Name
    method
    Type
    string
    Description

    The method name of the JSON-RPC call.

  • Name
    params
    Type
    array
    Description

    An array containing the transaction details:

    • from: The address making the call.
    • to: The address of the smart contract being called.
    • data: The encoded function call and parameters.

Request

POST
/api
curl -X POST "https://testnet.mainsailhq.com/rpc/api/" \
  -H "Content-Type: application/json" \
  --data '{
   "jsonrpc": "2.0",
   "method": "eth_call",
   "params": [{
       "from": "0x2a74550fC2e741118182B7ab020DC0B7Ed01e1db", # acts as the sender, can be any wallet address
       "to": "0x229597C1CDEF0c1ac974C5aF581b5ef59DF6ecDF", # your ERC20 compliant contract
       "data": "0x06fdde03" # function sig for "name()"
     }, "latest"],
   "id": 1
 }'

Response

{
    "id":1,
    "jsonrpc":"2.0",
    "result":"0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064441524b32300000000000000000000000000000000000000000000000000000"
}