Export from blocksci to Neo4j
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Write a python 3.x script that exports bitcoin blockchain from blocksci to Neo4j, being the nodes the addresses and the transactions the relationships.

The preferred solution is to export the information formated CVS to bulk load into Neo4j. A function to export directly from blocksci to Neo4j would have a tip.

https://github.com/citp/BlockSci

Some links that can help with the assignment:

https://neo4j.com/blog/import-bitcoin-blockchain-neo4j/

https://github.com/in3rsha/bitcoin-to-neo4j

6 days ago

Crowdsource coding tasks.

1 Solution


The resources needed to run blocksci locally are just crazy, so i did not try to get a local copy and test this up, but am sure one or a mix of these two repos will do the job for you, ...

First you should take a look at this Python library for exploring the Bitcoin transaction graph. it basically can enable you to have one synchronisation script that can be called from a cron job, which reads blocks from bitcoind and writes them into Neo4j.

If you are an Apache Airflow fan, this repo will work for you all the way...

and if you just want to export blockchain data maybe view it before the import.

import blocksci
import matplotlib.pyplot as plt
import matplotlib.ticker
import collections
import pandas as pd
import numpy as np
%matplotlib notebook
# parser_data_directory should be set to the data-directory which the blocksci_parser output
chain = blocksci.Blockchain("/home/ubuntu/bitcoin")
exampleTxIndex = 300000
exampleTx = chain.tx_with_index(exampleTxIndex)
print(exampleTx.outs.address.all) 

Good luck!

Thanks for the reply. The blocksci resources are crazy if you want to do it with the whole blockchain, but for test with some blocks and tx would be enough. An approach would be to modify the following script to talk to neo4j the way it is done in the bitcoin-to-neo4j repo of in3rsha. https://github.com/graphsense/graphsense-blocksci/blob/master/scripts/blocksci_export.py
luisal 8 days ago