Instantly share code, notes, and snippets.

What would you like to do?
create bootstrap.dat from bitcoin-qt's blk0000?.dat files
// 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 & 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();, 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);

This comment has been minimized.


dooglus commented Feb 21, 2013

git clone git://
build it
put the above into cppForSwig/bootstrap.cpp
edit btcdir to match the location of your bitcoin directory
build using the same flags as for BlockUtilsTest.out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment