The OKTC (OKX Chain) REST API provides developers with a powerful and flexible interface to interact with the blockchain. Whether you're retrieving account balances, analyzing block data, or exploring staking and governance parameters, this documentation outlines all essential endpoints with clear request and response structures.
With a rate limit of 6 requests per second, the API ensures stable performance while supporting real-time blockchain monitoring and integration into decentralized applications (dApps). Historical queries can include a height parameter—defaulting to the latest block—though nodes may purge older data; it's recommended to query within the last 10 blocks for reliable results.
Account Information
Understanding user account states is crucial for wallet development and transaction tracking.
Get Account Balance
Retrieve the balance of all currencies associated with a specific address.
By default, only partial currency data is returned. Use show=all to display all balances or specify a single currency like symbol=btc.
HTTP Request
GET okexchain/v1/accounts/{address}Request Parameters
- address (String, Required): The blockchain address to query.
- show (String, Optional): Set to
allfor full list,partialfor limited view. - symbol (String, Optional): Filter by currency symbol (e.g.,
btc).
Response Parameters
- address (String): Account address.
currencies (Array): List of currency holdings.
- symbol (String): Currency ticker.
- available (String): Spendable amount.
- locked (String): Temporarily unavailable balance.
👉 Explore real-time account data using advanced blockchain tools
Get Account Number and Sequence
Fetch critical account metadata used in transaction signing, including account_number and sequence (nonce).
HTTP Request
GET okexchain/v1/auth/accounts/{address}Request Parameters
- address (String, Required): Target account address.
Response Parameters
- account_number (String): Account creation sequence.
- sequence (String): Transaction nonce.
- eth_address (String): EVM-compatible address.
- public_key (String): Public key for verification.
- coins: Token balances held by the account.
Block Data Queries
Access detailed block information for network analysis and synchronization checks.
Get Latest Block
Fetch the most recent block on the chain.
HTTP Request
GET okexchain/v1/blocks/latestNo parameters required.
Key Response Fields
- block_id.hash: Unique block identifier.
- block.header.height: Current block height.
- block.header.time: Timestamp of block creation.
- block.data.txs: List of transactions in the block.
Get Block by Height
Retrieve block details at a specific height.
HTTP Request
GET okexchain/v1/blocks/{height}Replace {height} with the desired block number.
Response mirrors the latest block format, enabling historical analysis.
Get Transaction Info
Obtain detailed information about a transaction using its hash.
HTTP Request
GET okexchain/v1/txs/{hash}Response Includes
- from, to: Sender and receiver addresses.
- value: Transfer amount.
- gasPrice, gas: Execution cost metrics.
- blockNumber, blockHash: Associated block data.
- input: Smart contract interaction data.
👉 Monitor live transactions and validate smart contract interactions
Validator and Staking Operations
OKTC uses a delegated Proof-of-Stake model. These endpoints support staking analytics and validator monitoring.
Get Staking Parameters
Query current staking rules.
HTTP Request
GET okexchain/v1/staking/parametersKey Parameters
- unbonding_time: Duration before unstaked tokens are released.
- max_bonded_validators: Maximum active validators.
- min_delegation: Minimum Okt to delegate.
Get Validator List
Retrieve all validators on the network.
HTTP Request
GET okexchain/v1/staking/validators?status=allResponse Highlights
- operator_address: Validator’s operator key.
- status: Bonded, unbonding, or jailed.
- tokens: Total staked amount.
- commission.rate: Fee charged to delegators.
Get Delegator Rewards
Check pending rewards across all delegations.
HTTP Request
GET okexchain/v1/distribution/delegators/{delegatorAddr}/rewardsReturns an array of rewards from each validator, plus a total sum.
Get Unbonding Delegations
Track tokens currently in the unbonding process.
HTTP Request
GET okexchain/v1/staking/delegators/{address}/unbonding_delegationsEach entry includes:
- quantity: Amount unbonding.
- completion_time: When funds will be liquid.
Governance Insights
Participate in on-chain governance with full transparency.
Get Proposal List
List all active and past governance proposals.
HTTP Request
GET okexchain/v1/gov/proposalsEach proposal includes:
- id, title, description
- proposal_status: DepositPeriod, VotingPeriod, Passed, etc.
- voting_start/end_time
- final_tally_result: Vote breakdown
Get Tally by Proposal ID
View real-time vote counts for a specific proposal.
HTTP Request
GET okexchain/v1/gov/proposals/{ProposalID}/tallyOutput shows voting power distribution: yes, no, abstain, veto.
Get Votes by Proposal ID
See individual voter choices.
HTTP Request
GET okexchain/v1/gov/proposals/{ProposalID}/votesReturns list of voters and their selected option.
Smart Contract Interaction (WASM)
OKTC supports WASM-based smart contracts. These APIs enable contract inspection and state querying.
Query All Contract Codes
List all uploaded contract bytecodes.
HTTP Request
GET okexchain/v1/wasm/codeSupports pagination via limit, page_key, or offset.
Query Contract by Address
Get metadata about a deployed contract.
HTTP Request
GET okexchain/v1/wasm/contract/{contractAddr}Returns:
- code_id: Reference to source code.
- creator: Deployer address.
- label: Human-readable name.
Smart Query Contract Data
Execute custom queries on contract state.
HTTP Request
GET okexchain/v1/wasm/contract/{contractAddr}/smart/{query}?encoding=base64The query must be base64-encoded JSON representing the desired read operation.
Frequently Asked Questions
What is the rate limit for the OKTC REST API?
The API allows up to 6 requests per second per IP address. Exceeding this may result in temporary throttling.
How do I get a validator’s consensus key from their operator address?
Use the /staking/validators/{validatorAddr} endpoint. It returns consensus_pubkey, which is used in consensus signing.
Can I retrieve historical transaction data beyond 10 blocks?
While possible using the height parameter, nodes may have pruned old data. For long-term archives, consider running a full archival node.
How do I decode smart contract query responses?
Responses from /smart/ queries are typically Base64-encoded JSON. Decode them first, then parse as JSON to access structured data.
What does "sequence" mean in account data?
The sequence number represents the number of transactions sent from that account. It prevents replay attacks and must increment with each new transaction.
How can I track community pool distributions?
Use GET /distribution/community_pool to view the current balance of the community fund, which supports ecosystem development initiatives.
👉 Unlock advanced staking insights and governance participation tools