Bitcoin Forum
May 27, 2024, 04:42:15 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What data have Bitcoin Core blockchain files?  (Read 138 times)
pbies (OP)
Full Member
***
Offline Offline

Activity: 254
Merit: 126



View Profile
June 12, 2022, 03:11:24 AM
 #1

I am interested in writing a Python script to parse BerkeleyDB in which is blockchain on disk working.
I know that this is old BerkeleyDB and I need to use bsddb3 with Python 3.9 or earlier.

What data can I find in these folders?

1. blocks+index
2. chainstate
3. indexes

How should I instruct Python to connect to whole blockchain in these files and then query it?

Any help appreciated.

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 12900K and RTX 4090
pbies (OP)
Full Member
***
Offline Offline

Activity: 254
Merit: 126



View Profile
June 12, 2022, 03:28:24 PM
 #2

1. Use Bitcoin Core RPC JSON to obtain block data.

That is too slow for me. I need access to whole data in hours, not months.

One thing I would like to do is to dump all public addresses with any additional data.

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 12900K and RTX 4090
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10594



View Profile
June 13, 2022, 03:17:05 AM
Merited by ABCbits (1)
 #3

One thing I would like to do is to dump all public addresses with any additional data.
Unless you are trying to do something special that is not to extract pubkeys to brute force private keys lol you can use existing lists that contain all bitcoin addresses that have ever been used[1] or list of addresses with a balance[2].

[1] https://bitcointalk.org/index.php?topic=5265993.0
[2] https://bitcointalk.org/index.php?topic=5254914.0

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6813


bitcoincleanup.com / bitmixlist.org


View Profile WWW
June 13, 2022, 03:59:22 AM
 #4

The most reliable way to parse the BDB files is simply to copy the DB read/write code of Bitcoin Core and make a CLI frontend that will let you query any data. That's because drivers like db_dump(1) and others are not guarranteed to work, as within the BDB file format, the program can write it in however manner it likes (i.e. it's technically a BDB format but it's unreadable to other applications).

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
pbies (OP)
Full Member
***
Offline Offline

Activity: 254
Merit: 126



View Profile
June 13, 2022, 10:45:05 AM
 #5

I am trying to write my own Python scripts to mess around with BerkeleyDB and Bitcoin Core blockchain.

I am not interested in ready solutions that provide list of addresses - they are always outdated, I need to take data from current blockchain.

To translate C/C++ code of Bitcoin Core to Python is last resort solution.

RPC is too slow to call it for whole blockchain, and it will eat too much resources. I have synced Bitcoin Core, the blockchain. I need to operate on BerkeleyDB directly.

Dolthub is a remote solution, I need local solution.

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 12900K and RTX 4090
ABCbits
Legendary
*
Offline Offline

Activity: 2884
Merit: 7524


Crypto Swap Exchange


View Profile
June 13, 2022, 12:36:11 PM
Merited by pooya87 (4)
 #6

RPC is too slow to call it for whole blockchain, and it will eat too much resources. I have synced Bitcoin Core, the blockchain. I need to operate on BerkeleyDB directly.

Since Bitcoin Core RPC-JSON doesn't meet your need, here are few pointers for reading the files directly.
1. https://bitcoindev.network/understanding-the-data/
2. https://github.com/bitcoin/bitcoin/issues/6613
3. https://learnmeabitcoin.com/technical/blkdat
4. https://bitcoin.stackexchange.com/a/48738

P.S. I would still recommend you to check self-hosted block explorer (e.g. mempool.space) and Electrum server (e.g. Fulcrum).

Dolthub is a remote solution, I need local solution.

Only if you run the SQL query on their website rather than cloning the data.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pbies (OP)
Full Member
***
Offline Offline

Activity: 254
Merit: 126



View Profile
June 13, 2022, 12:59:09 PM
 #7

RPC is too slow to call it for whole blockchain, and it will eat too much resources. I have synced Bitcoin Core, the blockchain. I need to operate on BerkeleyDB directly.

Since Bitcoin Core RPC-JSON doesn't meet your need, here are few pointers for reading the files directly.
1. https://bitcoindev.network/understanding-the-data/
2. https://github.com/bitcoin/bitcoin/issues/6613
3. https://learnmeabitcoin.com/technical/blkdat
4. https://bitcoin.stackexchange.com/a/48738

P.S. I would still recommend you to check self-hosted block explorer (e.g. mempool.space) and Electrum server (e.g. Fulcrum).

Dolthub is a remote solution, I need local solution.

Only if you run the SQL query on their website rather than cloning the data.

Thank you very much! This is what I needed! Especially link no 1.

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 12900K and RTX 4090
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!