```{eval-rst} .. _api-rpc-wallet: .. meta:: :title: Wallet RPCs :description: A list of remote procedure calls in Dimecoin that are used to perform wallet operations such as sending, creating and categorizing addresses, etc. ``` > ***We put our best effort into covering all topics related to Dimecoin. Each section will cover a different category. Not all documentation may be 100% accurate, if you spot an error, please report it or submit a PR request on GitHub.*** > > ***REMINDER: This documentation is always evolving. If you have not been here for a while, perhaps check again. Things may have been added or updated since your last visit!*** ## Wallet RPCs ```{admonition} Wallet Support RPCs that require wallet support are **not available on masternodes** for security reasons. Such RPCs are designated with a "*Requires wallet support*" message. ``` ### AbandonTransaction The [`abandontransaction` RPC](../api/rpc-wallet.md#abandontransaction) marks an in-wallet transaction and all its in-wallet descendants as abandoned. This allows their inputs to be respent. *Parameter #1---a transaction identifier (TXID)* | Name | Type | Presence | Description | | ---- | ------------ | ----------------------- | -------------------------------------------------------------------------------------------------------- | | TXID | string (hex) | Required
(exactly 1) | The TXID of the transaction that you want to abandon. The TXID must be encoded as hex in RPC byte order | *Result---`null` on success* | Name | Type | Presence | Description | | -------- | ---- | ----------------------- | ------------------------------------------------------------------- | | `result` | null | Required
(exactly 1) | JSON `null` when the transaction and all descendants were abandoned | *Example from Dimecoin Core 2.3.0.0* Abandons the transaction on your node. ```bash dimecoin-cli abandontransaction fa3970c341c9f5de6ab13f128cbfec58d732e736a505fe32137ad551c799ecc4 ``` Result (no output from `dimecoin-cli` because result is set to `null`). ```{seealso} * [SendRawTransaction](../api/rpc-raw-transactions.md#sendrawtransaction): validates a transaction and broadcasts it to the peer-to-peer network. ``` ### AbortRescan The [`abortrescan` RPC](../api/rpc-wallet.md#abortrescan) stops current wallet rescan Stops current wallet rescan triggered e.g. by an [`importprivkey` RPC](../api/rpc-wallet.md#importprivkey) call. *Parameters: none* *Result---`true` on success* | Name | Type | Presence | Description | | -------- | ---- | ----------------------- | -------------------------------------------------------------------- | | `result` | null | Required
(exactly 1) | `true` when the command was successful or `false` if not successful. | *Example from Dimecoin Core 2.3.0.0* Abort the running wallet rescan ```bash dimecoin-cli -mainnet abortrescan ``` Result: ```text true ``` ```{seealso} *none* ``` ### AddMultiSigAddress ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) ``` The [`addmultisigaddress` RPC](../api/rpc-wallet.md#addmultisigaddress) adds a P2SH multisig address to the wallet. Each key is a Dimecoin address or hex-encoded public key. This functionality is only intended for use with non-watchonly addresses. See [`importaddress` RPC](../api/rpc-wallet.md#importaddress) for watchonly p2sh address support. If 'label' is specified, assign address to that label. *Parameter #1---the number of signatures required* | Name | Type | Presence | Description | | -------- | ------------ | ----------------------- | ------------------------------------------------------------------------------------ | | Required | number (int) | Required
(exactly 1) | The minimum (*m*) number of signatures required to spend this m-of-n multisig script | *Parameter #2---the full public keys, or addresses for known public keys* | Name | Type | Presence | Description | | ------------------- | ------ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Keys Or Addresses | array | Required
(exactly 1) | An array of strings with each string being a public key or address | | →
Key Or Address | string | Required
(1 or more) | A public key against which signatures will be checked. Alternatively, this may be a P2PKH address belonging to the wallet---the corresponding public key will be substituted. There must be at least as many keys as specified by the Required parameter, and there may be more keys | *Parameter #3---label* | Name | Type | Presence | Description | | ----- | ------ | -------------------- | ----------------------------------- | | Label | string | Optional
(0 or 1) | A label to assign the addresses to. | *Result---P2SH address and hex-encoded redeem script* | Name | Type | Presence | Description | | ------------------- | --------------- | ----------------------- | ------------------------------------------------ | | `result` | object | Required
(exactly 1) | An object describing the multisig address | | →
`address` | string (base58) | Required
(exactly 1) | The P2SH address for this multisig redeem script | | →
`redeemScript` | string (hex) | Required
(exactly 1) | The multisig redeem script encoded as hex | *Example from Dimecoin Core 2.3.0.0* Adding a 1-of-2 P2SH multisig address with the label "test label" by combining one P2PKH address and one full public key: ```bash dimecoin-cli -mainnet -rpcwallet="" addmultisigaddress 1 ''' [ "7SxkBWzPwMrZLAY9ZPitMnSwf4NSUBPbiH", "02594523b004e82849a66b3da096b1e680bf2ed5f7d03a3443c027aa5777bb6223" ] ''' 'test label' ``` Result: ```json { "address": "8jYUv8hJcbSUPbwYmzp1XMPU6SXoic3hwi", "redeemScript": "512103283a224c2c014d1d0ef82b00470b6b277d71e227c0e2394f9baade5d666e57d32102594523b004e82849a66b3da096b1e680bf2ed5f7d03a3443c027aa5777bb622352ae", "descriptor": "sh(multi(1,[48de9d39]03283a224c2c014d1d0ef82b00470b6b277d71e227c0e2394f9baade5d666e57d3,[dec361f1]02594523b004e82849a66b3da096b1e680bf2ed5f7d03a3443c027aa5777bb6223))#vtc5zmh2" } ``` (New P2SH multisig address also stored in wallet.) ```{seealso} * [CreateMultiSig](../api/rpc-utility.md#createmultisig): creates a P2SH multi-signature address. * [DecodeScript](../api/rpc-raw-transactions.md#decodescript): decodes a hex-encoded P2SH redeem script. ``` ### BackupWallet ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) ``` The [`backupwallet` RPC](../api/rpc-wallet.md#backupwallet) safely copies `wallet.dat` to the specified file, which can be a directory or a path with filename. *Parameter #1---destination directory or filename* | Name | Type | Presence | Description | | ----------- | ------ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Destination | string | Required
(exactly 1) | A filename or directory name. If a filename, it will be created or overwritten. If a directory name, the file `wallet.dat` will be created or overwritten within that directory | *Result---`null` or error* | Name | Type | Presence | Description | | -------- | ---- | ----------------------- | ------------------------------------------------------------------------------------------------------------------ | | `result` | null | Required
(exactly 1) | Always `null` whether success or failure. The JSON-RPC error and message fields will be set if a failure occurred | *Example from Dimecoin Core 2.3.0.0* ```bash dimecoin-cli -mainnet backupwallet /tmp/backup.dat ``` ```{seealso} * [ImportWallet](../api/rpc-wallet.md#importwallet): imports private keys from a file in wallet dump file format. These keys will be added to the keys currently in the wallet. This call may need to rescan all or parts of the blockchain for transactions affecting the newly-added keys, which may take several minutes. ``` ## CreateWallet ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) ``` The [`createwallet` RPC](../api/remote-procedure-calls-wallet.md#createwallet) creates and loads a new wallet. *Parameter #1---wallet name* | Name | Type | Presence | Description | | ------------- | ------ | ----------------------- | ------------------------------------------------------------------------------------------------ | | `wallet_name` | string | Required
(exactly 1) | The name for the new wallet. If this is a path, the wallet will be created at the path location. | *Parameter #2---disable private keys_ | Name | Type | Presence | Description | | ---------------------- | ---- | -------------------- | ----------------------------------------------------------------------------------- | | `disable_private_keys` | bool | Optional
(0 or 1) | Disable the possibility of private keys. Only watchonlys are possible in this mode. | *Parameter #3---passphrase* | Name | Type | Presence | Description | | ------------ | ------ | -------------------- | ---------------------------------------- | | `passphrase` | string | Optional
(0 or 1) | Encrypt the wallet with this passphrase. | *Result---wallet name and any warnings* | Name | Type | Presence | Description | | -------------- | ------ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | `result` | object | Required
(exactly 1) | An object containing information about wallet creation | | →
`name` | string | Required
(exactly 1) | The wallet name if created successfully. If the wallet was created using a full path, the `wallet_name` will be the full path | | →
`warning` | string | Required
(exactly 1) | Warning message if wallet was not loaded cleanly. | *Example from Dimecoin Core 2.3.0.0* ```bash dimecoin-cli -mainnet createwallet new-wallet ``` Result: ```json { "name": "new-wallet", "warning": "" } ``` ```{note} In the example above, a new directory named `new-wallet` was created in the current data directory (`~/.dimecoincore/testnet3/`). This new directory contains the wallet.dat file and other related wallet files for the new wallet. ``` ```{seealso} * [LoadWallet](../api/remote-procedure-calls-wallet.md#loadwallet): loads a wallet from a wallet file or directory. ``` ### DumpPrivKey ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**). Requires an unlocked wallet or an unencrypted wallet. ``` The [`dumpprivkey` RPC](../api/rpc-wallet.md#dumpprivkey) returns the wallet-import-format (WIP) private key corresponding to an address. (But does not remove it from the wallet.) *Parameter #1---the address corresponding to the private key to get* | Name | Type | Presence | Description | | ------------- | --------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | P2PKH Address | string (base58) | Required
(exactly 1) | The P2PKH address corresponding to the private key you want returned. Must be the address corresponding to a private key in this wallet | *Result---the private key* | Name | Type | Presence | Description | | -------- | --------------- | ----------------------- | ----------------------------------------------------------------- | | `result` | string (base58) | Required
(exactly 1) | The private key encoded as base58check using wallet import format | *Example from Dimecoin Core 2.3.0.0* ```bash dimecoin-cli -mainnet dumpprivkey 7cBuREgSskHHkWLxDa9A5WppCki6PfFycL ``` Result: ```text dQZZ4awQvcDHyFS3CmURqSgeTobQm9t9nyUr337kvUtsWsnvvQyw ``` ```seealso * [ImportPrivKey](../api/rpc-wallet.md#importprivkey): adds a private key to your wallet. The key should be formatted in the wallet import format created by the [`dumpprivkey` RPC](../api/rpc-wallet.md#dumpprivkey). * [DumpWallet](../api/rpc-wallet.md#dumpwallet): creates or overwrites a file with all wallet keys in a human-readable format. ``` ## DumpWallet ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**). Requires an unlocked wallet or an unencrypted wallet. ``` The [`dumpwallet` RPC](../api/remote-procedure-calls-wallet.md#dumpwallet) creates or overwrites a file with all wallet keys in a human-readable format. *Parameter #1---a filename* | Name | Type | Presence | Description | | -------- | ------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Filename | string | Required
(exactly 1) | The filename with path (either absolute or relative to Dimecoin Core) into which the wallet dump will be placed. An existing file with that name will be overwritten. | *Result---information about exported wallet* | Name | Type | Presence | Description | | ---------------------- | ------------ | ----------------------- | ------------------------------------------------------------------- | | `result` | object | Required
(exactly 1) | An object describing dumped wallet file | | →
`version` | string | Required
(exactly 1) | Dimecoin Core build details | | →
`lastblockheight` | int | Required
(exactly 1) | Height of the most recent block received | | →
`lastblockhash` | string (hex) | Required
(exactly 1) | Hash of the most recent block received | | →
`lastblocktime` | string | Required
(exactly 1) | Timestamp of the most recent block received | | →
`keys` | int | Required
(exactly 1) | Number of keys dumped | | →
`filename` | string | Required
(exactly 1) | Name of the file the wallet was dumped to | | →
`warning` | string | Required
(exactly 1) | Warning to not share the file due to it containing the private keys | *Example from Dimecoin Core 2.3.0.0* Create a wallet dump and then print its first 10 lines. ```bash dimecoin-cli -mainnet dumpwallet /tmp/dump.txt head /tmp/dump.txt ``` Results: ```json { "version": "v2.3.0.0", "lastblockheight": 250186, "lastblockhash": "0000000000a82fb1890de5da4740d0671910a436fe6fc4503a3e553adef073b4", "lastblocktime": "2018-10-23T12:50:44Z", "keys": 8135, "file": "/tmp/dump.txt", "warning": "/tmp/dump.txt file contains all private keys from this wallet. Do not share it with anyone!" } ``` Sample Results (the first 10 lines of the file): ```bash >>>>>>>># Wallet dump created by Dimecoin Core >>>>>>>># * Created on 2020-12-09T18:40:52Z >>>>>>>># * Best block at time of backup was 56750034 (000000b2304f57eefd42cdd943e7736d479468beb08049b8f88d11ebc7cf6f02), >>>>>>>># mined on 2020-12-09T18:40:23Z cQZZ4awQvcXXyES3CmUJqSgeTobQm9t9nyUr337kvUtsWsnvvMyw 2018-12-14T17:24:37Z change=1 # addr=ycBuREgSskHHkWLxDa9A5WppCki6PfFycL cTBRPnJoPjEMh67v1zes437v8Po5bFLDWKgEudTJMhVaLs1ZVGJe 2018-12-14T17:24:37Z change=1 # addr=yNsWkgPLN1u7p5dfWYnasYdgirU2J3tjUj cRkkwrFnQUrih3QiT87sNy1AxyfjzqVYSyVYuL3qnJcSiQfE4QJa 2018-12-14T17:24:37Z change=1 # addr=yRkHzRbRKn8gBp5826mbaBvxLuBBNDVQg3 cQM7KoqQjHCCTrDhnfBEY1vpW9W65zRvaQeTb41UbFb6WX8Q8UkQ 2018-12-14T17:24:37Z change=1 # addr=yVEdefApUYiDLHApvvWCK5afTtJeQada8Y cTGSKYaQTQabnjNSwCqpjYXiucVujTXiwp9dzmJV9cNAiayAJusi 2018-12-14T17:24:37Z change=1 # addr=ybQYgp21ZyZK8JuMLb2CVwG4TaWrXVXD5M ``` ```{seealso} * [BackupWallet](../api/remote-procedure-calls-wallet.md#backupwallet): safely copies `wallet.dat` to the specified file, which can be a directory or a path with filename. * [ImportWallet](../api/remote-procedure-calls-wallet.md#importwallet): imports private keys from a file in wallet dump file format (see the [`dumpwallet` RPC](../api/remote-procedure-calls-wallet.md#dumpwallet)). These keys will be added to the keys currently in the wallet. This call may need to rescan all or parts of the blockchain for transactions affecting the newly-added keys, which may take several minutes. ``` ### EncryptWallet ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**). ``` The [`encryptwallet` RPC](../api/rpc-wallet.md#encryptwallet) encrypts the wallet with a passphrase. This is only to enable encryption for the first time. After encryption is enabled, you will need to enter the passphrase to use private keys. ```{warning} If using this RPC on the command line, remember that your shell probably saves your command lines (including the value of the passphrase parameter). In addition, there is no RPC to completely disable encryption. If you want to return to an unencrypted wallet, you must create a new wallet and restore your data from a backup made with the [`dumpwallet` RPC](../api/rpc-wallet.md#dumpwallet). ``` *Parameter #1---a passphrase* | Name | Type | Presence | Description | | ---------- | ------ | ----------------------- | ------------------------------------------------------------------------------- | | Passphrase | string | Required
(exactly 1) | The passphrase to use for the encrypted wallet. Must be at least one character | *Result---a notice (with program shutdown)* | Name | Type | Presence | Description | | -------- | ------ | ----------------------- | --------------------------------------------------------------------------------------------------------- | | `result` | string | Required
(exactly 1) | A notice that the server is stopping and that you need to make a new backup. The wallet is now encrypted | *Example from Dimecoin Core 2.3.0.0* ```bash dimecoin-cli -mainnet encryptwallet "test" ``` Result: ```text Wallet encrypted; Dimecoin Core server stopping, restart to run with encrypted wallet. The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup. ``` ```{seealso} * [WalletPassphrase](../api/rpc-wallet.md#walletpassphrase): 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. * [WalletLock](../api/rpc-wallet.md#walletlock): 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. * [WalletPassphraseChange](../api/rpc-wallet.md#walletpassphrasechange): changes the wallet passphrase from 'old passphrase' to 'new passphrase'. ``` ### GetAddressInfo ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**). ``` The [`getaddressinfo` RPC](../api/rpc-wallet.md#getaddressinfo) returns information about the given Dimecoin address. ```{important} Some information requires the address to be in the wallet. ``` *Parameter #1---a P2PKH or P2SH address* | Name | Type | Presence | Description | | ------- | --------------- | ----------------------- | ----------- | | Address | string (base58) | Required
(exactly 1) | The P2PKH or P2SH address encoded in base58check format | *Result---returns information about the address* | Name | Type | Presence | Description | | -------------------------- | ---------------- | ----------------------- | ----------- | | `result` | object | Required
(exactly 1) | Information about the address | | →
`address` | string (base58) | Required
(exactly 1) | The Dimecoin address given as parameter | | →
`scriptPubKey` | string (hex) | Required
(exactly 1) | The hex encoded scriptPubKey generated by the address | | →
`ismine` | bool | Required
(exactly 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 | Required
(exactly 1) | Set to `true` if the address is watch-only. Otherwise set to `false`. Only returned if address is in the wallet | | →
`isscript` | bool | Required
(exactly 1) | Whether or not the key is a script | | →
`desc` | string | Optional
(0 or 1) | A descriptor for spending coins sent to this address (only present when `solvable` is `true`) | | →
`isscript` | bool | Required
(exactly 1) | Set to `true` if a P2SH address; otherwise set to `false`. Only returned if the address is in the wallet | | →
`witness_version` | numeric | Optional | Version number of the witness program | | →
`witness_program` | string | Optional | Hex vcale of the witness program | | →
`ischange` | bool | Required
(exactly 1) | Set to `true` if the address was used for change output. | | →
`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 | | →
`pubkeys` | array | Optional
(0 or 1) | Array of pubkeys associated with the known redeemscript (only if `script` is "multisig") | | → →
Pubkey | string | Optional
(0 or more) | A public key | | →
`addresses` | array | Optional
(0 or 1) | Array of addresses associated with the known redeemscript (only if "script" is "multisig"). | | → →
Address | string | Optional
(0 or more) | An address. | | →
`sigsrequired` | 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 | | →
`label` | string | Optional
(0 or 1) | The label associated with the address. Defaults to "". Replaced by the labels array below. | | →
`timestamp` | number (int) | Optional
(0 or 1) | The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT) | | →
`hdkeypath` | string | Optional
(0 or 1) | The HD keypath if the key is HD and available | | →
`hdmasterkeyid` | string | Optional
(0 or 1) | Hash160 of the HD master pubkey | | →
`labels` | array | Optional
(0 or 1) | Array of labels associated with the address. | | →→
Label Data | object | Optional
(0 or 1) | JSON object containing label data | | →→→
`name` | string | Optional
(0 or 1) | The label | | →→→
`purpose` | string | Optional
(0 or 1) | Purpose of address (`send` for sending address, `receive` for receiving address) | *Example from Dimecoin Core 2.3.0.0* Get info for the following P2PKH address from the wallet: ```bash dimecoin-cli getaddressinfo "7S9BMYB3QQwARC3UpnTKFQcGBsoZWpwWA7" ``` Result: ```json { "address": "7S9BMYB3QQwARC3UpnTKFQcGBsoZWpwWA7", "scriptPubKey": "76a914fd12e36177dd3a0a5736be7aa319ab02ebab2c0888ac", "ismine": true, "iswatchonly": false, "isscript": false, "iswitness": false, "pubkey": "0283fe2d0a3f1fdf5fd228d8c97a0e5b020c26ae0ae021a71ba6ff719198661680", "iscompressed": true, "label": "", "timestamp": 1695663614, "hdkeypath": "m/0'/0'/5'", "hdmasterkeyid": "de16ce029a24193c206b136d62300c1777b9ed63", "labels": [ { "name": "", "purpose": "receive" } ] } ``` Get info for the following P2SH multisig address from the wallet: ```bash dimecoin-cli -mainnet getaddressinfo 8uJLxDxk2gEMbidF5vT8XLS2UCgQmVcroW ``` Result: ```json { "address": "8uJLxDxk2gEMbidF5vT8XLS2UCgQmVcroW", "scriptPubKey": "a914a33155e490d146e656a9bac2cbee9c625ef42f0a87", "ismine": false, "solvable": false, "iswatchonly": false, "isscript": true, "ischange": false, "labels": [ ] } ``` ```{seealso} * [ImportAddress](../api/rpc-wallet.md#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](../api/rpc-wallet.md#getnewaddress): returns a new DIME address for receiving payments. If an account is specified, payments received with the address will be credited to that account. * [ValidateAddress](../api/rpc-utility.md#validateaddress): returns information about the given DIME address. ``` ### GetAddressesByLabel ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) ``` The [`getaddressesbylabel` RPC](../api/rpc-wallet.md#getaddressesbylabel) returns a list of every address assigned to a particular label. *Parameter #1---the label name* | Name | Type | Presence | Description | | ----- | ------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | Label | string | Required
(exactly 1) | The name of the label associated with the addresses to get. To get addresses from the default account, pass an empty string (`""`). | *Result---a list of addresses* | Name | Type | Presence | Description | | ----------- | ------ | ----------------------- | ----------------------------------------------------------------------------------- | | `result` | object | Required
(exactly 1) | A JSON object containing all addresses belonging to the specified label as keys. | | →Address | object | Optional
(1 or more) | A JSON object with information about a P2PKH or P2SH address belonging to the label | | →→`purpose` | string | Optional
(1 or more) | Purpose of address (`send` for sending address, `receive` for receiving address) | *Example from Dimecoin Core 2.3.0.0* Get the addresses assigned to the label "test": ```bash dimecoin-cli -mainnet getaddressesbylabel "test" ``` Result: ```json { "7DAUpYSaWUFvP7PJbYoWb9gJg9xEmMiPYU": { "purpose": "receive" } } ``` ```{seealso} * [GetAccount](../api/rpc-wallet-deprecated.md#getaccount): returns the name of the account associated with the given address. * [GetBalance](../api/rpc-wallet.md#getbalance): gets the balance in decimal DIME across all accounts or for a particular account. ``` ### GetBalance ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) ``` The [`getbalance` RPC](../api/rpc-wallet.md#getbalance) gets the total *available balance* in DIME. The *available balance* is what the wallet considers currently spendable, and is thus affected by options which limit spendability such as `-spendzeroconfchange`. *Parameter #1---unused parameter* | Name | Type | Presence | Description | | ------ | ------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Unused | string | Optional
(0 or 1) | **Deprecated: (previously account) will be removed in a later version of Dimecoin Core**

Remains for backward compatibility. Must be excluded or set to `"*"`. | *Parameter #2---the minimum number of confirmations* | Name | Type | Presence | Description | | ------------- | ------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Confirmations | number (int) | Optional
(0 or 1) | The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance. Transactions generated by this node are counted immediately. Typically, externally-generated transactions are payments to this wallet and transactions generated by this node are payments to other wallets. Use `0` to count unconfirmed transactions. Default is `1` | *Parameter #3---whether to add the balance from transactions locked via InstantSend* | Name | Type | Presence | Description | | --------- | ---- | ----------------------- | ---------------------------------------------------- | | addlocked | bool | Optional
(exactly 1) | Add the balance from InstantSend locked transactions | *Parameter #4---whether to include watch-only addresses* | Name | Type | Presence | Description | | ------------------ | ---- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Include Watch-Only | bool | Optional
(0 or 1) | If set to `true`, include watch-only addresses in details and calculations as if they were regular addresses belonging to the wallet. If set to `false` (the default for non-watching only wallets), treat watch-only addresses as if they didn't belong to this wallet.
As of Dimecoin Core 18.1, `true` is used as the default for watching-only wallets. | *Parameter #5---avoids partial respends* | Name | Type | Presence | Description | | ----------- | ---- | -------------------- | --------------------------------------------------------------------------------------------------------------------------- | | avoid_reuse | bool | Optional
(0 or 1) | Do not include balance in dirty outputs; addresses are considered dirty if they have previously been used in a transaction. | *Result---the balance in DIME* | Name | Type | Presence | Description | | -------- | ------------- | ----------------------- | ---------------------------------------------------- | | `result` | number (DIME) | Required
(exactly 1) | The balance of the account (or all accounts) in DIME | *Examples from Dimecoin Core 2.3.0.0* Get the balance, including transactions with at least three confirmations and those spent to watch-only addresses. Do not include InstantSend locked transactions. ```bash dimecoin-cli -mainnet getbalance "*" 3 false true ``` Result: ```json 0.00000 ``` Get the balance, including transactions with at least three confirmations and those spent to watch-only addresses. Include the balance from InstantSend locked transactions. ```bash dimecoin-cli -mainnet getbalance "" 3 true true ``` Result: ```json 1.00000 ``` ```{seealso} * [ListAccounts](../api/rpc-removed.md#listaccounts): lists accounts and their balances. * [GetReceivedByAccount](../api/rpc-removed.md#getreceivedbyaccount): returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations. It does not count coinbase transactions. * [GetReceivedByAddress](../api/rpc-wallet.md#getreceivedbyaddress): returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions. ``` ### GetNewAddress > > Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) The [`getnewaddress` RPC](../api/rpc-wallet.md#getnewaddress) returns a new DIME address for receiving payments. If `label` is specified, the address is added to the address book so payments received with the address will be associated with `label`. *Parameter #1---an account name* | Name | Type | Presence | Description | | ------- | ------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `label` | string | Optional
(0 or 1) | The label name for the address to be linked to. If not provided, the default label `""` is used. It can also be set to the empty string `""` to represent the default label. The label does not need to exist, it will be created if there is no label by the given name. | *Result---a DIME address never previously returned* | Name | Type | Presence | Description | | -------- | --------------- | ----------------------- | --------------------- | | `result` | string (base58) | Required
(exactly 1) | The new DIME address. | *Example from Dimecoin Core 2.3.0.0* Create a new address in the "test" account: ```bash dimecoin-cli -mainnet getnewaddress "test" ``` Result: ```text 7DAUpYSaWUFvP7PJbYoWb9gJg9xEmMiPYU ``` ```{seealso} * [GetAccountAddress](../api/rpc-wallet-deprecated.md#getaccountaddress): returns the current Dimecoin address for receiving payments to this account. If the account doesn't exist, it creates both the account and a new address for receiving payment. Once a payment has been received to an address, future calls to this RPC for the same account will return a different address. * [GetRawChangeAddress](../api/rpc-wallet.md#getrawchangeaddress): returns a new Dimecoin address for receiving change. This is for use with raw transactions, not normal use. * [GetBalance](../api/rpc-wallet.md#getbalance): gets the balance in decimal DIME across all accounts or for a particular account. ``` ### GetRawChangeAddress ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) ``` The [`getrawchangeaddress` RPC](../api/rpc-wallet.md#getrawchangeaddress) returns a new DIME address for receiving change. This is for use with raw transactions, not normal use. *Parameters: none* *Result---a P2PKH address which can be used in raw transactions* | Name | Type | Presence | Description | | -------- | --------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `result` | string (base58) | Required
(exactly 1) | A P2PKH address which has not previously been returned by this RPC. The address will be removed from the keypool but not marked as a receiving address, so RPCs such as the [`dumpwallet` RPC](../api/rpc-wallet.md#dumpwallet) will show it as a change address. The address may already have been part of the keypool, so other RPCs such as the [`dumpwallet` RPC](../api/rpc-wallet.md#dumpwallet) may have disclosed it previously. If the wallet is unlocked, its keypool will also be filled to its max (by default, 100 unused keys). If the wallet is locked and its keypool is empty, this RPC will fail | *Example from Dimecoin Core 2.3.0.0* ```bash dimecoin-cli -mainnet getrawchangeaddress ``` Result: ```text 7E6mZQV4Yv31vgAjncwS6aarecgXf8gsKw ``` ```{seealso} * [GetNewAddress](../api/rpc-wallet.md#getnewaddress): returns a new DIME address for receiving payments. If an account is specified, payments received with the address will be credited to that account. * [GetAccountAddress](../api/rpc-wallet-deprecated.md#getaccountaddress): returns the current Dimecoin address for receiving payments to this account. If the account doesn't exist, it creates both the account and a new address for receiving payment. Once a payment has been received to an address, future calls to this RPC for the same account will return a different address. ``` ### GetReceivedByAddress ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) *This RPC only returns a balance for addresses contained in the local wallet.* ``` The [`getreceivedbyaddress` RPC](../api/rpc-wallet.md#getreceivedbyaddress) returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions. *Parameter #1---the address* | Name | Type | Presence | Description | | ------- | ------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------ | | Address | string | Required
(exactly 1) | **Only works for addresses contained in the local wallet**

The address whose transactions should be tallied | *Parameter #2---the minimum number of confirmations* | Name | Type | Presence | Description | | ------------- | ------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Confirmations | number (int) | Optional
(0 or 1) | The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance. Transactions generated by this node are counted immediately. Typically, externally-generated transactions are payments to this wallet and transactions generated by this node are payments to other wallets. Use `0` to count unconfirmed transactions. Default is `1` | *Parameter #3---whether to include transactions locked via InstantSend* *Not currently available in Dimecoin Core* | Name | Type | Presence | Description | | --------- | ---- | ----------------------- | ---------------------------------------------------- | | addlocked | bool | Optional
(exactly 1) | Add the balance from InstantSend locked transactions | *Result---the amount of DIME received* | Name | Type | Presence | Description | | -------- | ------------- | ----------------------- | ---------------------------------------------------------------------------------------- | | `result` | number (DIME) | Required
(exactly 1) | The amount of DIME received by the address, excluding coinbase transactions. May be `0` | *Example from Dimecoin Core 2.3.0.0* Get the DIME received for a particular address, only counting transactions with six or more confirmations (ignore InstantSend locked transactions): ```bash dimecoin-cli -mainnet getreceivedbyaddress 7E6mZQV4Yv31vgAjncwS6aarecgXf8gsKw 6 ``` Result: ```json 125.00000 ``` Get the DIME received for a particular address, only counting transactions with six or more confirmations (include InstantSend locked transactions): ```bash dimecoin-cli -mainnet getreceivedbyaddress 7E6mZQV4Yv31vgAjncwS6aarecgXf8gsKw 6 true ``` Result: ```json 0.30000 ``` ```{seealso} * [GetReceivedByAccount](../api/rpc-removed.md#getreceivedbyaccount): returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations. It does not count coinbase transactions. * [GetAddressesByAccount](../api/rpc-wallet-deprecated.md#getaddressesbyaccount): returns a list of every address assigned to a particular account. * [ListAccounts](../api/rpc-removed.md#listaccounts): lists accounts and their balances. ``` ### GetReceivedByLabel ```{note} Requires [wallet](../reference/glossary.md#wallet) support (**unavailable on masternodes**) ``` The [`getreceivedbylabel` RPC](../api/rpc-wallet.md#getreceivedbylabel) returns the total amount received by addresses with