<p>I am trying to scan all the bitcoin data on my workstation with java to get some high level statistic data.</p>
<p>I parsed all the transactions with bitcoinJ, but I encountered a problem, the Transaction input only has transaction hash and index, which means I need to maintain all the unspent uxtos.</p>
<p>This task seems challenge to me, I have tested the SQLite and memory, Both solution can not work properly, SQLite is too slow, memory can not hold the huge data set at all.</p>
<p>Is there any one has some experience on this topic.</p>

CC BY-SA 4.0
2022-01-05T19:57:26.413Z
For what it's worth, Bitcoin Core uses leveldb for this job. I think there is a Java port of it, but don't know if it's the best option.
meshcollider
CC BY-SA 4.0
2022-11-18T13:03:09.963Z
You'll likely need to have txindex=1 set in your bitcoin.conf first. Only they it will store all the transactions of all the block, else it'll just store the headers. After that, you can write a Java program that loops all the blocks from 0, use JSON-RPC API of Bitcoin-cli getblock, from that get all the txHashes, then use them and loop again with gettransaction JSON-RPC to get details. For DB, try Mongo.
Gladiator9120
<block><listunspent><chainanalysis>
use java to scan all the block
Carpemer
# use java to scan all the block

(Asked by: username_0 on 2022-01-05)

I am trying to scan all the bitcoin data on my workstation with java to get some high level statistic data.

I parsed all the transactions with bitcoinJ, but I encountered a problem, the Transaction input only has transaction hash and index, which means I need to maintain all the unspent uxtos.

This task seems challenge to me, I have tested the SQLite and memory, Both solution can not work properly, SQLite is too slow, memory can not hold the huge data set at all.

Is there any one has some experience on this topic.

**Tags:** block, listunspent, chainanalysis

> **Comments:**
> **username_1**: For what it's worth, Bitcoin Core uses leveldb for this job. I think there is a Java port of it, but don't know if it's the best option.  
> **username_2**: You'll likely need to have txindex=1 set in your bitcoin.conf first. Only they it will store all the transactions of all the block, else it'll just store the headers. After that, you can write a Java program that loops all the blocks from 0, use JSON-RPC API of Bitcoin-cli getblock, from that get all the txHashes, then use them and loop again with gettransaction JSON-RPC to get details. For DB, try Mongo.  

---

## 0 answers

