JSON-RPC API Documentation for OKTC

·

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:

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:


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.

MethodDescription
eth_protocolVersionCurrent Ethereum protocol version
eth_syncingSync status; returns boolean synced
eth_gasPriceCurrent gas price in OKT
eth_accountsList all accounts managed by the node
eth_blockNumberLatest block height
eth_chainIdChain identifier in hex (0x42)
eth_getBalanceBalance of an address at a given block
eth_getStorageAtRead raw storage data at a position
eth_getTransactionCountNonce for an account
eth_getBlockTransactionCountByNumber/HashNumber of transactions in a block
eth_getCodeGet contract bytecode
eth_signSign data with Ethereum-specific prefix
eth_sendTransactionSend a signed transaction
eth_sendRawTransactionBroadcast a pre-signed transaction
eth_callExecute read-only contract calls
eth_estimateGasEstimate gas needed for a transaction
eth_getBlockByNumber/HashRetrieve full block data
eth_getTransactionByHash/BlockHashAndIndexFetch transaction details
eth_getTransactionReceiptGet receipt after transaction confirmation
eth_newFilter, eth_newBlockFilter, eth_newPendingTransactionFilterCreate event filters
eth_uninstallFilterRemove a filter
eth_getFilterChanges, eth_getLogs, eth_getFilterLogs, eth_getTransactionLogsQuery 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:

eth_unsubscribe

Stop receiving updates using the subscription ID.


Personal Methods

Account management (use with caution—exposes private keys).

MethodDescription
personal_importRawKeyImport private key (currently not implemented)
personal_listAccountsList all managed accounts
personal_lockAccountLock an unlocked account
personal_newAccountCreate new encrypted account
personal_unlockAccountTemporarily unlock account for signing
personal_sendTransactionSign and send transaction using passphrase
personal_signSign arbitrary data
personal_ecRecoverRecover 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.

MethodDescription
txpool_contentDetailed list of pending/scheduled transactions
txpool_inspectHuman-readable summary of tx pool
txpool_statusCount 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

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.