JSON-RPC methods and namespaces supported on OKTC.
Mainnet (Chain ID: 0x42, 66 in Decimal)
Endpoint:
π https://exchainrpc.okex.org/
3rd Party Providers
Optional third-party services may offer additional JSON-RPC support.
Pre-requisite Readings
Starting HTTP JSON-RPC
To initiate the HTTP JSON-RPC service, use curl or compatible tools. Alternatively, configure geth by downloading it from the official source.
JSON-RPC Methods
| Method | Namespace | OKTC Support | Notes |
|---|---|---|---|
| Web3 Methods | |||
web3_clientVersion | Web3 | β | Returns client version. |
web3_sha3 | Web3 | β | Computes Keccak-256 hash. |
| Net Methods | |||
net_version | Net | β | Returns network ID. |
net_peerCount | Net | β | Unsupported. |
| Eth Methods | |||
eth_protocolVersion | Eth | β | Returns protocol version. |
eth_syncing | Eth | β | Provides sync status. |
eth_gasPrice | Eth | β | Returns current gas price in OKT. |
eth_accounts | Eth | β | Lists all ETH accounts. |
eth_blockNumber | Eth | β | Returns latest block number. |
eth_chainId | Eth | β | Returns chain ID in hex. |
eth_getBalance | Eth | β | Retrieves account balance. |
eth_getStorageAt | Eth | β | Fetches storage data. |
eth_getTransactionCount | Eth | β | Returns transaction count. |
eth_getBlockTransactionCountByNumber | Eth | β | Counts transactions in a block. |
eth_getCode | Eth | β | Retrieves contract code. |
eth_sign | Eth | β | Signs a message. |
eth_sendTransaction | Eth | β | Submits a transaction. |
eth_sendRawTransaction | Eth | β | Submits signed transaction. |
eth_call | Eth | β | Executes a call. |
eth_estimateGas | Eth | β | Estimates gas usage. |
eth_getBlockByNumber | Eth | β | Retrieves block by number. |
eth_getTransactionByHash | Eth | β | Fetches transaction by hash. |
eth_getTransactionReceipt | Eth | β | Retrieves transaction receipt. |
eth_newFilter | Eth | β | Creates an event filter. |
eth_getLogs | Eth | β | Retrieves event logs. |
| WebSocket Methods | |||
eth_subscribe | Websocket | β | Subscribes to events. |
eth_unsubscribe | Websocket | β | Unsubscribes. |
| Personal Methods | |||
personal_importRawKey | Personal | β | Imports a private key. |
personal_listAccounts | Personal | β | Lists managed accounts. |
personal_unlockAccount | Personal | β | Unlocks an account. |
| TXPool Methods | |||
txpool_content | TXPool | β | Lists pending transactions. |
txpool_status | TXPool | β | Returns pool stats. |
Block Number Formats
- Hex string (e.g.,
"0x1") - Keywords:
"earliest","latest","pending"
Web3 Methods
web3_clientVersion
Retrieves the client version.
Example Request:
{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}Net Methods
net_version
Returns the network ID (e.g., "66" for OKTC Mainnet).
Example Response:
{"result":"66","id":1}Eth Methods
eth_getBalance
Fetches the balance of an address.
Parameters:
address: 20-byte account address.block: Block number or tag.
Example Request:
{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x...","latest"],"id":1}FAQ
How do I submit a transaction?
Use eth_sendTransaction or eth_sendRawTransaction with a signed payload.
Can I query historical blocks?
Yes. Use eth_getBlockByNumber with a block number or "earliest"/"latest".
Whatβs the difference between eth_call and eth_sendTransaction?
eth_call executes read-only operations, while eth_sendTransaction modifies the blockchain state.
π Explore more JSON-RPC methods