detectAddress | TON v2

The detectAddress method is used to detect the type and format of a TON address. This method provides detailed information about the given address, including its raw form, bounceable and non-bounceable representations, and whether it's a testnet address.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • address (string, required) — The address to detect. Example: EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2.

JSON-RPC example

curl -X POST \
  'https://ton-mainnet.core.chainstack.com/f2a2411bce1e54a2658f2710cd7969c3/api/v2/jsonRPC' \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "detectAddress",
    "params": {
      "address": "EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2"
    }
  }'

Response

  • raw_form (string) — The raw form of the address.
  • bounceable (object) — The bounceable representations of the address:
    • b64 (string) — The bounceable address in base64 format.
    • b64url (string) — The bounceable address in base64url format.
  • non_bounceable (object) — The non-bounceable representations of the address:
    • b64 (string) — The non-bounceable address in base64 format.
    • b64url (string) — The non-bounceable address in base64url format.
  • given_type (string) — The type of the given address (e.g., "friendly", "raw").
  • test_only (boolean) — Indicates whether the address is for testnet use only.

Use case

A possible use case for the detectAddress method in TON is for applications that need to handle various types of TON addresses. This method can be used to:

  1. Validate and normalize user-input addresses.
  2. Determine the appropriate format to use when interacting with smart contracts.
  3. Display different address representations to users based on context.
  4. Detect if an address is meant for testnet, preventing accidental use on mainnet.

Try the detectAddress RPC method yourself

Language
Click Try It! to start a request and see the response here!