raw_call

Executes an isolated EVM call and returns the raw response bytes. Without a CLIENT, it builds a reusable READ and does not execute the call.

Example

Local

1
SELECT raw_call('0x0000000000000000000000000000000000000001'::ADDRESS, '0x'::BYTES);
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

raw_call(CLIENT, ADDRESS, BYTES) # Immediate Read · RPC required

Immediately calls the CLIENT's current state context. Only a live CLIENT necessarily resolves latest.

Inputs

Name Type Use
client CLIENT

CLIENT for retained execution state, local simulation, or live RPC.

required positional
to ADDRESS

Target address for eth_call.

required positional
data BYTES

ABI-encoded function selector and arguments.

required positional

Returns

Name Type
result BYTES

Raw eth_call bytes. Returns the raw BYTES result from eth_call. Decode it with ABI casts or ABI decode helpers when needed.

Guidance

Immediate call or reusable READ

CLIENT overloads execute immediately. Overloads without CLIENT only build a READ for observe or observe_after_step.

  • Use raw_call when calldata and raw return bytes are the desired interface.
  • Use read_contract for ABI encoding and typed SQL results.
  • Use call_decode when raw return bytes already exist and need ABI-derived columns.

State and failure behavior

The call is isolated and does not publish state changes.

  • Use a pinned CLIENT or explicit block number for repeatable chain reads.
  • Historical calls may require archive-capable RPC access.
  • Keep the raw BYTES result when exact response framing is evidence; decode only in a separate step.

Additional overloads

raw_call(CLIENT, ADDRESS, BYTES, BIGINT) # Immediate Read · RPC required

Adds an explicit numeric block height for deterministic historical calls.

Inputs

Name Type Use
client CLIENT

CLIENT for retained execution state, local simulation, or live RPC.

required positional
to ADDRESS

Target address for eth_call.

required positional
data BYTES

ABI-encoded function selector and arguments.

required positional
block_number BIGINT

Numeric block height for a reproducible historical call.

required positional

Returns

Name Type
result BYTES

Raw eth_call bytes. Returns the raw BYTES result from eth_call. Decode it with ABI casts or ABI decode helpers when needed.

Overload examples

Named parameters · RPC required

1
-- Pin Vitalik's WETH balance check to Ethereum mainnet block 21,000,000
2
WITH abi AS (
3
SELECT '[
4
{
5
"type": "function",
6
"name": "balanceOf",
7
"stateMutability": "view",
8
"inputs": [{ "name": "account", "type": "address" }],
9
"outputs": [{ "type": "uint256" }]
10
}
11
]'::JSON AS abi_json
12
),
13
calldata AS (
14
SELECT encode_function_data(abi.abi_json, 'balanceOf', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'::ADDRESS) AS data
15
FROM abi
16
)
17
SELECT raw_call($client,
18
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'::ADDRESS, -- Ethereum mainnet WETH
19
calldata.data,
20
21000000) AS raw_balance
21
FROM calldata;
raw_call(ADDRESS, BYTES) # Read Builder · RPC required

Builds a raw-call READ with default caller, value, and gas semantics; it does not execute the call.

Inputs

Name Type Use
to ADDRESS

Contract address that the later observation should call.

required positional
data BYTES

Exact ABI-encoded calldata for the later observation.

required positional

Returns

Name Type
read READ

Raw-call READ. Returns a canonical READ specification for a later isolated call observation.

raw_call(ADDRESS, BYTES, ADDRESS, UINT256, UBIGINT) # Read Builder · RPC required

Builds a raw-call READ with explicit caller, native value, and gas limit; it does not execute the call.

Inputs

Name Type Use
to ADDRESS

Contract address that the later observation should call.

required positional
data BYTES

Exact ABI-encoded calldata for the later observation.

required positional
caller ADDRESS

EVM msg.sender value exposed to the observed call.

required positional
value UINT256

Exact Wei value exposed to the observed call without transferring persistent state.

required positional
gas_limit UBIGINT

Maximum gas available to the observed call.

required positional

Returns

Name Type
read READ

Raw-call READ. Returns a canonical READ specification for a later isolated call observation.

Examples

Local SQL

1
SELECT raw_call('0x0000000000000000000000000000000000000001'::ADDRESS, '0x'::BYTES, '0x0000000000000000000000000000000000000000'::ADDRESS, 0::UINT256, 16777216);
Notebook ready in readonly mode.

Named parameters · RPC required

1
-- Check the WETH balance of Vitalik's address via balanceOf
2
WITH abi AS (
3
SELECT '[
4
{
5
"type": "function",
6
"name": "balanceOf",
7
"stateMutability": "view",
8
"inputs": [{ "name": "account", "type": "address" }],
9
"outputs": [{ "type": "uint256" }]
10
}
11
]'::JSON AS abi_json
12
),
13
calldata AS (
14
SELECT encode_function_data(abi.abi_json, 'balanceOf', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'::ADDRESS) AS data
15
FROM abi
16
)
17
SELECT raw_call($client,
18
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'::ADDRESS, -- Ethereum mainnet WETH
19
calldata.data) AS raw_balance
20
FROM calldata;
Notebook ready in readonly mode.

Related functions

Category and tags

Category
Chain reads
Tag
RPC
Tag
Simulate