Is there any tool to extract the bitcoin transaction network from the blockchain?

0

I'm looking for a way to extract some data from the latest downloaded bitcoin blockchain. In particular I'm interested in extracting the whole transaction network, so input and output public keys used in each transaction, the transaction date, hash, block hash and BTC amount. I tried several solutions so far with no luck:

Bitcoin-Transaction-Network-Extraction

rusty-blockparser

bitcointools

BitcoinDatabaseGenerator

BCGraph

I've had some luck with bitcoindatabasegenerator and rusty-blockparser, but while these tools succesfully extract the output PKs, input PKs are nowhere to be found in the resulting files.

Summarizing, I'm looking for something like this to produce a network visualization of bitcoin transactions:

|Source PK(s) (BTC)| ------> Transaction ------> |Target PK(s) (BTC)|

Im not really an expert in coding so this makes everything more complicated for me. Can you suggest me a way to extract this data from downloaded Blk files?

Any help would be greatly appreciated!

Nellous

Posted 2017-03-17T17:11:01.083

Reputation: 1

Answers

-2

BlockChain::BlockChain ( QObject* parent ) : QFile ( parent ), blkFile ( START_BLOCK )
{
  connect ( this, SIGNAL ( block ( const QByteArray& ) ), parent, SLOT ( block ( const QByteArray& ) ) );
  connect ( this, SIGNAL ( doneFile ( ) ), parent, SLOT ( doneFile ( ) ) );
  QTimer::singleShot ( 0, this, SLOT ( start ( ) ) );
}

void BlockChain::start ( )
{
  setFileName ( blkFileName ( blkFile++ ) );
  if ( !open ( QIODevice::ReadOnly ) )
  {
    _trace ( QString ( "cant open [%1]" ).arg ( fileName ( ) ) );
    emit block ( QByteArray ( ) );
    deleteLater ( );
  }
  else
  {
    _trace ( QString ( "processing [%1]" ).arg ( fileName ( ) ) );
    QTimer::singleShot ( 0, this, SLOT ( next ( ) ) );
  }
}

void BlockChain::next ( )
{
  if ( pos ( ) < size ( ) )
  {
    quint32 magic;
    quint32 sz ( read ( (char*)&magic, 4 ) );
    while ( !magic && pos ( ) < size ( ) - 4 )
      read ( (char*)&magic, 4 );
    xassert ( ( ( magic == MAGIC_ID ) || !magic ) && ( sz == 4 ) );
    if ( magic )
    {
      read ( (char*)&sz, 4 );
      emit block ( read ( sz ) );
      QTimer::singleShot ( 0, this, SLOT ( next ( ) ) );
      return;
    }
  }
  close ( );
  emit doneFile ( );
  QTimer::singleShot ( 0, this, SLOT ( start ( ) ) );
}

const QString BlockChain::blkFileName ( const int i ) const
{
  return
    ( i < 10 ) ? QString ( DATA_ROOT "\\blk0000%1.dat" ).arg ( i ) :
    ( i < 100 ) ? QString ( DATA_ROOT "\\blk000%1.dat" ).arg ( i ) :
    QString ( DATA_ROOT "\\blk00%1.dat" ).arg ( i );
}

amaclin

Posted 2017-03-17T17:11:01.083

Reputation: 5 763

This seems to be missing a class definition at least.Pieter Wuille 2017-03-18T17:01:06.157

this piece of code is only a demonstration that blockchain parsing is very simple taskamaclin 2017-03-18T17:59:42.053

1Ok, but it's not an answer. You don't explain what it does, why it works, what it needs.Pieter Wuille 2017-03-18T18:20:16.933

this is an answer for a question "Is there any tool to extract the bitcoin transaction [network] from the blockchain?". the short answer is: "yes, there is. here is a proof that such tool exists"amaclin 2017-03-18T23:34:09.590

1I'm downvoting this because it gives no context. Just a piece of code that doesn't even compile is not informative.Pieter Wuille 2017-03-19T00:15:26.207