Click or drag to resize

How to validate addresses

Sometimes, it is important to use addresses from a client or generate some addresses. If you want to process it, it is good to know if the address is correct. There are two ways to validate it:

  1. Client REGEX verification

    You only need to validate your address with this REGEX:

    TESTNET: ^[T][a-km-zA-HJ-NP-Z0-9]{25,34}$
    MAINNET: ^[R][a-km-zA-HJ-NP-Z0-9]{25,34}$
  2. Node API RPC-JSON verification process

    It is safer to use node RPC for verification as it uses encrypt method to check if everything is ok.

    There is RPC method ValidateAddress.
    Example of call:

    curl -X POST -H 'Authorization: Basic xxx==' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"validateaddress", "params":["TQgjBozrWtNCjCkPZwEDkXgCu7iDo4uraa"],  "id":1525052699893}]'

    Example of result