importmulti
importmulti "requests" ( "options" )
Imports addresses/scripts (with private or public keys, redeem script for P2SH) and optionally triggers a blockchain rescan starting from the earliest creation time of the imported scripts. This requires a new wallet backup.
If an address/script is imported without the necessary private keys to spend from it, it will be marked as watch-only. In such cases, the ‘watchonly’ option must be set to true
, or a warning will be generated.
Conversely, if all private keys are provided and the address/script is spendable, the ‘watchonly’ option must be set to false
, or a warning will be issued.
Note: If rescan is set to true
, this call can take over an hour to complete. During that time, other RPC calls may show that the imported keys, addresses, or scripts exist, but related transactions may still be missing, leading to temporarily inaccurate balances and missing unspent outputs.
Use getwalletinfo
to check the progress of the scan.
Argument #1 – requests
Type: json array, required
- A list of data to be imported. Each entry can include the following fields:
-
-
“range”: n or [n,n] (numeric or array)
Specifies the range for a ranged descriptor (in the form [begin, end]).
-
“internal”: bool (optional, default=false)
Indicates whether matching outputs should be treated as change (non-incoming payments).
-
“watchonly”: bool (optional, default=false)
Specifies whether matching outputs should be considered watch-only.
-
“label”: string (optional, default=”)
Assigns a label to the address. Only allowed if internal=false
.
-
“keypool”: bool (optional, default=false)
Determines if imported public keys should be added to the keypool for new address generation. Only allowed when wallet private keys are disabled.
[
{ (json object)
"desc": "str", (string) Descriptor to import. If using descriptor, do not also provide address/scriptPubKey, scripts, or pubkeys
"scriptPubKey": "<script>" | { "address":"<address>" }, (string / json, required) Type of scriptPubKey (string for script, json for address). Should not be provided if using a descriptor
"timestamp": timestamp | "now", (integer / string, required) Creation time of the key expressed in UNIX epoch time,
or the string "now" to substitute the current synced blockchain time. The timestamp of the oldest
key will determine how far back blockchain rescans need to begin for missing wallet transactions.
"now" can be specified to bypass scanning, for keys which are known to never have been used, and
0 can be specified to scan the entire blockchain. Blocks up to 2 hours before the earliest key
creation time of all keys being imported by the importmulti call will be scanned.
"redeemscript": "str", (string) Allowed only if the scriptPubKey is a P2SH or P2SH-P2WSH address/scriptPubKey
"witnessscript": "str", (string) Allowed only if the scriptPubKey is a P2SH-P2WSH or P2WSH address/scriptPubKey
"pubkeys": [ (json array, optional, default=empty array) Array of strings giving pubkeys to import. They must occur in P2PKH or P2WPKH scripts. They are not required when the private key is also provided (see the "keys" argument).
"pubKey", (string)
...
],
"keys": [ (json array, optional, default=empty array) Array of strings giving private keys to import. The corresponding public keys must occur in the output or redeemscript.
"key", (string)
...
],
Argument #2 – options
Type: json object, optional
{
"rescan": bool, (boolean, optional, default=true) Stating if should rescan the blockchain after all imports
}
Result
[ (json array) Response is an array with the same size as the input that has the execution result
{ (json object)
"success" : true|false, (boolean)
"warnings" : [ (json array, optional)
"str", (string)
...
],
"error" : { (json object, optional)
... JSONRPC error
}
},
...
]
Examples
bitcoinevo-cli importmulti '[{ "scriptPubKey": { "address": "<my address>" }, "timestamp":1455191478 }, { "scriptPubKey": { "address": "<my 2nd address>" }, "label": "example 2", "timestamp": 1455191480 }]'
bitcoinevo-cli importmulti '[{ "scriptPubKey": { "address": "<my address>" }, "timestamp":1455191478 }]' '{ "rescan": false}'