REST API Methods for OKTC

ยท

Rate Limit: 6 requests per second.

For querying historical information, use the height parameter. The default value is 0 (latest block). Note that nodes may delete historical data; it's recommended to query the latest information within 10 blocks.


Account Management

Retrieve Account Balance

Fetch the balance of all currencies for a specified address. By default, only partial currencies are displayed. Use show=all to view all currencies or symbol=btc to filter for a specific currency.

HTTP Request

GET okexchain/v1/accounts/{address}

Request Parameters

ParameterTypeRequiredDescription
addressStringYesWallet address
showStringNoall (show all) or partial (default)
symbolStringNoFilter by currency (e.g., btc)

Response Parameters

ParameterTypeDescription
addressStringAccount wallet address
currenciesArrayList of currencies
> symbolStringCurrency symbol (e.g., BTC)
> availableStringAvailable balance
> lockedStringLocked balance

Retrieve Account Number and Sequence

Fetch the account_number and sequence for a user.

HTTP Request

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

Request Parameters

ParameterTypeRequiredDescription
addressStringYesAccount wallet address

Response Parameters

ParameterTypeDescription
addressStringWallet address
eth_addressStringEthereum-compatible address
public_keyStringAccount public key
account_numberStringAccount creation sequence number
sequenceStringAccount nonce
code_hashStringContract code hash
coinsArrayList of coins
> denomStringCoin denomination
> amountStringCoin amount

Block Information

Retrieve Latest Blocks

Fetch the latest block information.

HTTP Request

GET okexchain/v1/blocks/latest

Response Parameters

ParameterTypeDescription
block_idObjectBlock identifier
> hashStringBlock hash
blockObjectBlock details
> heightStringBlock height
> timeStringBlock creation timestamp

Retrieve Block by Height

Fetch block details by height.

HTTP Request

GET okexchain/v1/blocks/{height}

Response Parameters

(See "Retrieve Latest Blocks" for response structure.)


Retrieve Transaction by Hash

Fetch transaction details using its hash.

HTTP Request

GET okexchain/v1/txs/{hash}

Response Parameters

ParameterTypeDescription
hashStringTransaction hash
blockNumberStringBlock number containing the transaction
fromStringSender address
toStringReceiver address
valueStringTransaction amount

FAQ

How often can I query the API?

The API rate limit is 6 requests per second.

Can I retrieve historical block data?

Yes, but nodes may prune old data. Query the latest 10 blocks for reliability.

๐Ÿ‘‰ Explore OKTC API Documentation

What if my query exceeds the rate limit?

Your requests will be throttled. Implement retry logic with exponential backoff.


Validator Information

Retrieve Latest Validator Set

Fetch the current validator set.

HTTP Request

GET okexchain/v1/validatorsets/latest

Response Parameters

ParameterTypeDescription
validatorsArrayList of validators
> addressStringValidator wallet address
> voting_powerStringValidator voting power

Retrieve Validator Set by Height

Fetch validator set for a specific block height.

HTTP Request

GET okexchain/v1/validatorsets/{height}

Response Parameters

(Same as "Retrieve Latest Validator Set.")


Node Information

Check Node Sync Status

Verify if a node is syncing with the network.

HTTP Request

GET okexchain/v1/syncing

Response Parameters

ParameterTypeDescription
syncingBooltrue if syncing, false otherwise

๐Ÿ‘‰ Learn More About OKTC Staking