Bitcoin Forum
April 20, 2018, 09:22:35 PM *
News: Latest stable version of Bitcoin Core: 0.16.0  [Torrent]. (New!)
   Home   Help Search Donate Login Register  
Pages: « 1 [2]  All
Author Topic: High speed Blockchain Download  (Read 2589 times)
Offline Offline

Activity: 1372
Merit: 1001

View Profile
August 19, 2011, 11:41:06 PM

When the Bitcoin client loads up, it only checks that the last 2500 blocks in the chain that it has are valid. Beyond that, you can change anything you want in the previous blocks without effecting what the client thinks the block hash is. Remember, the data on disk is assumed to have already been checked by your client, so there is no reason to check it on every startup. If it did, it would take hours to start your client.

That said, I have to thank you. I just discovered an undocumented command line option: -checkblocks. If you use that, you will be safe if you download an untrusted blockchain and put it in your data directory.

    for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev)
        if (pindex->nHeight < nBestHeight-2500 && !mapArgs.count("-checkblocks"))
        CBlock block;
        if (!block.ReadFromDisk(pindex))
            return error("LoadBlockIndex() : block.ReadFromDisk failed");
        if (!block.CheckBlock())
            printf("LoadBlockIndex() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
            pindexFork = pindex->pprev;
Line 474 in src/db.cpp
So a potential attack might go like this:
- Create corrupt blockchain, showing that you have 100,000 BTC at a particular address from a transaction back in block 100,000.
- Get more than 50% of miners to download said blockchain (impossible, given that major pools make up far more than 50% of hashing power, and they already have the blockchain)
- Send those 100,000 BTC to another real address.  The miners with the corrupted blockchain would accept the transaction.
- Spend, spend away!

What other concerns might this present?
There are several different types of Bitcoin clients. Hybrid server-assisted clients like Electrum get a lot of their network information from centralized servers, but they also check the server's results using blockchain header data. This is perhaps somewhat more secure than either server-assisted clients or header-only clients.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Hero Member
Offline Offline

Posts: 1524259355

View Profile Personal Message (Offline)

Reply with quote  #2

Report to moderator
Sr. Member
Offline Offline

Activity: 389
Merit: 250

View Profile
August 21, 2011, 02:49:02 PM

So the regular block chain isn't compressed at all? Why not? Isn't regular RLE pretty trivial to implement these days? Maybe some other reason.

Because the blockchain is full of hashes that are in effect random numbers it does not compress well.
You only get 20% compression, so does not seem worth it for all the extra effort.
Pages: « 1 [2]  All
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!