ValidateAddress

The validateaddress RPC returns information about the given Pai address.

Parameter #1—a P2PKH or P2SH address

Name Type Presence Description
Address string (base58) Required
(exactly 1)
The P2PKH or P2SH address to validate encoded in base58check format

Result—information about the address

Name Type Presence Description
result object Required
(exactly 1)
Information about the address

isvalid
bool Required
(exactly 1)
Set to true if the address is a valid P2PKH or P2SH address; set to false otherwise

address
string (base58) Optional
(0 or 1)
The pai address given as parameter

scriptPubKey
string (hex) Optional
(0 or 1)
The hex encoded scriptPubKey generated by the address

ismine
bool Optional
(0 or 1)
Set to true if the address belongs to the wallet; set to false if it does not. Only returned if wallet support enabled

iswatchonly
bool Optional
(0 or 1)
Set to true if the address is watch-only. Otherwise set to false. Only returned if address is in the wallet

isscript
bool Optional
(0 or 1)
Set to true if a P2SH address; otherwise set to false. Only returned if the address is in the wallet

script
string Optional
(0 or 1)
Only returned for P2SH addresses belonging to this wallet. This is the type of script:
pubkey for a P2PK script inside P2SH
pubkeyhash for a P2PKH script inside P2SH
multisig for a multisig script inside P2SH
nonstandard for unknown scripts

hex
string (hex) Optional
(0 or 1)
Only returned for P2SH addresses belonging to this wallet. This is the redeem script encoded as hex

addresses
array Optional
(0 or 1)
Only returned for P2SH addresses belonging to the wallet. A P2PKH addresses used in this script, or the computed P2PKH addresses of any pubkeys in this script. This array will be empty for nonstandard script types
→ →
Address
string Optional
(0 or more)
A P2PKH address

sigrequired
number (int) Optional
(0 or 1)
Only returned for multisig P2SH addresses belonging to the wallet. The number of signatures required by this script

pubkey
string (hex) Optional
(0 or 1)
The public key corresponding to this address. Only returned if the address is a P2PKH address in the wallet

iscompressed
bool Optional
(0 or 1)
Set to true if a compressed public key or set to false if an uncompressed public key. Only returned if the address is a P2PKH address in the wallet

account
string Optional
(0 or 1)
The account this address belong to. May be an empty string for the default account. Only returned if the address belongs to the wallet

hdkeypath
string Optional
(0 or 1)
The HD keypath if the key is HD and available

hdmasterkeyid
string (hash160) Optional
(0 or 1)
The Hash160 of the HD master public key

Example

Validate the following P2PKH address from the wallet:

pai-cli validateaddress PaXVxzkruFZPidQjsDft9CW174Tr99xngu

Result:

{
    "isvalid": true,
    "address": "PaXVxzkruFZPidQjsDft9CW174Tr99xngu",
    "scriptPubKey": "76a914492ae280d70af33acf0ae7cd329b961e65e9cbd888ac",
    "ismine": true,
    "iswatchonly": false,
    "isscript": false,
    "pubkey": "0312eeb9ae5f14c3cf43cece11134af860c2ef7d775060e3a578ceec888acada31",
    "iscompressed": true,
    "account": "Test"
}

Validate the following P2SH multisig address from the wallet:

pai-cli -testnet validateaddress PFZPidQjsDft9CW174Tr99xnguJMPc84JA

Result:

{
    "isvalid" : true,
    "address" : "PFZPidQjsDft9CW174Tr99xnguJMPc84JA",
    "ismine" : true,
    "iswatchonly" : false,
    "isscript" : true,
    "script" : "multisig",
    "hex" : "522103ede722780d27b05f0b1169efc90fa15a601a32fc6c3295114500c586831b6aaf2102ecd2d250a76d204011de6bc365a56033b9b3a149f679bc17205555d3c2b2854f21022d609d2f0d359e5bc0e5d0ea20ff9f5d3396cb5b1906aa9c56a0e7b5edc0c5d553ae",
    "addresses" : [
        "mjbLRSidW1MY8oubvs4SMEnHNFXxCcoehQ",
        "mo1vzGwCzWqteip29vGWWW6MsEBREuzW94",
        "mt17cV37fBqZsnMmrHnGCm9pM28R1kQdMG"
    ],
    "sigsrequired" : 2,
    "account" : "test account"
}

See also

  • ImportAddress: adds an address or pubkey script to the wallet without the associated private key, allowing you to watch for transactions affecting that address or pubkey script without being able to spend any of its outputs.
  • GetNewAddress: returns a new Pai address for receiving payments. If an account is specified, payments received with the address will be credited to that account.