Skip to content

Of transactions in the Bitcoin blockchain

Ashish Gehani edited this page Apr 26, 2017 · 3 revisions

The Bitcoin blockchain is a ledger of transactions, grouped into blocks that have been verified together.

The steps below describe how to use SPADE's Bitcoin reporter to ingest the blockchain.


Requirements

The reference implementation of Bitcoin must be installed.


On Ubuntu 14.04, Bitcoin can be installed with:

sudo apt-add-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install bitcoind

On Mac OS X, Bitcoin can be installed with:

curl -O https://bitcoin.org/bin/bitcoin-core-0.11.2/bitcoin-0.11.2-osx64.tar.gz
tar xvf bitcoin-0.11.2-osx64.tar.gz
echo $PWD/bitcoin-0.11.2/bin > $SPADE/cfg/bitcoin.path

assuming $SPADE is set to SPADE's top-level directory.


Starting Bitcoin

Configure and run the Bitcoin daemon, bitcoind:

mkdir ~/.bitcoin
cp $SPADE/cfg/bitcoin.conf ~/.bitcoin/bitcoin.conf
bitcoind

Since initialization can take a significant period of time, its progress can be monitored with:

bitcoin-cli getblockcount

Ingesting the blockchain

The Bitcoin reporter can be started using SPADE's controller:

-> add reporter Bitcoin

The reporter will connect to bitcoind and start downloading blocks from the genesis block (which has height 0). The blocks and transactions will be represented as data provenance using the W3C PROV data model. Details of the key-value annotations are available here.

Since ingestion of the entire blockchain can take days even on a server, the reporter supports collection of a limited set of blocks. This can be done using the optional arguments start and end. For example, to ingest the blocks with height 10, 11, and 12, the reporter can be started with:

-> add reporter Bitcoin start=10 end=12

If an end argument is not provided, the reporter will continue ingesting new blocks as they become available from the Bitcoin daemon.


To stop collecting Bitcoin blocks, use this command in SPADE's controller:

-> remove reporter Bitcoin
Clone this wiki locally