I want to fetch statistical data about the bitcoin network. Things things like wallet count, transaction count etc. Had a node running and the blockchain is on my disk. However parsing it seems to be not that trivial. I tried python-blockchain-parser however I get leveldb issues on all of my machines. I dont know the structure well and it seems like an easy thing to miss out data (segwit, lightning). Any tips?
If you are comfortable with SQL and are interested in running queries over the entire chain, there is a BigQuery database hosted by Google. You can find more information here: https://bitcoin.stackexchange.com/a/117171/139612
If you are more interested in the analysis of specific blocks or of transactions,
bitcoin-cli provides a number of RPCs that can be used for fetching data, although this can be very slow when querying over large ranges.
In general, I'd recommend against parsing block files or leveldb files as those files are designed for efficient storage and easy use in the Bitcoin Core client and make no guarantees about being usable in other applications or providing a stable format.
In order to produce this graph
I used a blockchain parser to read block files that Bitcoin core had created. The blockchain parser created CSV data that I summarised using a second program and plotted using GNUPlot
A search for "Bitcoin blockchain parser" ought to find some examples. Perhaps one of them would be of use to you.
I wrote my own (see my profile)