With the importaddress RPC command it is possible to import one watch-only address. But how can I do that with, let's say, 100?
The RPC interface doesn't generally provide any "batch mode" functionality. If you want to import 100 addresses, call importaddress
100 times. You might like to write a short script with a loop in some other language.
You should set the rescan parameter to false
for all but the last address, so that you don't trigger rescanning 100 times.
There is an alternate command importmulti
to be used as follows:
bitcoin-cli importmulti '[
{
"scriptPubKey" : { "address": "mxbvcPj7cnbxPP6oqpHJxxNb4xC8QoLquG" },
"timestamp" : 0,
"label" : "mxbvcPj7cnbxPP6oqpHJxxNb4xC8QoLquG"
},
{
"scriptPubKey" : { "address": "n1iNb8XafoJTrCBBcGSSEZ6YNd6EWYo8PU" },
"timestamp" : 0,
"label" : "n1iNb8XafoJTrCBBcGSSEZ6YNd6EWYo8PU"
},
{
"scriptPubKey" : { "address": "mgLs7quWwYBJa7jkZyebAec7RNXQtwaerK" },
"timestamp" : 0,
"label" : "mgLs7quWwYBJa7jkZyebAec7RNXQtwaerK"
}]' '{"rescan":false}'
Response is as follows:
[
{
"success": true
},
{
"success": true
},
{
"success": true
}
]