OKTC REST API Documentation: A Comprehensive Guide

This guide provides detailed information about the OKTC REST API, including rate limits, endpoints, and parameters for account management, block queries, staking, governance, and smart contract interactions.

👉 Explore OKTC’s advanced API features

Rate Limit

  • 6 requests per second
    Historical data queries using the height parameter default to the latest block (0). Nodes may prune historical data, so it’s recommended to query within the last 10 blocks.

Account Management

Get Balance

Retrieve the balance of all currencies for a single address.
Default: Shows partial currencies.
Parameters:
show=all: Displays all currencies.
symbol=btc: Filters for a specific currency (e.g., BTC).

HTTP Request

GET okexchain/v1/accounts/{address}

Request Parameters

Parameter Type Required Description
address String Yes Wallet address
show String No all or partial
symbol String No Currency symbol (e.g., btc)

Response Parameters

Parameter Type Description
address String Account address
currencies Array List of currencies
> symbol String Currency symbol
> available String Available balance
> locked String Locked balance

Get Account Number and Sequence

Retrieve a user’s account_number and sequence.

HTTP Request

GET okexchain/v1/auth/accounts/{address}

Response Parameters

Parameter Type Description
address String OKTC address
eth_address String Ethereum-compatible address
public_key String Account public key
account_number String Account creation sequence
sequence String Transaction nonce

👉 Learn more about OKTC account management


Block Queries

Get Latest Block

Fetch the latest block information.

HTTP Request

GET okexchain/v1/blocks/latest

Response Highlights

  • block_id: Block hash and parts.
  • header: Chain ID, proposer address, and timestamps.
  • data: List of transactions.

Get Block by Height

Retrieve block details using block height.

HTTP Request

GET okexchain/v1/blocks/{height}


Staking

Get Staking Parameters

Query current staking rules.

HTTP Request

GET okexchain/v1/staking/parameters

Key Parameters

Parameter Type Description
unbonding_time String Time to unbond tokens
max_bonded_validators Int Max active validators
min_delegation String Minimum delegation amount

Get Delegator Info

Fetch delegator details, including shares and bonded tokens.

HTTP Request

GET okexchain/v1/staking/delegators/{delegatorAddr}


Governance

Get Proposal by ID

Retrieve proposal details, including status and tally results.

HTTP Request

GET okexchain/v1/gov/proposals/{ProposalID}

Response Parameters

Parameter Type Description
proposal_status String DepositPeriod, VotingPeriod, etc.
total_deposit Array Deposit amount and denomination

Smart Contracts (WASM)

Query Contract Data

Fetch contract state or execute smart queries.

HTTP Request

GET okexchain/v1/wasm/contract/{contractAddr}/smart/{query}?encoding=base64

Request Parameters

Parameter Type Required Description
contractAddr String Yes Contract address
query String Yes Base64-encoded query

FAQ

1. What is the rate limit for OKTC’s API?

The API allows 6 requests per second. Historical data queries should target the last 10 blocks for reliability.

2. How do I filter balances for a specific currency?

Use the symbol parameter (e.g., symbol=btc) in the Get Balance endpoint.

3. What information does the Get Delegator Info endpoint provide?

It returns shares, bonded tokens, and proxy relationships for a delegator.

4. How can I query a smart contract’s state?

Use the /smart/{query} endpoint with a Base64-encoded query string.

5. What are the types of governance proposals?

Proposals include ParameterChangeProposal, with fields like title, description, and changes.

👉 Visit OKTC for advanced API tools