contracts

Invoke a smart contract

Returns a result from EVM execution such as cost-free execution of read-only smart contract queries, gas estimation, and transient simulation of read-write operations. If the estimate field is set to true gas estimation is executed. This API can process calls against the latest block or specific historical blocks when a hexadecimal or decimal block number is provided in the block field.

post/api/v1/contracts/call

Request body

blockstring nullable

Hexadecimal block number or the string "latest", "pending", "earliest". Defaults to "latest".

datastring binary nullable

Hexadecimal method signature and encoded parameters. Up to 131072 bytes as at most 262146 hexadecimal digits including optional leading 0x.

estimateboolean nullable

Whether gas estimation is called. Defaults to false.

fromstring binary nullable

The 20-byte hexadecimal EVM address the transaction is sent from.

gasinteger nullable

Gas provided for the transaction execution. Defaults to 15000000.

gasPriceinteger nullable

Gas price used for each paid gas.

tostring binary required

The 20-byte hexadecimal EVM address the transaction is directed to.

valueinteger nullable

Value sent with this transaction. Defaults to 0.

Example request

{
  "block": "latest",
  "data": "0x47f1aae7",
  "estimate": true,
  "from": "00000000000000000000000000000000000004e2",
  "gas": 15000000,
  "gasPrice": 100000000,
  "to": "0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6"
}

Response

OK

resultstring binary

Result in hexadecimal from executed contract call.

Example response

{
  "result": "0x0000000000006d8d"
}

Changes

Changed in 2 of the 53 revisions of this API.197

    • the request property block became not nullable

      request-property-became-not-nullable

    • the request property data became not nullable

      request-property-became-not-nullable

    • the request property estimate became not nullable

      request-property-became-not-nullable

    • the request property from became not nullable

      request-property-became-not-nullable

    • the request property gas became not nullable

      request-property-became-not-nullable

    • the request property gasPrice became not nullable

      request-property-became-not-nullable

    • the request property value became not nullable

      request-property-became-not-nullable

  • v1db389f03b097127See the full diff
    • the response property _status/messages/items/data became nullable for the status 400

      response-property-became-nullable

    • the response property _status/messages/items/data became nullable for the status 404

      response-property-became-nullable

    • the response property _status/messages/items/data became nullable for the status 415

      response-property-became-nullable

    • the response property _status/messages/items/data became nullable for the status 429

      response-property-became-nullable

    • the response property _status/messages/items/data became nullable for the status 500

      response-property-became-nullable

    • the response property _status/messages/items/data became nullable for the status 501

      response-property-became-nullable

    • the response property _status/messages/items/detail became nullable for the status 400

      response-property-became-nullable

    • the response property _status/messages/items/detail became nullable for the status 404

      response-property-became-nullable

    • the response property _status/messages/items/detail became nullable for the status 415

      response-property-became-nullable

    • the response property _status/messages/items/detail became nullable for the status 429

      response-property-became-nullable

    • the response property _status/messages/items/detail became nullable for the status 500

      response-property-became-nullable

    • the response property _status/messages/items/detail became nullable for the status 501

      response-property-became-nullable

    • the request property block became nullable

      request-property-became-nullable

    • the request property data became nullable

      request-property-became-nullable

    • the request property estimate became nullable

      request-property-became-nullable

    • the request property from became nullable

      request-property-became-nullable

    • the request property gas became nullable

      request-property-became-nullable

    • the request property gasPrice became nullable

      request-property-became-nullable

    • the request property value became nullable

      request-property-became-nullable

    This revision also has 22 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog