JSON-RPC API Documentation

Β·

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

MethodNamespaceOKTC SupportNotes
Web3 Methods
web3_clientVersionWeb3βœ…Returns client version.
web3_sha3Web3βœ…Computes Keccak-256 hash.
Net Methods
net_versionNetβœ…Returns network ID.
net_peerCountNet❌Unsupported.
Eth Methods
eth_protocolVersionEthβœ…Returns protocol version.
eth_syncingEthβœ…Provides sync status.
eth_gasPriceEthβœ…Returns current gas price in OKT.
eth_accountsEthβœ…Lists all ETH accounts.
eth_blockNumberEthβœ…Returns latest block number.
eth_chainIdEthβœ…Returns chain ID in hex.
eth_getBalanceEthβœ…Retrieves account balance.
eth_getStorageAtEthβœ…Fetches storage data.
eth_getTransactionCountEthβœ…Returns transaction count.
eth_getBlockTransactionCountByNumberEthβœ…Counts transactions in a block.
eth_getCodeEthβœ…Retrieves contract code.
eth_signEthβœ…Signs a message.
eth_sendTransactionEthβœ…Submits a transaction.
eth_sendRawTransactionEthβœ…Submits signed transaction.
eth_callEthβœ…Executes a call.
eth_estimateGasEthβœ…Estimates gas usage.
eth_getBlockByNumberEthβœ…Retrieves block by number.
eth_getTransactionByHashEthβœ…Fetches transaction by hash.
eth_getTransactionReceiptEthβœ…Retrieves transaction receipt.
eth_newFilterEthβœ…Creates an event filter.
eth_getLogsEthβœ…Retrieves event logs.
WebSocket Methods
eth_subscribeWebsocketβœ…Subscribes to events.
eth_unsubscribeWebsocketβœ…Unsubscribes.
Personal Methods
personal_importRawKeyPersonalβœ…Imports a private key.
personal_listAccountsPersonalβœ…Lists managed accounts.
personal_unlockAccountPersonalβœ…Unlocks an account.
TXPool Methods
txpool_contentTXPoolβœ…Lists pending transactions.
txpool_statusTXPoolβœ…Returns pool stats.

Block Number Formats


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:

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