eth_call
Executes a read-only call against a contract without creating a transaction on the blockchain. This is the primary method for reading data from smart contracts, such as querying ERC20 token balances, names, and allowances.
Parameters
| # | Type | Description |
|---|---|---|
| 1 | object | Transaction call object. |
| 2 | string | Block number as a hexadecimal string, or a block tag ("latest", "earliest", "pending"). |
The transaction call object supports these fields:
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | The contract address to call. |
data | string | Yes | ABI-encoded function call data. |
from | string | No | The address the call is sent from. |
value | string | No | Value in wei (hex) to send with the call. |
gas | string | No | Gas limit (hex) for the call. |
Returns
string -- The ABI-encoded return value of the contract function call.
Example
Read the WPLS (Wrapped PLS) balance of an address using the balanceOf(address) function selector 0x70a08231:
curl -s -X POST https://rpc.pulsechain.box \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"to": "0xA1077a294dDE1B09bB078844df40758a5D0f9a27",
"data": "0x70a08231000000000000000000000000A1077a294dDE1B09bB078844df40758a5D0f9a27"
}, "latest"],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"
}
Notes
- This method does not consume gas or modify blockchain state. It simulates the call against the specified block.
- The
datafield contains the 4-byte function selector followed by ABI-encoded arguments. Common selectors:0x70a08231--balanceOf(address)0x18160ddd--totalSupply()0x06fdde03--name()0x95d89b41--symbol()0x313ce567--decimals()0xdd62ed3e--allowance(address,address)
- The WPLS contract on PulseChain is
0xA1077a294dDE1B09bB078844df40758a5D0f9a27. - On an archive node, you can query any historical block to see contract state at that point in time.
- If the call reverts, the error response will include the revert reason when available.
- The return data must be ABI-decoded to extract meaningful values. For
balanceOf, the result is auint256representing the token balance in the token's smallest unit. - The actual returned value depends on the contract state at the queried block. The example above is illustrative; your result will vary based on the address and block you query.
eth_chainId
Returns the chain ID of the network the node is connected to. The chain ID is used in transaction signing to prevent replay attacks across different networks.
eth_createAccessList
Creates an EIP-2930 access list for a transaction. An access list specifies which addresses and storage slots the transaction will access, allowing for gas savings by pre-declaring state accesses.
