The OKT Chain (OKTC) provides comprehensive support for Ethereum-compatible JSON-RPC methods, enabling developers to interact seamlessly with the blockchain using familiar tools and protocols. This guide details the available JSON-RPC endpoints, supported namespaces, and practical usage examples tailored for blockchain developers, dApp creators, and node operators.
Whether you're querying account balances, estimating gas fees, or listening for real-time events via WebSocket, OKTC delivers a robust and efficient interface built on Ethereum standards while integrating Tendermint-based consensus under the hood.
👉 Discover powerful tools to interact with OKTC’s JSON-RPC API today.
Mainnet Configuration
OKTC Mainnet operates with chain ID 0x42 (66 in decimal), ensuring compatibility with Ethereum tooling and wallets. Developers can connect directly to the public RPC endpoint:
- RPC URL:
https://exchainrpc.okex.org/
This endpoint supports all core Ethereum JSON-RPC methods that are compatible with OKTC's architecture. Always verify your chain ID when deploying contracts or signing transactions to prevent cross-chain errors.
Prerequisites for Using JSON-RPC
Before making JSON-RPC calls, ensure you have a foundational understanding of:
- Ethereum JSON-RPC API — The standard specification that OKTC follows.
- Hexadecimal encoding and data formatting used in Ethereum-style blockchains.
- How to construct HTTP requests using tools like
curlor via Ethereum clients such as Geth.
While Geth is not required, it can be used to interact with OKTC if configured with the correct network settings.
Supported JSON-RPC Methods Overview
OKTC supports a wide range of Ethereum-standard JSON-RPC methods across multiple namespaces. Below is a categorized breakdown of supported functionality.
Note: Block numbers can be specified as a hex string,"latest","earliest", or"pending".
Web3 Namespace
web3_clientVersion
Returns the current client version of the node.
web3_sha3
Computes the Keccak-256 hash (not SHA3-256) of the given data. Useful for hashing method signatures and parameters.
Net Namespace
net_version
Returns the current network ID (66 for OKTC Mainnet), essential for wallet and dApp configuration.
❌ Unsupported:net_peerCount,net_listening
Eth Namespace (Core Functionality)
The eth_ namespace includes most of the critical methods for interacting with the blockchain.
| Method | Purpose |
|---|---|
eth_protocolVersion | Get the current Ethereum protocol version |
eth_syncing | Check sync status; returns boolean indicating if syncing is complete |
eth_gasPrice | Retrieve current gas price in OKT |
eth_accounts | List all available account addresses managed by the node |
eth_blockNumber | Return current block height |
eth_chainId | Get chain identifier in hex format (0x42) |
eth_getBalance | Query account balance by address and block number |
eth_getStorageAt | Read raw storage data at a specific position |
eth_getTransactionCount | Get nonce (outgoing transaction count) for an account |
eth_getCode | Fetch contract bytecode at an address |
eth_sign | Sign data using a specific Ethereum account (requires unlocked key) |
eth_sendTransaction | Send a signed transaction directly from an account |
eth_sendRawTransaction | Broadcast a pre-signed transaction |
eth_call | Execute read-only smart contract calls without gas cost |
eth_estimateGas | Estimate gas needed for a transaction |
eth_getBlockByNumber / eth_getBlockByHash | Retrieve full block details |
eth_getTransactionByHash / eth_getTransactionReceipt | Get transaction and receipt data |
eth_getLogs, eth_newFilter, eth_getFilterChanges | Filter and retrieve event logs |
❌ Unsupported: Mining-related (eth_mining,miner_*), debugging (debug_*), whisper (shh_*), and database (db_*) methods.
WebSocket Namespace
Enable real-time event listening using:
eth_subscribe
Subscribe to events such as new blocks, logs, or pending transactions. Returns a subscription ID.
Supported event types:
"newHeads"– New block headers"logs"– Contract logs matching filter"pendingTransactions"– Transactions entering the mempool
eth_unsubscribe
Stop receiving updates using the subscription ID.
👉 Start building real-time blockchain applications with live event streams.
Personal Namespace (Account Management)
Securely manage local accounts stored in the node’s key store.
personal_newAccount
Create a new encrypted account with a passphrase.
personal_listAccounts
List all accounts managed by the node.
personal_importRawKey
Import a private key (not currently implemented).
personal_lockAccount / personal_unlockAccount
Lock or temporarily unlock an account for signing operations.
personal_sign / personal_ecRecover
Sign messages and recover Ethereum addresses from signatures.
personal_sendTransaction
Sign and send a transaction using passphrase authentication (does not globally unlock account).
🔐 Security Note: Account unlocking should be done cautiously and only in secure environments.
TXPool Namespace
Inspect pending transactions in the transaction pool.
txpool_content
View detailed list of all pending and queued transactions.
txpool_inspect
Get a human-readable summary of transactions by sender and recipient.
txpool_status
Quickly check counts of pending and queued transactions.
Useful for monitoring network congestion or tracking unconfirmed transactions.
Frequently Asked Questions
What is JSON-RPC and why is it important?
JSON-RPC is a lightweight remote procedure call protocol encoded in JSON. It allows applications to communicate with blockchain nodes to read data, send transactions, and listen for events. For OKTC, it enables full interoperability with Ethereum tooling like MetaMask, Hardhat, and Web3.js.
Which tools can I use to call OKTC’s JSON-RPC?
You can use:
- Command-line tools like
curl - JavaScript libraries such as Web3.js or Ethers.js
- Development frameworks like Hardhat or Truffle
- Wallets that support custom RPC endpoints
Is Geth required to interact with OKTC?
No. While Geth can be used, OKTC provides a public RPC endpoint (https://exchainrpc.okex.org/) that supports standard Ethereum JSON-RPC methods. You can interact directly using any compatible client or library.
Why are some methods like eth_mining not supported?
OKTC uses a Proof-of-Stake consensus mechanism based on Tendermint, not mining. Therefore, mining-related RPCs (e.g., eth_mining, miner_start) are irrelevant and disabled.
How do I handle gas pricing on OKTC?
Use the eth_gasPrice method to retrieve the current recommended gas price in OKT. This value can be used when constructing transactions to ensure timely confirmation.
Can I subscribe to smart contract events in real time?
Yes! Use eth_subscribe("logs", { address: "0x...", topics: [...] }) over WebSocket to receive instant notifications whenever matching events are emitted.
Final Thoughts
OKTC's JSON-RPC API offers a powerful, Ethereum-compatible interface ideal for developers building decentralized applications, analyzing blockchain data, or managing transactions programmatically. With strong support for core methods and real-time event streaming, it provides everything needed to integrate with modern Web3 infrastructure.
👉 Explore advanced features and elevate your blockchain development workflow now.