Skip to main content

Overview

Addresses are a fundamental part of interacting with Quai Network. They represent the global identity of Externally Owned Accounts (accounts backed by a private key), contracts, and UTXO wallets. These functions help convert between various formats, validate addresses across the Quai and Qi address spaces, and other utilities for working with addresses. The Quais SDK supports the following address formats:
  • Quai addresses: Account ledger addresses
  • Qi addresses: UTXO ledger addresses
Quai and Qi addresses utilize a sharded address space to allow nodes and wallets to quickly identify which chain and ledger an address resides on. The first 9 bits of every address is the binary identification prefix, of which the first 8 bits are the chain identifiers, and the last bit is the ledger identifier. The following addresses are examples to illustrate how the binary identification prefixes work in practice.

Usage

Most commonly, the provided address utilities are used to validate addresses in the Quai and Qi address spaces.

Validate a Quai address

To validate a Quai address, you can use the isQuaiAddress function, which returns true if the address is in the Quai ledger scope, and false otherwise.

Validate a Qi address

In the case of Qi addresses, you can use the isQiAddress function, which returns true if the address is in the Qi ledger scope, and false otherwise.