-
-
Save bitkevin/222100da143e10274467 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ UniversalTimer.o BinaryData.o FileDataPtr.o BtcUtils.o BlockObj.o BlockUtils.o libcryptopp.a -o bootstrap.out -Icryptopp -DUSE_CRYPTOPP -D__STDC_LIMIT_MACROS -lpthread bootstrap.cpp | |
#include "BlockUtils.h" | |
int main(void) | |
{ | |
string btcdir("/home/chris/.bitcoin"); | |
string bootstrap(btcdir + "/" + "bootstrap.dat"); | |
BlockDataManager_FileRefs::GetInstance().SelectNetwork("Main"); | |
BlockDataManager_FileRefs & bdm = BlockDataManager_FileRefs::GetInstance(); | |
BinaryData magic = bdm.getMagicBytes(); | |
ofstream os; | |
// bdm.SetBlkFileLocation(btcdir, 4, 1); // 4 digit blk0001.dat from 0.7.x | |
bdm.SetBlkFileLocation(btcdir + "/blocks", 5, 0); // 5 digit blocks/blk00000.dat from 0.8.x | |
bdm.parseEntireBlockchain(); | |
os.open(bootstrap.c_str(), ios::out | ios::binary); | |
for (uint32_t i=0; i<=216116; i++) { | |
BlockHeader * bhp = bdm.getHeaderByHeight(i); | |
os.write( bhp->serializeWholeBlock(magic, true).toBinStr().c_str(), bhp->getBlockSize()+8); | |
} | |
os.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment