dash-docs/_includes/ref_core_rpcs-uvwxyz.md

5.5 KiB

{% comment %} This file is licensed under the MIT License (MIT) available on http://opensource.org/licenses/MIT. {% endcomment %}

validateaddress

validateaddress <address>

{% autocrossref %}

Return information about the given Bitcoin address.

{% endautocrossref %}

Argument: An Address

{% autocrossref %}

String; required: A Bitcoin address.

{% endautocrossref %}

Result: Information About The Address

{% autocrossref %}

A JSON object containing one or more values (the exact number depending on the information). The result of isvalid is always returned to indicated whether or not the address is valid. If it is valid, the validated address is returned plus ismine to indicate whether or not it belongs to this wallet and account to indicate which account it belongs to. If it's a P2SH address, isscript will be true. If it's a P2PKH address, pubkey will contain the public key and compressed will indicate whether or not the pubkey/address is compressed.

{% endautocrossref %}

{
  "isvalid" : <true|false>,
  "address" : "<address>",
  "ismine" : <true|false>,
  "isscript" : <true|false>,
  "pubkey" : "<public key hex>",
  "iscompressed" : <true|false>,
  "account" : "<account>"
}

Example

{% autocrossref %}

Validate the following address from the wallet:

{% endautocrossref %}

> bitcoin-cli -testnet validateaddress mgnucj8nYqdrPFh2JfZSB1NmUThUGnmsqe

Result:

{
    "isvalid" : true,
    "address" : "mgnucj8nYqdrPFh2JfZSB1NmUThUGnmsqe",
    "ismine" : true,
    "isscript" : false,
    "pubkey" : "03bacb84c6464a58b3e0a53cc0ba4cb3b82848cd7bed25a7724b3cc75d76c9c1ba",
    "iscompressed" : true,
    "account" : "test label"
}

verifychain

verifychain [throughness] [blocks]

{% autocrossref %}

Verify the local blockchain database.

{% endautocrossref %}

Argument #1: Throughness

{% autocrossref %}

Number; optional: how thoroughly to check the database, from 0 to 4 with 4 being the most through. Defaults to 3.

{% endautocrossref %}

Argument #2: Number Of Blocks To Check

{% autocrossref %}

Number; optional: check this number of the most recent blocks.

{% endautocrossref %}

Result: Verified Or Not

True if verified.

Example

{% autocrossref %}

Verify the most recent 10,000 blocks in the most through way:

{% endautocrossref %}

> bitcoin-cli -testnet verifychain 4 10000

Result (took 25 seconds on a generic PC laptop):

true

verifymessage

verifymessage <address> <signature> <message>

{% autocrossref %}

Verify a signed message.

{% endautocrossref %}

Argument #1: The Address

{% autocrossref %}

String; required: the address corresponding to the private key used to create the signature.

{% endautocrossref %}

Argument #2: The Signature

{% autocrossref %}

String; required: the signature provided in the same base64 format generated by signmessage.

{% endautocrossref %}

Argument #3: The Message

{% autocrossref %}

String; required: the exact message which was signed.

{% endautocrossref %}

Result: True Or False

{% autocrossref %}

True if the message provided was signed by the private key corresponding to the address provided.

{% endautocrossref %}

Example

{% autocrossref %}

Check the signature on the message created in the example for signmessage:

{% endautocrossref %}

> bitcoin-cli -testnet verifymessage \
    mgnucj8nYqdrPFh2JfZSB1NmUThUGnmsqe \
    IOGreqb/7UgD1ifcojESd32ZJgH5RGzUXitmbl6ZbdenSmitipWoLSi73TskmLY7zhcD662bTw3RHoYQl/dOAhE= \
    'Hello, World!'

Result:

true

walletlock

walletlock

{% autocrossref %} Removes the wallet encryption key from memory, locking the wallet. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked. {% endautocrossref %}

Return

No return printed on success.

Example

> bitcoin-cli -testnet walletlock

(Success: nothing printed.)

walletpassphrase

walletpassphrase

{% autocrossref %} Stores the wallet decryption key in memory for the indicated number of seconds. Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock time that overrides the old one. {% endautocrossref %}

Argument #1: The Passphrase

{% autocrossref %} String; required: the passphrase to unlock the encrypted wallet. {% endautocrossref %}

Argument #2: The Number Of Seconds To Leave The Wallet Unlocked

{% autocrossref %} Number; required: The number of seconds after which the decryption key will be automatically deleted from memory. {% endautocrossref %}

Result

No result printed on success.

Example

{% autocrossref %} Unlock the wallet for 10 minutes (the passphrase is "test"): {% endautocrossref %}

> bitcoin-cli -testnet walletpassphrase test 600

(Success: no result printed.)

walletpassphrasechange

walletpassphrasechange <old passphrase> <new passphrase>

{% autocrossref %} Changes the wallet passphrase from 'old passphrase' to 'new passphrase'. {% endautocrossref %}

Argument #1: The Old Passphrase

String; required: the current passphrase.

Argument #2: The New Passphrase

String; required: the new passphrase.

Result

No result printed on success.

Example

Change the wallet passphrase from "test" to "example":

> bitcoin-cli -testnet walletpassphrasechange test example

(Success: no result printed.)