Exemplo n.º 1
0
	BlockChainCommand(const char *dataPath)
	{
		mBlockChain = createBlockChain(dataPath);	// Create the block-chain parser using this root path
		mStatResolution = SR_YEAR;
		mMaxBlock = 500000;
		printf("Welcome to the BlockChain command parser.  Written by John W. Ratcliff on January 4, 2014 : TipJar: 1BT66EoaGySkbY9J6MugvQRhMMXDwPxPya\r\n");
		printf("Registered DataDirectory: %s to scan for the blockchain.\r\n", dataPath );
		printf("\r\n");
		mProcessTransactions = false;
		mProcessBlock = 0;
		mLastBlockScan = 0;
		mLastBlockPrint = 0;
		mFinishedScanning = false;
		mCurrentBlock = NULL;
		mLastTime = 0;
		mSatoshiTime = 0;
		mMinBalance = 1;
		mRecordAddresses = false;
		mAddresses = NULL;
		mMode = CM_NONE;

		if ( mBlockChain )
		{
			help();
		}
		else
		{
			printf("Failed to open file: blk00000.dat in directory: %s\r\n", dataPath );
			mMode = CM_EXIT;
		}
	}
Exemplo n.º 2
0
	BlockChainCommand(const char *dataPath,
						uint32_t maxBlock,
						bool processTransactions,
						StatResolution resolution,
						uint32_t searchText,
						uint32_t zombieDays):mMode(CM_SCAN),mExportTransactions(false),mAnalyze(false),
									mRecordAddresses(false),mFinishedScanning(false),
									mProcessTransactions(processTransactions),mStatResolution(resolution),
									mProcessBlock(0),mMaxBlock(maxBlock),mLastBlockScan(0),
									mLastBlockPrint(0),mCurrentBlock(NULL),
									mBlockChain(createBlockChain(dataPath)),mLastTime(0),mSatoshiTime(0),
									mMinBalance(1),mTransactionValue(false),mZombieDays(zombieDays),
									 mSearchText(searchText)
	{
		if ( mBlockChain )
		{
			mBlockChain->searchForText(mSearchText);
			mBlockChain->setZombieDays(mZombieDays);
		}
		printf("Running the BlockChain parser.  Written by John W. Ratcliff on January 4, 2014 : TipJar: 1NY8SuaXfh8h5WHd4QnYwpgL1mNu9hHVBT\r\n");
		printf("Registered DataDirectory: %s to scan for the blockchain.\r\n", dataPath );
		printf("\r\n");
		printf("You may press the ESC key to cleanly exit the processing wherever it is at currently.\r\n");
		printf("\r\n");
		if ( mBlockChain == NULL )
		{
			printf("Failed to open file: blk00000.dat in directory: %s\r\n", dataPath );
			mMode = CM_EXIT;
		}
	}
Exemplo n.º 3
0
int main(int argc,const char **argv)
{

	uint8_t publicKey[65] = { 0x04,0x50,0x86,0x3A,0xD6,0x4A,0x87,0xAE,0x8A,0x2F,0xE8,0x3C,0x1A,
	    					  0xF1,0xA8,0x40,0x3C,0xB5,0x3F,0x53,0xE4,0x86,0xD8,0x51,0x1D,0xAD,
	    					  0x8A,0x04,0x88,0x7E,0x5B,0x23,0x52,0x2C,0xD4,0x70,0x24,0x34,0x53,
	    					  0xA2,0x99,0xFA,0x9E,0x77,0x23,0x77,0x16,0x10,0x3A,0xBC,0x11,0xA1,
	    					  0xDF,0x38,0x85,0x5E,0xD6,0xF2,0xEE,0x18,0x7E,0x9C,0x58,0x2B,0xA6 };

	char scratch[256];
	uint8_t address1[25];
	uint8_t address2[25];
	bitcoinPublicKeyToAddress(0,publicKey,address1);
	bitcoinPublicKeyToAscii(0,publicKey,scratch,256);
	bitcoinAsciiToAddress(scratch,address2);

	const char *dataPath = "..\\..\\";
	if ( argc < 2 )
	{
		printf("Using local test FILE of the first 4310 blocks in the block chain.\r\n");
	}
	else
	{
		dataPath = argv[1];
	}


	BlockChain *b = createBlockChain(dataPath);	// Create the block-chain parser using this root path
	if ( b )
	{
		const BlockChain::Block *block = b->readBlock();	// read the first block
		while ( block )
		{
			if ( block->blockIndex > 171 ) // only process the first 171 blocks for the moment
			{
				break;
			}
			b->printBlock(block);
			block = b->readBlock(); // keep reading blocks until we are done.
		}
		b->release(); // release the block-chain parser
	}
	return 0;
}
Exemplo n.º 4
0
	BlockChainCommand(const char *dataPath,
						uint32_t maxBlock,
						bool processTransactions,
						StatResolution resolution,
						uint32_t searchText,
						uint32_t zombieDays)
	{
		mTransactionValue = true;
		mAnalyze = false;
		mExportTransactions = false;
		mBlockChain = createBlockChain(dataPath);	// Create the block-chain parser using this root path
		mZombieDays = zombieDays;
		mSearchText = searchText;
		if ( mBlockChain )
		{
			mBlockChain->searchForText(mSearchText);
			mBlockChain->setZombieDays(mZombieDays);
		}
		mStatResolution = resolution;
		mMaxBlock = maxBlock;

		printf("Running the BlockChain parser.  Written by John W. Ratcliff on January 4, 2014 : TipJar: 1NY8SuaXfh8h5WHd4QnYwpgL1mNu9hHVBT\r\n");
		printf("Registered DataDirectory: %s to scan for the blockchain.\r\n", dataPath );
		printf("\r\n");
		printf("You may press the ESC key to cleanly exit the processing wherever it is at currently.\r\n");
		printf("\r\n");
		mProcessTransactions = processTransactions;
		mProcessBlock = 0;
		mLastBlockScan = 0;
		mLastBlockPrint = 0;
		mFinishedScanning = false;
		mCurrentBlock = NULL;
		mLastTime = 0;
		mSatoshiTime = 0;
		mMinBalance = 1;
		mRecordAddresses = false;
		mMode = CM_SCAN;

		if ( mBlockChain == NULL )
		{
			printf("Failed to open file: blk00000.dat in directory: %s\r\n", dataPath );
			mMode = CM_EXIT;
		}
	}