Calling importaddress
will rescan the whole blockchain in default according to bitcoin.org
Set rescan parameter to false to not rescan the block database
(rescanning can be performed at any time by restarting Bitcoin Core
with the -rescan command-line argument). Rescanning may take several
minutes.
help importaddress
importaddress "address" ( "label" rescan p2sh )
Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.
Arguments:
1. "script" (string, required) The hex-encoded script (or address)
2. "label" (string, optional, default="") An optional label
3. rescan (boolean, optional, default=true) Rescan the wallet for transactions
4. p2sh (boolean, optional, default=false) Add the P2SH version of the script as well
Note: This call can take minutes to complete if rescan is true, during that time, other rpc calls may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.
If you have the full public key, you should call importpubkey instead of this.
Note: If you import a non-standard raw script in hex form, outputs sending to it will be treated as change, and not show up in many RPCs.
Examples:
Import a script with rescan
bitcoin-cli importaddress "myscript"
Import using a label without rescan
bitcoin-cli importaddress "myscript" "testing" false
UPDATE Since Bitcoin core v0.14 you can use importmulti
to import addresses.
bitcoin-cli importmulti '
[
{
"scriptPubKey" : { "address": "1NL9w5fP9kX2D9ToNZPxaiwFJCngNYEYJo" },
"timestamp" : "0",
"label" : "Personal",
"watchonly": true
},
{
"scriptPubKey" : "76a9149e857da0a5b397559c78c98c9d3f7f655d19c68688ac",
"timestamp" : 1493912405,
"label" : "TestFailure"
}
]' '{ "rescan": true }'
Response:
[
{
"success": true
},
{
"success": false,
"error": {
"code": -8,
"message": "Internal must be set for hex scriptPubKey"
}
}
]
Note:
- Bech32 addresses are not supported using this method until the moment. (You're free to edit this answer when it's available.)
importmulti
will not speed up importing progress since this method locks your wallet and block any further RPC calls.