txcatcher 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +63 -58
- data/README.md +11 -14
- data/Rakefile +0 -14
- data/VERSION +1 -1
- data/lib/txcatcher/catcher.rb +4 -5
- data/lib/txcatcher/initializer.rb +1 -1
- data/lib/txcatcher.rb +1 -1
- data/spec/catcher_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -1
- data/txcatcher.gemspec +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d15212b3559d579704e262dc02ed9250a01e957c5b336a573f4a3499dd3bb00
|
|
4
|
+
data.tar.gz: f0f740d31b4e35e04d1fa65e664eb32fe73b1b1c3665f9e825bbb4640120096b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3fea87d4db4cf75cb92b9a86d96a52e430aa7fe219a2f636f1bab6cb9f3c344e11612bfb87bfcc3148e515769738cc92c37ec604be13e8c1c16299b0ffa845a2
|
|
7
|
+
data.tar.gz: 1257311dae7a0a84bce3057a69798a26e63b37e0aa4ee361e5aa44c13a6b1e3317c621710186d6089cca9bf30e67fb7b9488f2ec0b0f60b33a7a726500bcae2c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
addressable (2.
|
|
4
|
+
addressable (2.6.0)
|
|
5
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
5
6
|
async-rack (0.5.1)
|
|
6
7
|
rack (~> 1.1)
|
|
7
|
-
aws-
|
|
8
|
-
aws-
|
|
8
|
+
aws-eventstream (1.0.3)
|
|
9
|
+
aws-partitions (1.196.0)
|
|
10
|
+
aws-sdk-core (3.62.0)
|
|
11
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
|
9
12
|
aws-partitions (~> 1.0)
|
|
10
|
-
aws-sigv4 (~> 1.
|
|
13
|
+
aws-sigv4 (~> 1.1)
|
|
11
14
|
jmespath (~> 1.0)
|
|
12
|
-
aws-sdk-ses (1.
|
|
13
|
-
aws-sdk-core (~> 3)
|
|
14
|
-
aws-sigv4 (~> 1.
|
|
15
|
-
aws-sigv4 (1.0
|
|
15
|
+
aws-sdk-ses (1.25.0)
|
|
16
|
+
aws-sdk-core (~> 3, >= 3.61.1)
|
|
17
|
+
aws-sigv4 (~> 1.1)
|
|
18
|
+
aws-sigv4 (1.1.0)
|
|
19
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
|
16
20
|
builder (3.2.3)
|
|
17
|
-
crypto-unit (0.3.
|
|
21
|
+
crypto-unit (0.3.4)
|
|
18
22
|
descendants_tracker (0.0.4)
|
|
19
23
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
20
24
|
diff-lcs (1.3)
|
|
@@ -24,21 +28,20 @@ GEM
|
|
|
24
28
|
em-websocket (0.3.8)
|
|
25
29
|
addressable (>= 2.1.1)
|
|
26
30
|
eventmachine (>= 0.12.9)
|
|
27
|
-
eventmachine (1.2.
|
|
28
|
-
faraday (0.
|
|
31
|
+
eventmachine (1.2.7)
|
|
32
|
+
faraday (0.15.4)
|
|
29
33
|
multipart-post (>= 1.2, < 3)
|
|
30
|
-
ffi (1.
|
|
31
|
-
ffi-rzmq (2.0.
|
|
32
|
-
ffi-rzmq-core (>= 1.0.
|
|
33
|
-
ffi-rzmq-core (1.0.
|
|
34
|
+
ffi (1.11.1)
|
|
35
|
+
ffi-rzmq (2.0.7)
|
|
36
|
+
ffi-rzmq-core (>= 1.0.7)
|
|
37
|
+
ffi-rzmq-core (1.0.7)
|
|
34
38
|
ffi
|
|
35
|
-
git (1.
|
|
36
|
-
github_api (0.
|
|
37
|
-
addressable (~> 2.4
|
|
39
|
+
git (1.5.0)
|
|
40
|
+
github_api (0.18.2)
|
|
41
|
+
addressable (~> 2.4)
|
|
38
42
|
descendants_tracker (~> 0.0.4)
|
|
39
|
-
faraday (~> 0.8
|
|
40
|
-
hashie (>= 3.
|
|
41
|
-
mime-types (>= 1.16, < 3.0)
|
|
43
|
+
faraday (~> 0.8)
|
|
44
|
+
hashie (~> 3.5, >= 3.5.2)
|
|
42
45
|
oauth2 (~> 1.0)
|
|
43
46
|
goliath (1.0.6)
|
|
44
47
|
async-rack
|
|
@@ -52,69 +55,69 @@ GEM
|
|
|
52
55
|
rack (>= 1.2.2)
|
|
53
56
|
rack-contrib
|
|
54
57
|
rack-respond_to
|
|
55
|
-
hashie (3.
|
|
56
|
-
highline (
|
|
58
|
+
hashie (3.6.0)
|
|
59
|
+
highline (2.0.2)
|
|
57
60
|
http_parser.rb (0.6.0)
|
|
58
|
-
jeweler (2.
|
|
61
|
+
jeweler (2.1.1)
|
|
59
62
|
builder
|
|
60
|
-
bundler
|
|
63
|
+
bundler (>= 1.0)
|
|
61
64
|
git (>= 1.2.5)
|
|
62
|
-
github_api
|
|
65
|
+
github_api
|
|
63
66
|
highline (>= 1.6.15)
|
|
64
67
|
nokogiri (>= 1.5.10)
|
|
65
|
-
psych
|
|
66
68
|
rake
|
|
67
69
|
rdoc
|
|
68
|
-
|
|
69
|
-
jmespath (1.
|
|
70
|
-
jwt (
|
|
70
|
+
semver
|
|
71
|
+
jmespath (1.4.0)
|
|
72
|
+
jwt (2.2.1)
|
|
71
73
|
log4r (1.1.10)
|
|
72
|
-
|
|
73
|
-
mini_portile2 (2.3.0)
|
|
74
|
+
mini_portile2 (2.4.0)
|
|
74
75
|
multi_json (1.13.1)
|
|
75
76
|
multi_xml (0.6.0)
|
|
76
|
-
multipart-post (2.
|
|
77
|
-
nokogiri (1.
|
|
78
|
-
mini_portile2 (~> 2.
|
|
79
|
-
oauth2 (1.4.
|
|
80
|
-
faraday (>= 0.8, < 0.
|
|
81
|
-
jwt (
|
|
77
|
+
multipart-post (2.1.1)
|
|
78
|
+
nokogiri (1.10.3)
|
|
79
|
+
mini_portile2 (~> 2.4.0)
|
|
80
|
+
oauth2 (1.4.1)
|
|
81
|
+
faraday (>= 0.8, < 0.16.0)
|
|
82
|
+
jwt (>= 1.0, < 3.0)
|
|
82
83
|
multi_json (~> 1.3)
|
|
83
84
|
multi_xml (~> 0.5)
|
|
84
85
|
rack (>= 1.2, < 3)
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
pg (1.1.4)
|
|
87
|
+
public_suffix (3.1.1)
|
|
88
|
+
rack (1.6.11)
|
|
87
89
|
rack-accept-media-types (0.9)
|
|
88
90
|
rack-contrib (1.8.0)
|
|
89
91
|
rack (~> 1.4)
|
|
90
92
|
rack-respond_to (0.9.8)
|
|
91
93
|
rack-accept-media-types (>= 0.6)
|
|
92
|
-
rake (12.3.
|
|
93
|
-
rdoc (6.
|
|
94
|
-
rspec (3.
|
|
95
|
-
rspec-core (~> 3.
|
|
96
|
-
rspec-expectations (~> 3.
|
|
97
|
-
rspec-mocks (~> 3.
|
|
98
|
-
rspec-core (3.
|
|
99
|
-
rspec-support (~> 3.
|
|
100
|
-
rspec-expectations (3.
|
|
94
|
+
rake (12.3.3)
|
|
95
|
+
rdoc (6.1.1)
|
|
96
|
+
rspec (3.8.0)
|
|
97
|
+
rspec-core (~> 3.8.0)
|
|
98
|
+
rspec-expectations (~> 3.8.0)
|
|
99
|
+
rspec-mocks (~> 3.8.0)
|
|
100
|
+
rspec-core (3.8.2)
|
|
101
|
+
rspec-support (~> 3.8.0)
|
|
102
|
+
rspec-expectations (3.8.4)
|
|
101
103
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
102
|
-
rspec-support (~> 3.
|
|
103
|
-
rspec-mocks (3.
|
|
104
|
+
rspec-support (~> 3.8.0)
|
|
105
|
+
rspec-mocks (3.8.1)
|
|
104
106
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
105
|
-
rspec-support (~> 3.
|
|
106
|
-
rspec-support (3.
|
|
107
|
-
|
|
108
|
-
sentry-raven (2.
|
|
107
|
+
rspec-support (~> 3.8.0)
|
|
108
|
+
rspec-support (3.8.2)
|
|
109
|
+
semver (1.0.1)
|
|
110
|
+
sentry-raven (2.11.0)
|
|
109
111
|
faraday (>= 0.7.6, < 1.0)
|
|
110
|
-
sequel (5.
|
|
111
|
-
sqlite3 (1.
|
|
112
|
+
sequel (5.23.0)
|
|
113
|
+
sqlite3 (1.4.1)
|
|
112
114
|
thread_safe (0.3.6)
|
|
113
115
|
|
|
114
116
|
PLATFORMS
|
|
115
117
|
ruby
|
|
116
118
|
|
|
117
119
|
DEPENDENCIES
|
|
120
|
+
async-rack (= 0.5.1)
|
|
118
121
|
aws-sdk-ses
|
|
119
122
|
bundler
|
|
120
123
|
crypto-unit
|
|
@@ -122,10 +125,12 @@ DEPENDENCIES
|
|
|
122
125
|
ffi-rzmq
|
|
123
126
|
goliath
|
|
124
127
|
jeweler
|
|
128
|
+
pg
|
|
129
|
+
rack
|
|
125
130
|
rspec
|
|
126
131
|
sentry-raven
|
|
127
132
|
sequel
|
|
128
133
|
sqlite3
|
|
129
134
|
|
|
130
135
|
BUNDLED WITH
|
|
131
|
-
1.
|
|
136
|
+
1.17.2
|
data/README.md
CHANGED
|
@@ -85,29 +85,26 @@ tracking both litecoin and bitcoin transactions:
|
|
|
85
85
|
txcatcher -c ~/.txcatcher/litecoin_config.yml
|
|
86
86
|
txcatcher -c ~/.txcatcher/bitcoin_config.yml
|
|
87
87
|
|
|
88
|
-
Upstart
|
|
88
|
+
systemd & Upstart scripts
|
|
89
89
|
-------------
|
|
90
|
-
If running on Ubuntu, you may also want to create an
|
|
90
|
+
If running on Ubuntu, you may also want to create a systemd or an Upstart script, see templates:
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
setuid deploy
|
|
95
|
-
respawn
|
|
96
|
-
respawn limit 10 90
|
|
92
|
+
* [systemd template for txcatcher](templates/systemd_script.service)
|
|
93
|
+
* [upstart template for txcatcher](templates/upstart_script)
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
exec ${RVM_WRAPPERS_PATH}/txcatcher -c ${TXCATCHER_CONFIG}
|
|
95
|
+
Obviously, copy the file and place it into the appropriate dir:
|
|
96
|
+
* `/etc/services/txcatcher_btc_mainnet.service` for systemd
|
|
97
|
+
* `/etc/init.d/txcatcher_btc_mainnet` for upstart
|
|
103
98
|
|
|
104
99
|
For this to work, you need a number of prerequisites:
|
|
105
100
|
* create a `deploy` user, make sure rvm works with this user (rvm multi-user installation)
|
|
106
101
|
* DO NOT daemonize the process in config.yml, set `daemonize: false` in `/home/deploy/.txcatcher/config.yml`
|
|
107
102
|
* Generate rvm wrapper for txcatcher: https://rvm.io/deployment/init-d
|
|
108
|
-
* Make sure
|
|
103
|
+
* Make sure that bitcoind (or litecoind) is running before starting txcatcher. This can be done
|
|
104
|
+
on system level so bitcoind always starts before txcatcher (see upstart or systemd documentation).
|
|
109
105
|
|
|
110
|
-
You can then start and stop txcatcher with `
|
|
106
|
+
You can then start and stop txcatcher with `sudo service txcatcher_btc start` and `sudo service txcatcher_btc stop`
|
|
107
|
+
for systemd and `sudo start txcatcher_btc` and `sudo stop txcatcher_btc` for upstart.
|
|
111
108
|
|
|
112
109
|
Running unit tests
|
|
113
110
|
------------------
|
data/Rakefile
CHANGED
|
@@ -11,18 +11,4 @@ rescue Bundler::BundlerError => e
|
|
|
11
11
|
end
|
|
12
12
|
require 'rake'
|
|
13
13
|
|
|
14
|
-
require 'jeweler'
|
|
15
|
-
Jeweler::Tasks.new do |gem|
|
|
16
|
-
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
|
17
|
-
gem.name = "txcatcher"
|
|
18
|
-
gem.homepage = "http://github.com/snitko/txcatcher"
|
|
19
|
-
gem.license = "MIT"
|
|
20
|
-
gem.summary = %Q{An lightweight version of Bitpay's Insight, allows to check Bitcoin/Litecoin addresses}
|
|
21
|
-
gem.description = %Q{Ccurrently, the only job of this gem is to collect all new Bitcoin/Litecoin transactions, store them in a DB, index addresses.}
|
|
22
|
-
gem.email = "roman.snitko@gmail.com"
|
|
23
|
-
gem.authors = ["Roman Snitko"]
|
|
24
|
-
# dependencies defined in Gemfile
|
|
25
|
-
end
|
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
|
27
|
-
|
|
28
14
|
Dir.glob('lib/tasks/*.rake').each { |r| load r }
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.3
|
data/lib/txcatcher/catcher.rb
CHANGED
|
@@ -27,7 +27,7 @@ module TxCatcher
|
|
|
27
27
|
def listen_to_zeromq_message(channel:, address:)
|
|
28
28
|
@queue[channel] = Queue.new
|
|
29
29
|
|
|
30
|
-
# This thread is responsible for actions after the
|
|
30
|
+
# This thread is responsible for actions after the message from ZeroMQ is parsed,
|
|
31
31
|
# typically it's writing data to DB through the models. We start it
|
|
32
32
|
# before we start listening to any messages from ZeroMQ.
|
|
33
33
|
queue_thread = Thread.new do
|
|
@@ -62,12 +62,11 @@ module TxCatcher
|
|
|
62
62
|
loop do
|
|
63
63
|
topic = []
|
|
64
64
|
message = []
|
|
65
|
-
socket.
|
|
66
|
-
message
|
|
65
|
+
socket.recv_strings(message)
|
|
67
66
|
if message[1]
|
|
68
|
-
message_hex = hexlify(message[1]
|
|
67
|
+
message_hex = hexlify(message[1]).downcase
|
|
69
68
|
@sockets[key][:last_message] = message_hex
|
|
70
|
-
send("handle_#{channel}", message_hex)
|
|
69
|
+
send("handle_#{channel}", "#{message_hex}")
|
|
71
70
|
end
|
|
72
71
|
end
|
|
73
72
|
end
|
|
@@ -123,7 +123,7 @@ module TxCatcher
|
|
|
123
123
|
n = TxCatcher::Config.rpcnode
|
|
124
124
|
print "Checking #{n["name"]} RPC connection... "
|
|
125
125
|
TxCatcher.rpc_node = BitcoinRPC.new("http://#{n["user"]}:#{n["password"]}@#{n["host"]}:#{n["port"]}")
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
i = 0 # try to connect to RPC 100 times before exiting with error
|
|
128
128
|
until TxCatcher.current_block_height
|
|
129
129
|
begin
|
data/lib/txcatcher.rb
CHANGED
data/spec/catcher_spec.rb
CHANGED
|
@@ -11,17 +11,17 @@ RSpec.describe TxCatcher::Catcher do
|
|
|
11
11
|
before(:all) do
|
|
12
12
|
@tx_sock = ZMQ::Context.create(1).socket(ZMQ::PUB)
|
|
13
13
|
@block_sock = ZMQ::Context.create(2).socket(ZMQ::PUB)
|
|
14
|
-
@tx_sock.bind("ipc:///tmp/
|
|
15
|
-
@block_sock.bind("ipc:///tmp/
|
|
14
|
+
@tx_sock.bind("ipc:///tmp/bitcoind.rawtx")
|
|
15
|
+
@block_sock.bind("ipc:///tmp/bitcoind.hashblock")
|
|
16
16
|
@hextx = File.read(File.dirname(__FILE__) + "/fixtures/transaction.txt").strip
|
|
17
17
|
@rawtx = unhexlify(File.read(File.dirname(__FILE__) + "/fixtures/transaction.txt"))
|
|
18
|
-
@catcher = TxCatcher::Catcher.new(name: "
|
|
18
|
+
@catcher = TxCatcher::Catcher.new(name: "bitcoind")
|
|
19
19
|
sleep 1
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
after(:all) do
|
|
23
|
-
@tx_sock.unbind('ipc:///tmp/
|
|
24
|
-
@block_sock.unbind('ipc:///tmp/
|
|
23
|
+
@tx_sock.unbind('ipc:///tmp/bitcoind_testnet.rawtx')
|
|
24
|
+
@block_sock.unbind('ipc:///tmp/bitcoind_testnet.hashblock')
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it "creates a new transaction in the DB" do
|
data/spec/spec_helper.rb
CHANGED
data/txcatcher.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: txcatcher
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roman Snitko
|
|
@@ -207,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
208
|
version: '0'
|
|
209
209
|
requirements: []
|
|
210
|
-
|
|
211
|
-
rubygems_version: 2.7.6
|
|
210
|
+
rubygems_version: 3.0.3
|
|
212
211
|
signing_key:
|
|
213
212
|
specification_version: 4
|
|
214
213
|
summary: An lightweight version of Bitpay's Insight, allows to check Bitcoin/Litecoin
|