Post
Topic
Board Project Development
Merits 1 from 1 user
Re: [Project Showcase] spruned - Bitcoin Light Client & Full Node Emulator
by
gdassori
on 13/04/2019, 14:24:01 UTC
⭐ Merited by pooya87 (1)
this seems like an interesting project but i am a bit confused about what exactly it downloads. you call it "block headers chain" and claim it is "about 150 MB on mainnet" which is where my confusion is. every bitcoin "block header" is 80 bytes and by the time of writing there are 570849 blocks so the size of the file should be 45,667,920 bytes or 45 MB (which is the same as the blockchain_headers file that Electrum downloads).
so what is the extra ~100 MB for?

I've implemented the more efficient serialization. As expected the new database is nearly half the previous:

71632 -rw-r--r-- 1 1000 1000  73347072 apr 13 16:15 headers.db

So it fits ((8+8+32+80)*571000)/1024, with this schema:

        id INTEGER PRIMARY KEY ASC,
        blockheight INTEGER,
        blockhash BLOB NOT NULL,
        data BLOB NOT NULL

As told in the previous post, I preferred to implement a migration system by myself, so I didn't add new third-party dependencies, and is something I like.

https://github.com/gdassori/spruned/commit/6767d89aaa9dc13f4800aec15b582d035069d1ba

Thanks for noticing the discrepancy :-)