<p>If you want to import multiple things at the same time using the Bitcoin Core RPC, then <a href="https://bitcoincore.org/en/doc/0.21.0/rpc/wallet/importmulti/" rel="nofollow noreferrer"><code>importmulti</code></a> is the best way to do so. It takes an array of JSON objects which can contain descriptors, scriptPubKeys, addresses, keys, and other metadata. It is a very useful RPC.</p>

CC BY-SA 4.0
2021-12-17T02:36:41.827Z
would i have to do this every single address? how would the loop for php look like? would i have to loop through every block then every transaction?
Daniel
CC BY-SA 4.0
2021-12-17T03:48:25.987Z
Hi Daniel, I'm not sure I understand your question. You can pass all the addresses into a single call to `importmulti` and it will import all of them at once.
meshcollider
CC BY-SA 4.0
2021-12-17T15:40:52.407Z
im trying to build an explorer, but i need to add every since wallet on a watch list. do i have to loop through the block hashes then loop through the transactions? i have to essentially add every since address to this function?
Daniel
CC BY-SA 4.0
2021-12-17T18:22:20.983Z
@Daniel if you want to add *every* address ever used on the blockchain, then you might want to reconsider your approach. Bitcoin Core is not designed as a blockchain explorer backend. In that case, you should create your own database and store all the data yourself rather than importing every single address into a wallet.
meshcollider
CC BY-SA 4.0
2021-12-17T18:30:11.947Z
how can i obtain information about that address other than adding the watchlist wallets?
Daniel
CC BY-SA 4.0
2021-12-18T01:58:04.590Z
Manually parse the blockchain for all transaction data using your own program, Bitcoin Core is not designed for that purpose so using it would be inefficient.
meshcollider
CC BY-SA 4.0
2022-04-12T23:28:53.370Z
If we maintain a separate table for all the balances, how to we deal with block re-orgs?
Clemens
CC BY-SA 4.0
2021-12-16T23:04:07.977Z
2021-12-16T23:04:07.977Z
meshcollider
<p>I'm trying to build an explorer and I need to pull information about the wallet address such as transactions.</p>
<p>Do I have to loop through everything with importaddress or is there an easier way?</p>
<p>I already have the blockchain indexed so I can look at transactions outside my own.</p>

<bitcoin-core><bitcoind><bitcoin-cli>
Import all wallet addresses efficiently for explorer
Daniel
# Import all wallet addresses efficiently for explorer

(Asked by: username_0 on 2021-12-16)

I'm trying to build an explorer and I need to pull information about the wallet address such as transactions.

Do I have to loop through everything with importaddress or is there an easier way?

I already have the blockchain indexed so I can look at transactions outside my own.

**Tags:** bitcoin-core, bitcoind, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2021-12-16. Score: 1

If you want to import multiple things at the same time using the Bitcoin Core RPC, then [`importmulti`](https://bitcoincore.org/en/doc/0.21.0/rpc/wallet/importmulti/) is the best way to do so. It takes an array of JSON objects which can contain descriptors, scriptPubKeys, addresses, keys, and other metadata. It is a very useful RPC.

> **Comments:**
> **username_0**: would i have to do this every single address? how would the loop for php look like? would i have to loop through every block then every transaction?  
> **username_1**: Hi username_0, I'm not sure I understand your question. You can pass all the addresses into a single call to `importmulti` and it will import all of them at once.  
> **username_0**: im trying to build an explorer, but i need to add every since wallet on a watch list. do i have to loop through the block hashes then loop through the transactions? i have to essentially add every since address to this function?  
> **username_1**: @username_0 if you want to add *every* address ever used on the blockchain, then you might want to reconsider your approach. Bitcoin Core is not designed as a blockchain explorer backend. In that case, you should create your own database and store all the data yourself rather than importing every single address into a wallet.  
> **username_0**: how can i obtain information about that address other than adding the watchlist wallets?  
> **username_1**: Manually parse the blockchain for all transaction data using your own program, Bitcoin Core is not designed for that purpose so using it would be inefficient.  
> **username_2**: If we maintain a separate table for all the balances, how to we deal with block re-orgs?  

---

