As discussed in PR #6570 this is a new rpc call importmulti
that receives an array of JSON objects representing the intention of importing a public key, a private key, an address and script/p2sh:
0bitcoin-cli importmulti '[
1 {
2 "timestamp": 1455191478,
3 "type": "privkey",
4 "value": "<private key>"
5 },
6 {
7 "label": "example 1",
8 "timestamp": 1455191480,
9 "type": "pubkey",
10 "value": "<public key>"
11 }
12]' '{"rescan":true}'
and rescans (if not disabled in second argument) the chain from the block that has a timestamp lowest than the lowest timestamp found in all requests, preventing scanning from genesis.
The output is an array with the status of each request:
0output: [ { "result": true } , { "result": true } ]
Arguments:
01. json request array (json, required) Data to be imported
1 [
2 {
3 "type": "privkey | pubkey | address | script", (string, required) Type of address
4 "value": "...", (string, required) Value of the address
5 "timestamp": 1454686740, (integer, optional) Timestamp
6 "label": "..." (string, optional) Label
7 "p2sh": true | false (bool, optional, default=false) Value is a P2SH (type=script only)
8 }
9 ,...
10 ]
112. json options (json, optional) Options
Some notes:
- If one of the import requests has no timestamp then it should rescan from Genesis (if rescan is not disabled).
- If all requests fail then it won’t rescan the chain.
Edit: As suggested by @promag i’ve replaced the second argument (optional) bool
to JSON to be easier specify new options and added a new type="script"
to support only script values, so can type="address"
work only with addresses.