bitcoin2graphdb 0.3.9 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -1
- data/.travis.yml +7 -1
- data/README.md +11 -1
- data/bitcoin2graphdb.gemspec +2 -2
- data/db/neo4j/migrate/20190306081251_force_create_graphdb_model_active_node_base_uuid_constraint.rb +9 -0
- data/db/neo4j/migrate/20190306081322_force_create_graphdb_model_address_address_index.rb +9 -0
- data/db/neo4j/migrate/20190306081338_force_create_graphdb_model_block_block_hash_index.rb +9 -0
- data/db/neo4j/migrate/20190306081351_force_create_graphdb_model_asset_id_asset_id_index.rb +9 -0
- data/db/neo4j/migrate/20190306081404_force_create_graphdb_model_transaction_txid_index.rb +9 -0
- data/db/neo4j/schema.yml +29 -0
- data/lib/base.rb +2 -1
- data/lib/bitcoin2graphdb/migration.rb +7 -6
- data/lib/bitcoin2graphdb/version.rb +1 -1
- data/lib/graphdb/model/address.rb +1 -1
- data/lib/graphdb/model/block.rb +1 -1
- data/lib/graphdb/model/extensions/open_assets/asset_id.rb +1 -1
- data/lib/graphdb/model/transaction.rb +1 -1
- metadata +25 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0ac28219e6acc4dd69b308b06455aaf8ff0ec94bf4c3877cc3e44cfcd674948f
|
4
|
+
data.tar.gz: 8defec9f49d8f193cb56a41f63ea124469fddb1f349e6b833595f735d5a1227a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a66eb8c0226b4e3c4a55ebd5dfb3ff1d7221bab3aa6603119ae0ebe572ce50d028da4bc2f2e4817215a39c4ccbbc144d7a62a16eb8bbaa50ad725b10d387b25c
|
7
|
+
data.tar.gz: 1ca94b824c0a3f23458dd05bd01ef3d9e40a2a141dd530f0d51131a08896d7ea31193ecd1b9b48d5ac92e46ccbb9a69868061080990d84d13ec96f61a94618dc
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -7,9 +7,15 @@ rvm:
|
|
7
7
|
bundler_args: --jobs=2
|
8
8
|
|
9
9
|
before_script:
|
10
|
-
- bundle exec rake neo4j:install[community-
|
10
|
+
- bundle exec rake neo4j:install[community-3.4.1,test]
|
11
11
|
- bundle exec rake neo4j:config[test,7475]
|
12
12
|
- bundle exec rake neo4j:start[test]
|
13
|
+
- sleep 20
|
14
|
+
- bundle exec rake neo4j:migrate
|
15
|
+
|
16
|
+
env:
|
17
|
+
global:
|
18
|
+
- NEO4J_URL="http://localhost:7475"
|
13
19
|
|
14
20
|
script:
|
15
21
|
- bundle exec rake spec
|
data/README.md
CHANGED
@@ -109,7 +109,7 @@ Others are the same as normal rspec.
|
|
109
109
|
### install test database
|
110
110
|
|
111
111
|
```
|
112
|
-
$ rake neo4j:install'[community-
|
112
|
+
$ rake neo4j:install'[community-3.4.1,test]'
|
113
113
|
```
|
114
114
|
|
115
115
|
### change port
|
@@ -124,6 +124,16 @@ $ rake neo4j:config'[test,7475]'
|
|
124
124
|
$ rake neo4j:start'[test]'
|
125
125
|
```
|
126
126
|
|
127
|
+
### migration
|
128
|
+
```
|
129
|
+
$ rake neo4j:migrate
|
130
|
+
```
|
131
|
+
|
132
|
+
#### specify neo4j url (optional)
|
133
|
+
```
|
134
|
+
$ rake neo4j:migrate NEO4J_URL=http://localhost:7475
|
135
|
+
```
|
136
|
+
|
127
137
|
## Contributing
|
128
138
|
|
129
139
|
Bug reports and pull requests are welcome on GitHub at https://github.com/haw-itn/bitcoin2graphdb.
|
data/bitcoin2graphdb.gemspec
CHANGED
@@ -21,14 +21,14 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_runtime_dependency "openassets-ruby", ">= 0.6.5"
|
23
23
|
spec.add_runtime_dependency "daemon-spawn"
|
24
|
-
spec.add_runtime_dependency "neo4j", "~>
|
24
|
+
spec.add_runtime_dependency "neo4j", "~>9.4.0"
|
25
|
+
spec.add_runtime_dependency "neo4j-rake_tasks"
|
25
26
|
spec.add_runtime_dependency "activesupport", ">= 4.0.2"
|
26
27
|
spec.add_runtime_dependency "thor"
|
27
28
|
|
28
29
|
spec.add_development_dependency "bundler", "~> 1.10"
|
29
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
31
|
spec.add_development_dependency "rspec"
|
31
|
-
spec.add_development_dependency "database_cleaner"
|
32
32
|
spec.add_development_dependency "octorelease"
|
33
33
|
|
34
34
|
end
|
data/db/neo4j/schema.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of ActiveNode to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.yml definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using neo4j:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
---
|
14
|
+
:constraints:
|
15
|
+
- CONSTRAINT ON ( `graphdb::model::activenodebase`:`Graphdb::Model::ActiveNodeBase`
|
16
|
+
) ASSERT `graphdb::model::activenodebase`.uuid IS UNIQUE
|
17
|
+
- CONSTRAINT ON ( `neo4j::migrations::schemamigration`:`Neo4j::Migrations::SchemaMigration`
|
18
|
+
) ASSERT `neo4j::migrations::schemamigration`.migration_id IS UNIQUE
|
19
|
+
:indexes:
|
20
|
+
- INDEX ON :Graphdb::Model::Address(address)
|
21
|
+
- INDEX ON :Graphdb::Model::AssetId(asset_id)
|
22
|
+
- INDEX ON :Graphdb::Model::Block(block_hash)
|
23
|
+
- INDEX ON :Graphdb::Model::Transaction(txid)
|
24
|
+
:versions:
|
25
|
+
- '20190306081251'
|
26
|
+
- '20190306081322'
|
27
|
+
- '20190306081338'
|
28
|
+
- '20190306081351'
|
29
|
+
- '20190306081404'
|
data/lib/base.rb
CHANGED
@@ -11,7 +11,8 @@ module Bitcoin2Graphdb
|
|
11
11
|
end
|
12
12
|
neo4j_config = {basic_auth: config[:neo4j][:basic_auth], initialize: neo4j_timeout_ops(config)}
|
13
13
|
Bitcoin2Graphdb::Bitcoin.provider = Bitcoin2Graphdb::Bitcoin::BlockchainProvider.new(config[:bitcoin])
|
14
|
-
Neo4j::
|
14
|
+
neo4j_adaptor = Neo4j::Core::CypherSession::Adaptors::HTTP.new(config[:neo4j][:server], neo4j_config)
|
15
|
+
Neo4j::ActiveBase.on_establish_session { Neo4j::Core::CypherSession.new(neo4j_adaptor) }
|
15
16
|
@sleep_interval = config[:bitcoin][:sleep_interval].nil? ? 600 : config[:bitcoin][:sleep_interval].to_i
|
16
17
|
|
17
18
|
Graphdb::Model.constants.each {|const_name| Graphdb::Model.const_get(const_name)}
|
@@ -25,7 +26,7 @@ module Bitcoin2Graphdb
|
|
25
26
|
|
26
27
|
def run_with_height(block_height)
|
27
28
|
puts "start migration for block height = #{block_height}. #{Time.now}"
|
28
|
-
Neo4j::
|
29
|
+
Neo4j::ActiveBase.run_transaction do |tx|
|
29
30
|
begin
|
30
31
|
Graphdb::Model::Block.create_from_block_height(block_height)
|
31
32
|
@block_height = block_height
|
@@ -43,7 +44,7 @@ module Bitcoin2Graphdb
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def repair_assign_txs(block_height)
|
46
|
-
Neo4j::
|
47
|
+
Neo4j::ActiveBase.run_transaction do |tx|
|
47
48
|
begin
|
48
49
|
block = Graphdb::Model::Block.with_height(block_height).first
|
49
50
|
if block
|
@@ -66,7 +67,7 @@ module Bitcoin2Graphdb
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def remove_block(block_height)
|
69
|
-
Neo4j::
|
70
|
+
Neo4j::ActiveBase.run_transaction do |tx|
|
70
71
|
begin
|
71
72
|
block = Graphdb::Model::Block.with_height(block_height).first
|
72
73
|
if block.nil?
|
@@ -83,7 +84,7 @@ module Bitcoin2Graphdb
|
|
83
84
|
end
|
84
85
|
|
85
86
|
def import_tx(txid)
|
86
|
-
Neo4j::
|
87
|
+
Neo4j::ActiveBase.run_transaction do |tx|
|
87
88
|
begin
|
88
89
|
tx = Graphdb::Model::Transaction.with_txid(txid).first
|
89
90
|
if tx.nil?
|
@@ -100,7 +101,7 @@ module Bitcoin2Graphdb
|
|
100
101
|
end
|
101
102
|
|
102
103
|
def remove_tx(txid)
|
103
|
-
Neo4j::
|
104
|
+
Neo4j::ActiveBase.run_transaction do |tx|
|
104
105
|
begin
|
105
106
|
tx = Graphdb::Model::Transaction.with_txid(txid).first
|
106
107
|
if tx.nil?
|
data/lib/graphdb/model/block.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitcoin2graphdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: openassets-ruby
|
@@ -44,14 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 9.4.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 9.4.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: neo4j-rake_tasks
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: activesupport
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,20 +136,6 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: database_cleaner
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: octorelease
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,12 @@ files:
|
|
171
171
|
- bin/console
|
172
172
|
- bin/setup
|
173
173
|
- bitcoin2graphdb.gemspec
|
174
|
+
- db/neo4j/migrate/20190306081251_force_create_graphdb_model_active_node_base_uuid_constraint.rb
|
175
|
+
- db/neo4j/migrate/20190306081322_force_create_graphdb_model_address_address_index.rb
|
176
|
+
- db/neo4j/migrate/20190306081338_force_create_graphdb_model_block_block_hash_index.rb
|
177
|
+
- db/neo4j/migrate/20190306081351_force_create_graphdb_model_asset_id_asset_id_index.rb
|
178
|
+
- db/neo4j/migrate/20190306081404_force_create_graphdb_model_transaction_txid_index.rb
|
179
|
+
- db/neo4j/schema.yml
|
174
180
|
- exe/bitcoin2graphdb
|
175
181
|
- lib/base.rb
|
176
182
|
- lib/bitcoin2graphdb.rb
|
@@ -215,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
221
|
version: '0'
|
216
222
|
requirements: []
|
217
223
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.
|
224
|
+
rubygems_version: 2.7.9
|
219
225
|
signing_key:
|
220
226
|
specification_version: 4
|
221
227
|
summary: A tool for import Bitcoin blockchain data into neo4j database.
|