{% comment %}
This file is licensed under the MIT License (MIT) available on
http://opensource.org/licenses/MIT.
{% endcomment %}
{% assign filename="_includes/devdoc/dash-core/rpcs/rpcs/validateaddress.md" %}

##### ValidateAddress
{% include helpers/subhead-links.md %}
<!-- __ -->
{% assign summary_validateAddress="returns information about the given Dash address." %}

{% autocrossref %}

The `validateaddress` RPC {{summary_validateAddress}}

*Parameter #1---a P2PKH or P2SH address*

{% itemplate ntpd1 %}
- n: "Address"
  t: "string (base58)"
  p: "Required<br>(exactly 1)"
  d: "The P2PKH or P2SH address to validate encoded in base58check format"

{% enditemplate %}

*Result---information about the address*

{% itemplate ntpd1 %}
- n: "`result`"
  t: "object"
  p: "Required<br>(exactly 1)"
  d: "Information about the address"

- n: "→<br>`isvalid`"
  t: "bool"
  p: "Required<br>(exactly 1)"
  d: "Set to `true` if the address is a valid P2PKH or P2SH address; set to `false` otherwise"

- n: "→<br>`address`"
  t: "string (base58)"
  p: "Optional<br>(0 or 1)"
  d: "The Dash address given as parameter"

- n: "→<br>`scriptPubKey`"
  t: "string (hex)"
  p: "Optional<br>(0 or 1)"
  d: "The hex encoded scriptPubKey generated by the address"  

- n: "→<br>`ismine`"
  t: "bool"
  p: "Optional<br>(0 or 1)"
  d: "Set to `true` if the address belongs to the wallet; set to false if it does not.  Only returned if wallet support enabled"

- n: "→<br>`iswatchonly`"
  t: "bool"
  p: "Optional<br>(0 or 1)"
  d: "Set to `true` if the address is watch-only.  Otherwise set to `false`.  Only returned if address is in the wallet"

- n: "→<br>`isscript`"
  t: "bool"
  p: "Optional<br>(0 or 1)"
  d: "Set to `true` if a P2SH address; otherwise set to `false`.  Only returned if the address is in the wallet"

- n: "→<br>`script`"
  t: "string"
  p: "Optional<br>(0 or 1)"
  d: "Only returned for P2SH addresses belonging to this wallet. This is the type of script:<br>• `pubkey` for a P2PK script inside P2SH<br>• `pubkeyhash` for a P2PKH script inside P2SH<br>• `multisig` for a multisig script inside P2SH<br>• `nonstandard` for unknown scripts"

- n: "→<br>`hex`"
  t: "string (hex)"
  p: "Optional<br>(0 or 1)"
  d: "Only returned for P2SH addresses belonging to this wallet.  This is the redeem script encoded as hex"

- n: "→<br>`addresses`"
  t: "array"
  p: "Optional<br>(0 or 1)"
  d: "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"

- n: "→ →<br>Address"
  t: "string"
  p: "Optional<br>(0 or more)"
  d: "A P2PKH address"

- n: "→<br>`sigsrequired`"
  t: "number (int)"
  p: "Optional<br>(0 or 1)"
  d: "Only returned for multisig P2SH addresses belonging to the wallet.  The number of signatures required by this script"

- n: "→<br>`pubkey`"
  t: "string (hex)"
  p: "Optional<br>(0 or 1)"
  d: "The public key corresponding to this address.  Only returned if the address is a P2PKH address in the wallet"

- n: "→<br>`iscompressed`"
  t: "bool"
  p: "Optional<br>(0 or 1)"
  d: "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"

- n: "→<br>`account`"
  t: "string"
  p: "Optional<br>(0 or 1)"
  d: "*Deprecated: will be removed in a later version of Bitcoin Core*<br><br>The account this address belong to.  May be an empty string for the default account.  Only returned if the address belongs to the wallet"

- n: "→<br>`timestamp`"
  t: "number (int)"
  p: "Optional<br>(0 or 1)"
  d: "*Added in Dash Core 0.12.3*<br><br>The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)"

- n: "→<br>`hdkeypath`"
  t: "string"
  p: "Optional<br>(0 or 1)"
  d: "*Added in Bitcoin Core 0.13.0*<br><br>The HD keypath if the key is HD and available"  

- n: "→<br>`hdmasterkeyid`"
  t: "string (hash160)"
  p: "Optional<br>(0 or 1)"
  d: "*Added in Bitcoin Core 0.13.0*<br><br>The Hash160 of the HD master public key"  

{% enditemplate %}

*Example from Dash Core 0.12.3*

Validate the following P2PKH address from the wallet:

{% highlight bash %}
dash-cli validateaddress yNpezfFDfoikDuT1f4iK75AiLp2YLPsGAb
{% endhighlight %}

Result:

{% highlight json %}
{
  "isvalid": true,
  "address": "yNpezfFDfoikDuT1f4iK75AiLp2YLPsGAb",
  "scriptPubKey": "76a9141b767409bd8717b56cfcb00747811432ab1aa8a788ac",
  "ismine": true,
  "iswatchonly": false,
  "isscript": false,
  "pubkey": "02eacba539d92eb88d4e73bb32749d79f53f6e8d7947ac40a71bd4b26c13b6ec29",
  "iscompressed": true,
  "account": "Msig 1",
  "timestamp": 0
}
{% endhighlight %}

Validate the following P2SH multisig address from the wallet:

{% highlight bash %}
dash-cli -testnet validateaddress 8uJLxDxk2gEMbidF5vT8XLS2UCgQmVcroW
{% endhighlight %}

Result:

{% highlight json %}
{
  "isvalid": true,
  "address": "8uJLxDxk2gEMbidF5vT8XLS2UCgQmVcroW",
  "scriptPubKey": "a914a33155e490d146e656a9bac2cbee9c625ef42f0a87",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "script": "multisig",
  "hex": "522102eacba539d92eb88d4e73bb32749d79f53f6e8d7947ac40a71bd4b26c13b6ec29210311f97539724e0de38fb1ff79f5148e5202459d06ed07193ab18c730274fd0d882103251f25a5c0291446d801ba6df122f67a7dd06c60a9b332b7b29cc94f3b8f57d053ae",
  "addresses": [
    "yNpezfFDfoikDuT1f4iK75AiLp2YLPsGAb",
    "yWAk1cDVvsRdPYjnzcFkySJux75yaCE7xz",
    "yVJj7TB3ZhMcSP2wo65ZFNqy23BQH9tT87"
  ],
  "sigsrequired": 2,
  "account": "test account"
  "timestamp": 0  
}
{% endhighlight %}

*See also*

* [ImportAddress][rpc importaddress]: {{summary_importAddress}}
* [GetNewAddress][rpc getnewaddress]: {{summary_getNewAddress}}

{% endautocrossref %}
