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 covers all supported methods, namespaces, and best practices for integrating with OKTC’s Mainnet via HTTP or WebSocket connections.
Whether you're building decentralized applications (dApps), conducting blockchain analysis, or managing transactions, understanding the available JSON-RPC endpoints is essential. We’ll walk through core functionalities, supported methods by namespace, and practical usage examples.
Mainnet Overview
OKTC Mainnet operates with chain ID 0x42 (66 in decimal), ensuring compatibility with Ethereum tooling and wallets. Developers can connect directly using the public RPC endpoint:
- RPC URL:
https://exchainrpc.okex.org/
This node supports a wide range of standard Ethereum JSON-RPC calls, making it easy to port existing Ethereum-based projects to OKTC with minimal configuration changes.
👉 Discover how to connect your wallet and start interacting with OKTC today.
Prerequisites
Before diving into JSON-RPC interactions, ensure you have a foundational understanding of:
- Ethereum JSON-RPC API: Most methods follow the Ethereum specification. Review the official Ethereum JSON-RPC documentation for context on method behavior and expected responses.
- Hexadecimal Encoding: Many parameters use hex encoding with "0x" prefix. Be mindful of data types like
QUANTITY(hex-encoded numbers) andDATA(hex-encoded binary). - Block Identifiers: You can use
"latest","earliest","pending", or a specific block number (in hex) when querying chain state.
How to Start Using HTTP JSON-RPC
To make requests to the OKTC node, we recommend using curl for quick testing or integrating with geth for advanced use cases.
Using curl
Example request to get current block number:
curl -X POST https://exchainrpc.okex.org/ \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'Using Geth
You can also interact via geth attach if running a local node or connecting remotely. Download geth from official releases or build from source.
Supported JSON-RPC Methods by Namespace
Below is a complete list of supported methods across various namespaces. Unsupported methods are omitted for clarity.
Web3 Methods
These provide basic client information.
web3_clientVersion
Returns the version of the web3 client.
web3_sha3
Computes Keccak-256 hash (not SHA3-256) of input data.
Net Methods
Provides network-level details.
net_version
Returns the current network ID (66 for OKTC Mainnet).
Eth Methods
Core blockchain interaction methods.
| Method | Description |
|---|---|
eth_protocolVersion | Current Ethereum protocol version |
eth_syncing | Sync status; returns boolean synced |
eth_gasPrice | Current gas price in OKT |
eth_accounts | List all accounts managed by the node |
eth_blockNumber | Latest block height |
eth_chainId | Chain identifier in hex (0x42) |
eth_getBalance | Balance of an address at a given block |
eth_getStorageAt | Read raw storage data at a position |
eth_getTransactionCount | Nonce for an account |
eth_getBlockTransactionCountByNumber/Hash | Number of transactions in a block |
eth_getCode | Get contract bytecode |
eth_sign | Sign data with Ethereum-specific prefix |
eth_sendTransaction | Send a signed transaction |
eth_sendRawTransaction | Broadcast a pre-signed transaction |
eth_call | Execute read-only contract calls |
eth_estimateGas | Estimate gas needed for a transaction |
eth_getBlockByNumber/Hash | Retrieve full block data |
eth_getTransactionByHash/BlockHashAndIndex | Fetch transaction details |
eth_getTransactionReceipt | Get receipt after transaction confirmation |
eth_newFilter, eth_newBlockFilter, eth_newPendingTransactionFilter | Create event filters |
eth_uninstallFilter | Remove a filter |
eth_getFilterChanges, eth_getLogs, eth_getFilterLogs, eth_getTransactionLogs | Query logs and events |
Note: The eth_call method supports optional state override sets—ideal for simulating transactions or debugging without altering live state.👉 Learn how to simulate transactions securely before going live.
WebSocket Methods
Enable real-time event listening.
eth_subscribe
Subscribe to events like new blocks or pending transactions. Returns a subscription ID used to receive push notifications.
Supported subscriptions:
"newHeads"– new block headers"newPendingTransactions"– pending txs"logs"– filtered log events
eth_unsubscribe
Stop receiving updates using the subscription ID.
Personal Methods
Account management (use with caution—exposes private keys).
| Method | Description |
|---|---|
personal_importRawKey | Import private key (currently not implemented) |
personal_listAccounts | List all managed accounts |
personal_lockAccount | Lock an unlocked account |
personal_newAccount | Create new encrypted account |
personal_unlockAccount | Temporarily unlock account for signing |
personal_sendTransaction | Sign and send transaction using passphrase |
personal_sign | Sign arbitrary data |
personal_ecRecover | Recover signer address from signature |
🔐 Security Tip: Avoid exposing personal methods over public APIs. Use secure signing solutions like hardware wallets in production.
TXPool Methods
Inspect pending transactions.
| Method | Description |
|---|---|
txpool_content | Detailed list of pending/scheduled transactions |
txpool_inspect | Human-readable summary of tx pool |
txpool_status | Count of pending and queued transactions |
Useful for monitoring network congestion or diagnosing stuck transactions.
Frequently Asked Questions
Q: Is OKTC fully EVM-compatible?
A: Yes, OKTC supports most Ethereum JSON-RPC methods and uses the EVM, allowing seamless migration of dApps from Ethereum and other EVM chains.
Q: Can I use MetaMask with OKTC?
A: Absolutely. Add network manually using chain ID 66 and RPC URL https://exchainrpc.okex.org/.
Q: Why are some methods like eth_mining not supported?
A: OKTC uses a Proof-of-Stake consensus mechanism via Tendermint, so mining-related methods are irrelevant and disabled.
Q: How do I handle gas pricing?
A: Use eth_gasPrice to fetch current rates. Transactions must include sufficient gas in OKT.
Q: Can I run my own full node?
A: Yes, running a validator or full node gives you greater control and reliability. Refer to official OKTC documentation for setup guides.
Q: Are there rate limits on the public RPC?
A: While available for development, high-frequency applications should deploy their own nodes or use dedicated providers for stability.
Core Keywords
- JSON-RPC API
- OKTC blockchain
- Ethereum compatibility
- RPC methods
- Smart contract interaction
- Blockchain development
- Web3 integration
- Decentralized applications (dApps)
These terms reflect key search intents and are naturally integrated throughout this guide to enhance SEO visibility while maintaining readability.
With robust support for Ethereum-standard JSON-RPC calls, OKTC empowers developers to build scalable, interoperable dApps efficiently. By leveraging familiar tooling and extending functionality through secure APIs, the ecosystem fosters innovation across DeFi, NFTs, and Web3 services.
👉 Get started building on OKTC with powerful developer tools and resources.