<p>You can also use the system at <a href="http://BlockchainSQL.io" rel="nofollow">http://BlockchainSQL.io</a> to parse the Bitcoin blockchain into an SQL database. It can talk directly to nodes via the protocol and/or parse Core's BLK files.</p>

<p><b>Disclaimer:</b> I am the developer of that system.</p>

CC BY-SA 3.0
2016-06-28T11:28:29.497Z
2016-06-28T11:28:29.497Z
Herman Schoenfeld
<p>Yeah, that's how they work. For example, blockexplorer.com gets blocks from Bitcoin Core via JSON-RPC, gathers interesting chunks of data, and puts this data into a SQL database for easy access later. <a href="https://github.com/lirazsiri/blockexplorer/blob/master/bin/blockupdate.php" rel="nofollow">The code for this is only ~300 lines long</a> (though it's very messy). Other block explorers work similarly. In fact, Bitcoin Core itself works something like this, though it uses a key-value database instead of a relational database, and it doesn't store any info about addresses.</p>

CC BY-SA 3.0
2014-07-17T23:30:51.733Z
that database must be huge, for block explorer providers, how do they manage speed/cost for all the unique queries
CQM
CC BY-SA 3.0
2014-07-18T01:12:08.823Z
@CQM: A good database has no trouble dealing with a few dozen gigabytes of data.
Greg Hewgill
CC BY-SA 3.0
2014-07-18T04:23:47.293Z
@CQM The blockexplorer.com database is ~60 GB, but with proper indexing and carefully-written queries, even huge databases can be queried with decent speed. I originally wrote blockexplorer.com when the Bitcoin block chain was less than a few GBs, though, and it hasn't been updated much since then, so some things are in fact painfully slow nowadays, especially database updates. Other block explorers are more carefully optimized for the large block chain.
theymos
CC BY-SA 3.0
2014-07-17T23:16:02.583Z
2014-07-17T23:16:02.583Z
theymos
<p>I am thinking about the 'science' of block explorers</p>

<p>When I go to a block explorer and view an address, I see a list of transactions in that address and current balance</p>

<p>Is this technically just the contents of each block being stored as they are created (or retroactively parsed) and assigning a database entry for each new element found in that block?</p>

<p>Or even storing every unconfirmed transaction's data as well?</p>

<p>Writing this out, I think I answered my own question, but maybe there is some more efficient or clever thing going on here</p>

<blockexplorer>
block explorer, just a parser and database query?
CQM
# block explorer, just a parser and database query?

(Asked by: username_0 on 2014-07-17)

I am thinking about the 'science' of block explorers

When I go to a block explorer and view an address, I see a list of transactions in that address and current balance

Is this technically just the contents of each block being stored as they are created (or retroactively parsed) and assigning a database entry for each new element found in that block?

Or even storing every unconfirmed transaction's data as well?

Writing this out, I think I answered my own question, but maybe there is some more efficient or clever thing going on here

**Tags:** blockexplorer


---

## 2 answers

### Answer by username_2 on 2014-07-17. Score: 3 | Accepted answer

Yeah, that's how they work. For example, blockexplorer.com gets blocks from Bitcoin Core via JSON-RPC, gathers interesting chunks of data, and puts this data into a SQL database for easy access later. [The code for this is only ~300 lines long](https://github.com/lirazsiri/blockexplorer/blob/master/bin/blockupdate.php) (though it's very messy). Other block explorers work similarly. In fact, Bitcoin Core itself works something like this, though it uses a key-value database instead of a relational database, and it doesn't store any info about addresses.

> **Comments:**
> **username_0**: that database must be huge, for block explorer providers, how do they manage speed/cost for all the unique queries  
> **username_3**: @username_0: A good database has no trouble dealing with a few dozen gigabytes of data.  
> **username_2**: @username_0 The blockexplorer.com database is ~60 GB, but with proper indexing and carefully-written queries, even huge databases can be queried with decent speed. I originally wrote blockexplorer.com when the Bitcoin block chain was less than a few GBs, though, and it hasn't been updated much since then, so some things are in fact painfully slow nowadays, especially database updates. Other block explorers are more carefully optimized for the large block chain.  

---

### Answer by username_1 on 2016-06-28. Score: 0

You can also use the system at <http://BlockchainSQL.io> to parse the Bitcoin blockchain into an SQL database. It can talk directly to nodes via the protocol and/or parse Core's BLK files.

**Disclaimer:** I am the developer of that system.


---

