This guide explains the built-in accounts system of the OKTC blockchain, detailing its custom account types, address formats, and practical usage.
Prerequisite Readings
To fully grasp the OKTC accounts system, familiarity with the following concepts is beneficial:
- Cosmos SDK Accounts: The foundational account system used within the Cosmos ecosystem.
- Ethereum Accounts: The account model employed by the Ethereum network.
The OKTC Account Model
OKTC implements a custom Account type that utilizes Ethereum's ECDSA secp256k1 curve for cryptographic keys. This design aligns with the EIP84 standard and supports full BIP44 derivation paths. The root Hierarchical Deterministic (HD) path for all OKTC-based accounts is m/44'/60'/0'/0.
Addresses and Public Keys
The OKTC network features three primary types of addresses and public keys by default:
- Accounts: These identify users, such as the sender of a transaction. They are derived using the
eth_secp256k1curve. - Validator Operators: These identify the operators of network validators. They are also derived using the
eth_secp256k1curve. - Consensus Nodes: These identify the validator nodes that actively participate in the network's consensus mechanism. They are derived using the
ed25519curve.
The following table summarizes the key differences:
| Type | Address bech32 Prefix | Pubkey bech32 Prefix | Curve | Address byte length | Pubkey byte length |
|---|---|---|---|---|---|
| Accounts | ex | expub | eth_secp256k1 | 20 | 33 (compressed) |
| Validator Operator | exvaloper | exvaloperpub | eth_secp256k1 | 20 | 33 (compressed) |
| Consensus Nodes | exvalcons | exvalconspub | ed25519 | 20 | 32 |
Address Formats for Client Compatibility
An OKTCAccount can be represented in two distinct formats to ensure compatibility across different tools and ecosystems.
- Bech32 Format: This is the default format for native Cosmos-SDK interactions, including CLI commands and REST API queries. It uses prefixes like
ex. - Hex Format: This is the standard Ethereum
common.Addressrepresentation (EIP-55), starting with0x. It ensures seamless compatibility with Ethereum-based Web3 tooling like MetaMask.
Examples:
- Address (Bech32):
ex1hcngft7gfkhn8z8fnlajzh7agyt0az0v6ztmme - Address (EIP-55 Hex):
0xBE2684Afc84daf3388E99FFB215FdD4116FE89EC - Compressed Public Key (Bech32):
expub17weu6qepqgantzvj79rywafrxmye524tpa8kp6akjct3nw7wel623lsnfwynqyfe75k
You can query an account address using the OKTC CLI. Note that the native Cosmos SDK Keyring (e.g., exchaincli keys) only outputs addresses in Bech32 format. To retrieve the Ethereum hex address, you must use the JSON-RPC oktc_accounts endpoint.
The Relationship Between 'ex' and '0x' Addresses
A single mnemonic phrase on OKTC generates two corresponding address formats:
- A Bech32 address with an
exprefix (e.g.,ex1hcngft7gfkhn8z8fnlajzh7agyt0az0v6ztmme) - A Hex address with a
0xprefix (e.g.,0x8aF3B04bF0400b16911b5A12360122148056d562)
These two addresses are different representations of the same underlying account. They share the same balance and are controlled by the same private keys. Importing the mnemonic into MetaMask will reveal the 0x address, while using exchaincli or checking a DEX web/mobile client will display the ex address.
How to Use Different Address Formats
The appropriate address format depends on the tool you are using:
exPrefix Addresses: These are used natively within the OKTC ecosystem. You can use them on mobile clients, web interfaces, andexchainclifor operations like transfers, staking, deposits, and voting.0xPrefix Addresses: These are primarily used for interacting with OKTC via Ethereum-compatible tooling. Currently, their main use is for transfer operations through MetaMask.
👉 Explore more strategies for managing cross-chain addresses
Important Note: When sending funds, you must use the correct address format for the recipient's context. Transfers must be sent to ex addresses from ex addresses and to 0x addresses from 0x addresses. Cross-format transfers are not possible.
Converting Between Address Formats
Since both address formats originate from the same mnemonic, they are mathematically interoperable and can be converted from one to the other.
- The
0xprefix address is a Hex format, the standard for Ethereum. - The
exprefix address is a Bech32 format, a standard defined by BIP173 and used by Bitcoin, Cosmos, and other chains.
You can programmatically convert between these formats using helper methods available in the official OKTC SDKs, such as convertAddressFromHexToBech32 and convertAddressFromBech32ToHex.
Frequently Asked Questions
What is the difference between an 'ex' address and a '0x' address?
They are two different representations of the same account on the OKTC blockchain. The 'ex' address (Bech32) is used for native Cosmos-SDK operations, while the '0x' address (Hex) is used for Ethereum tooling compatibility. Both are derived from the same private key and control the same funds.
Can I send funds from my 'ex' address to a '0x' address?
No, you cannot send funds directly between different address formats. You must send funds to an address of the same format. The recipient's wallet will automatically reflect the balance on both address formats since they represent the same account.
Which address should I use to stake or vote on the network?
You must use the native Bech32 format address (starting with ex) for all chain-specific operations like staking, governance voting, and using the CLI. These functionalities are built on the Cosmos SDK and require the native address format.
How do I find my '0x' address if I only have my 'ex' address?
You can use the conversion utilities provided in the official OKTC JavaScript or Java SDKs. By inputting your ex address into the convertAddressFromBech32ToHex method, you will receive the corresponding 0x address.
Why does OKTC support two address formats?
The dual-format system provides the best of both worlds: the robust staking and governance features of the Cosmos ecosystem (via Bech32) and full compatibility with the vast ecosystem of Ethereum wallets, dApps, and tools (via Hex).
Is my balance affected by the address format I use?
No, your balance is attached to your account, not to a specific address format. Whether you view your account through a tool that shows the ex address or one that shows the 0x address, you are looking at the same balance for the same account.