<blockquote>
  <p>How do the block explorers do the search by addresses -- do they
  search the entire blockchain at query time, which is very inefficient,
  or do they maintain some sort of index which they update iteratively?</p>
</blockquote>

<p>The block explorers parse all of the transactions one by one and create their own database and index using the address generated from the <code>scriptPubKeys</code>. This is expensive the first time, but not as bad when it just needs to stay up to date.</p>

<blockquote>
  <p>If they maintain the index, it looks like the index will be pretty
  huge since it will always keep on growing. So how big is the index
  currently?</p>
</blockquote>

<p>It is at least as big as the blockchain itself (assuming they are storing all of the data, raw blocks, etc.). As for the specific number, you'd have to ask the specific block explorer.</p>

<blockquote>
  <p>Also, can the blockchain nodes currently do such a search (of course
  efficiently)?</p>
</blockquote>

<p>If you enable <code>-txindex</code> flag you can search by <code>txid</code> but Bitcoin-core offers no such functionality (search by address) unless it is one of your wallet addresses.</p>

CC BY-SA 4.0
2018-11-15T15:55:44.050Z
2018-11-15T15:55:44.050Z
JBaczuk
<p>As per <a href="https://bitcoin.stackexchange.com/questions/5518/how-do-i-access-information-on-blockexplorer-com-or-blockchain-info-without-issu">this</a> post bitcoin nodes do not maintain an index from addresses to TxIDs and hence querying for the unspent tokens by addresses essentially involves traversing the entire UTXO set.</p>

<p>However, the blockchain explorers enable search by addresses not just on the unspent outputs but on the <strong>entire</strong> blockchain. They list <strong>all</strong> the transactions that involve an address. I have the following questions:</p>

<ul>
<li>How do the block explorers do the search by addresses -- do they search the entire blockchain at query time, which is very inefficient, or do they maintain some sort of index which they update iteratively?</li>
<li>If they maintain an index, it looks like the index will be pretty huge since it will always keep on growing. So how big is the index currently?</li>
<li>Also, can the blockchain nodes currently do such a search (of course efficiently)?</li>
</ul>

<blockexplorer>
Block Explorers search on TxID
archita
# Block Explorers search on TxID

(Asked by: username_0 on 2018-11-15)

As per [this](https://bitcoin.stackexchange.com/questions/5518/how-do-i-access-information-on-blockexplorer-com-or-blockchain-info-without-issu) post bitcoin nodes do not maintain an index from addresses to TxIDs and hence querying for the unspent tokens by addresses essentially involves traversing the entire UTXO set.

However, the blockchain explorers enable search by addresses not just on the unspent outputs but on the **entire** blockchain. They list **all** the transactions that involve an address. I have the following questions:

* How do the block explorers do the search by addresses -- do they search the entire blockchain at query time, which is very inefficient, or do they maintain some sort of index which they update iteratively?
* If they maintain an index, it looks like the index will be pretty huge since it will always keep on growing. So how big is the index currently?
* Also, can the blockchain nodes currently do such a search (of course efficiently)?

**Tags:** blockexplorer


---

## 1 answers

### Answer by username_1 on 2018-11-15. Score: 2

> How do the block explorers do the search by addresses -- do they
> search the entire blockchain at query time, which is very inefficient,
> or do they maintain some sort of index which they update iteratively?

The block explorers parse all of the transactions one by one and create their own database and index using the address generated from the `scriptPubKeys`. This is expensive the first time, but not as bad when it just needs to stay up to date.

> If they maintain the index, it looks like the index will be pretty
> huge since it will always keep on growing. So how big is the index
> currently?

It is at least as big as the blockchain itself (assuming they are storing all of the data, raw blocks, etc.). As for the specific number, you'd have to ask the specific block explorer.

> Also, can the blockchain nodes currently do such a search (of course
> efficiently)?

If you enable `-txindex` flag you can search by `txid` but Bitcoin-core offers no such functionality (search by address) unless it is one of your wallet addresses.


---

