<p>There is no guarantee of the order by the API. But its currently FIFO (first in first out).</p>

<p>If the order/remembering is important to you, consider using <code>fundrawtransaction</code> with a wallet where you have private keys disabled <code>createwallet "name" true</code>.
Just import pubkeys define the change output address in <code>fundrawtransaction</code>.</p>

CC BY-SA 4.0
2019-05-09T18:42:27.227Z
2019-05-09T18:42:27.227Z
Jonas Schnelli
<p>I want to use <code>importmulti</code> to import 100 addresses from an xpub descriptor.</p>

<p>If I set <code>keypool: true</code> as one of the arguments the keys get added to the keypool.</p>

<p>How does the wallet prioritise which keys it generates when calling <code>getnewaddress</code>? Will it prioritise the imported addresses or do I have to request the imported address via the <code>label</code> argument in <code>getnewaddress</code>? What if I don't add a <code>label</code> argument to the <code>importmulti</code> command?</p>

<bitcoin-core><json-rpc><bitcoin-cli>
How does the wallet prioritise keypool addresses imported via importmulti?
Fontaine
# How does the wallet prioritise keypool addresses imported via importmulti?

(Asked by: username_0 on 2019-05-09)

I want to use `importmulti` to import 100 addresses from an xpub descriptor.

If I set `keypool: true` as one of the arguments the keys get added to the keypool.

How does the wallet prioritise which keys it generates when calling `getnewaddress`? Will it prioritise the imported addresses or do I have to request the imported address via the `label` argument in `getnewaddress`? What if I don't add a `label` argument to the `importmulti` command?

**Tags:** bitcoin-core, json-rpc, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2019-05-09. Score: 0 | Accepted answer

There is no guarantee of the order by the API. But its currently FIFO (first in first out).

If the order/remembering is important to you, consider using `fundrawtransaction` with a wallet where you have private keys disabled `createwallet "name" true`.
Just import pubkeys define the change output address in `fundrawtransaction`.


---

