A tool for import Bitcoin blockchain data into neo4j database.
Installation
Add this line to your application's Gemfile:
gem 'bitcoin2graphdb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bitcoin2graphdb
Requirements
This tool requires the following software.
- Bitcoin Core
- Neo4j (>= 3.0)
- gem neo4j-core
>= 9.0.0
- gem neo4j-core
Configuration
This tool requires the following configuration file.
bitcoin2graphdb:
bitcoin:
network: 'mainnet or testnet or regtest'
rpc:
user: 'Bitcoin Core rpc user.'
password: 'Bitcoin Core rpc password.'
schema: 'Bitcoin Core server schema. ex, http'
port: 'Bitcoin Core server port. ex, 8332'
host: 'Bitcoin Core server host. ex, xxx.xxx.xxx.xxx'
sleep_interval: 600
min_block_confirmation: 2
neo4j:
server: 'neo4j server url. ex, http://localhost:7474'
basic_auth:
username: 'neo4j username'
password: 'neo4j password'
initialize:
request:
timeout: 600
open_timeout: 2
You can use bolt protocol if you want more performance.
bitcoin2graphdb:
bitcoin:
network: 'mainnet or testnet or regtest'
rpc:
user: 'Bitcoin Core rpc user.'
password: 'Bitcoin Core rpc password.'
schema: 'Bitcoin Core server schema. ex, http'
port: 'Bitcoin Core server port. ex, 8332'
host: 'Bitcoin Core server host. ex, xxx.xxx.xxx.xxx'
sleep_interval: 600
min_block_confirmation: 2
neo4j:
server: 'neo4j server url. ex, bolt://localhost:7472 or bolt://user:password@localhost:7472'
options:
read_timeout: -1 # No timeout. It is blocking mode. Non blocking mode have a problem.
write_timeout: -1 # No timeout. It is blocking mode. Non blocking mode have a problem.
connect_timeout: 10
ssl: false # It is not support SSL yet.
Usage
- Show usage
$ bitcoin2graphdb help
- Start bitcoin2graphdb daemon
$ bitcoin2graphdb start -c <configuration file path>
- Stop bitcoin2graphdb daemon
$ bitcoin2graphdb stop
- Show bitcoin2graphdb Status
$ bitcoin2graphdb status
- Restart bitcoin2graphdb daemon
$ bitcoin2graphdb restart -c <configuration file path>
Extensions
Bitcoin2Graphdb currently supports following extensions.
Extension Key Name | Description |
---|---|
open_assets | Add Open Assets Protocol support. If this extension is enabled, the asset quantity and Graphdb::Model::AssetId association will be added to the Graphdb::Model::TxOut. |
- Open Assets Protocol
To enable extension, add an extension key name to enable the Configuration file like following.
bitcoin2graphdb:
...
extensions:
- 'open_assets'
Testing
When you run rspec, you need to run neo4j test server(http://localhost:7475) in advance. Others are the same as normal rspec.
setup test database
install test database
$ rake neo4j:install'[community-3.4.1,test]'
change port
$ rake neo4j:config'[test,7475]'
start test database
$ rake neo4j:start'[test]'
migration
$ rake neo4j:migrate
specify neo4j url (optional)
$ rake neo4j:migrate NEO4J_URL=http://localhost:7475
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/haw-itn/bitcoin2graphdb.
License
The MIT License (MIT)
Copyright (c) 2016 HAW International Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.