Execute a Read-Only Contract Query
post
/v1/besu/query
Executes a read-only smart contract call using the Ethereum JSON-RPC `eth_call` method.
Supports encoding requests with `functionSignature` and `functionArgs`. A contract execution revert is a completed query and returns HTTP 200 with `executionStatus: REVERTED`. HTTP error responses are reserved for request validation failures and communication failures with the Besu node.
Request
Header Parameters
-
X-Besu-Node: string
Optional operator-defined Besu node identifier. Supported values include
rpc-0,rpc-1,archive-0,validator-0, andbootnode-0. -
X-Request-Id: string
Optional correlation ID. Echoed in the response when provided.
Supported Media Types
- application/json
Root Schema : schema
Type:
objectDefines a read-only contract query.
Show Source
-
blockTag: string
Block tag: `latest`, `pending`, `earliest`, or a hexadecimal or decimal block number.
-
contractAbi: array
contractAbi
Optional ABI used to infer parameter types when `functionSignature` contains only a function name. If omitted, the ABI associated with `toAddress` is used when available.
-
data: string
Hexadecimal call data. If omitted and `functionSignature` is provided, call data is encoded automatically.
-
decode: object
QueryDecodeOptions
Decode options. Each option defaults to `false` when omitted.
-
ethValue: string
Optional value in wei for `eth_call`.
-
fromAddress(required): string
Required call sender. Must belong to the authenticated caller.
-
functionArgs: array
functionArgs
Function arguments as strings. Scalars use plain strings; arrays and tuples use JSON strings, such as '["1","2"]'.
-
functionSignature: string
Function signature for ABI encoding. Provide a fully specified signature, such as "balanceOf(address)", or a function name. For a function name, parameter types are inferred from `contractAbi` when provided or, when available, from the contract address.
-
gasLimit: integer
Optional gas limit for `eth_call` execution.
-
toAddress(required): string
Target contract address.
Nested Schema : contractAbi
Type:
arrayOptional ABI used to infer parameter types when `functionSignature` contains only a function name. If omitted, the ABI associated with `toAddress` is used when available.
Show Source
Nested Schema : QueryDecodeOptions
Type:
objectDecode options. Each option defaults to `false` when omitted.
Show Source
-
errors: boolean
Decode revert reasons. Decoding occurs only when true and decodable revert bytes are present.
-
outputs: boolean
Decode `rawResult` into function outputs, including nested tuples and arrays when ABI is available. If some values cannot be decoded, the response includes structured `meta.issues` and `null` for affected fields without failing the request.
Nested Schema : functionArgs
Type:
arrayFunction arguments as strings. Scalars use plain strings; arrays and tuples use JSON strings, such as '["1","2"]'.
Show Source
Nested Schema : items
Type:
objectExamples
Back to Top
Response
Supported Media Types
- application/json
200 Response
Returns the read-only contract query result.
Root Schema : QueryResponse
Type:
objectResult of a read-only contract query.
Show Source
-
blockTag(required): string
Block parameter used for the call: `latest`, `pending`, `earliest`, or a block number.
-
data(required): string
Calldata used for the call, in 0x-prefixed hexadecimal format.
-
decoded:
Decoded result for enabled decode options. `rawResult` contains the complete return value. For successful queries, incomplete or invalid ABI data can return `null` for affected fields and include structured `meta.issues` without failing the request. Output decoding applies to successful queries. Revert decoding is exposed through `decodedError`.
-
decodedError:
Decoded revert payload when `decode.errors=true` and sufficient information is available. Its absence does not change a reverted query into an HTTP error.
-
executionStatus(required): string
Allowed Values:
[ "SUCCESS", "REVERTED" ]`SUCCESS` when `eth_call` returns normally, or `REVERTED` when Besu completes `eth_call` and the EVM reverts. A reverted execution is returned with HTTP 200. -
from(required): string
Sender address used to execute `eth_call`.
-
rawResult: string
Return data from a successful `eth_call`, in 0x-prefixed hexadecimal format. Absent when `executionStatus` is `REVERTED`.
-
requestId: [
"string",
"null"
]
Client-provided correlation ID echoed for reverted queries.
-
to(required): string
Target contract address for the call.
-
upstreamCode: [
"integer",
"null"
]
Besu JSON-RPC error code when `executionStatus` is `REVERTED`.
-
upstreamData: [
"string",
"null"
]
Besu revert payload or error data when `executionStatus` is `REVERTED`.
-
upstreamError: [
"object",
"null"
]
upstreamError
Additional Properties Allowed:
trueComplete Besu error object for a reverted execution, including revert information.
Nested Schema : upstreamError
Type:
objectAdditional Properties Allowed:
trueComplete Besu error object for a reverted execution, including revert information.
Examples
400 Response
Validation failed.
Root Schema : ErrorResponse
Type:
objectError response returned by the service.
Show Source
-
decodedError:
Returned only when `decode.errors=true` and decodable revert bytes are present.
-
error: string
Short error summary suitable for display.
-
hint: [
"string",
"null"
]
Optional guidance for resolving the error.
-
message: [
"string",
"null"
]
Additional error details, when available.
-
policy:
Present for policy warnings or denials such as preflight failure.
-
preflight:
Present for preflight-gated transaction submission errors.
-
requestId: [
"string",
"null"
]
Client-provided correlation ID echoed in the response.
-
upstreamCode: [
"integer",
"null"
]
Besu node error code, when provided by the RPC endpoint.
-
upstreamData: [
"string",
"null"
]
Error data returned by the Besu node in 0x-prefixed hexadecimal or JSON format, when available.
-
upstreamError: [
"object",
"null"
]
upstreamError
Additional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Nested Schema : upstreamError
Type:
objectAdditional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
502 Response
Communication failure with the Besu node; EVM reverts return HTTP 200.
Root Schema : ErrorResponse
Type:
objectError response returned by the service.
Show Source
-
decodedError:
Returned only when `decode.errors=true` and decodable revert bytes are present.
-
error: string
Short error summary suitable for display.
-
hint: [
"string",
"null"
]
Optional guidance for resolving the error.
-
message: [
"string",
"null"
]
Additional error details, when available.
-
policy:
Present for policy warnings or denials such as preflight failure.
-
preflight:
Present for preflight-gated transaction submission errors.
-
requestId: [
"string",
"null"
]
Client-provided correlation ID echoed in the response.
-
upstreamCode: [
"integer",
"null"
]
Besu node error code, when provided by the RPC endpoint.
-
upstreamData: [
"string",
"null"
]
Error data returned by the Besu node in 0x-prefixed hexadecimal or JSON format, when available.
-
upstreamError: [
"object",
"null"
]
upstreamError
Additional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Nested Schema : upstreamError
Type:
objectAdditional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Examples