Bitcoin Forum
April 25, 2017, 07:07:40 AM *
News: If the forum does not load normally for you, please send me a traceroute.
 
   Home   Help Search Donate Login Register  
Pages: « 1 [2]  All
  Print  
Author Topic: High speed Blockchain Download  (Read 2498 times)
SgtSpike
Legendary
*
Offline Offline

Activity: 1330



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

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.

Code:
    for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev)
    {
        if (pindex->nHeight < nBestHeight-2500 && !mapArgs.count("-checkblocks"))
            break;
        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?
1493104060
Hero Member
*
Offline Offline

Posts: 1493104060

View Profile Personal Message (Offline)

Ignore
1493104060
Reply with quote  #2

1493104060
Report to moderator
1493104060
Hero Member
*
Offline Offline

Posts: 1493104060

View Profile Personal Message (Offline)

Ignore
1493104060
Reply with quote  #2

1493104060
Report to moderator
1493104060
Hero Member
*
Offline Offline

Posts: 1493104060

View Profile Personal Message (Offline)

Ignore
1493104060
Reply with quote  #2

1493104060
Report to moderator
Be very wary of relying on JavaScript for security on sites such as blockchain.info and brainwallet.org. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
nibor
Sr. Member
****
Offline Offline

Activity: 355


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

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
  Print  
 
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!