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:
bitcoin-cli importmulti '[
{
"timestamp": 1455191478,
"type": "privkey",
"value": "<private key>"
},
{
"label": "example 1",
"timestamp": 1455191480,
"type": "pubkey",
"value": "<public key>"
}
]' '{"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:
output: [ { "result": true } , { "result": true } ]
Arguments:
1. json request array (json, required) Data to be imported
[
{
"type": "privkey | pubkey | address | script", (string, required) Type of address
"value": "...", (string, required) Value of the address
"timestamp": 1454686740, (integer, optional) Timestamp
"label": "..." (string, optional) Label
"p2sh": true | false (bool, optional, default=false) Value is a P2SH (type=script only)
}
,...
]
2. 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.