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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 409a5a403f8319181f1cd59e48ea047c1dd21969521cdac7f5ca4720055ad2d3
4
- data.tar.gz: e930dce76dcbd0d55900b4ac03c5d5038bd3fc3acddf382ca80326c0af428353
3
+ metadata.gz: 7d15212b3559d579704e262dc02ed9250a01e957c5b336a573f4a3499dd3bb00
4
+ data.tar.gz: f0f740d31b4e35e04d1fa65e664eb32fe73b1b1c3665f9e825bbb4640120096b
5
5
  SHA512:
6
- metadata.gz: 230257b520d4cd70b32cda25abb86a25312d22ef853f3fb36f7497fb63ef3b02101ebab3b24be0a7046258b27704c7e436db234a4d9b167127eb14b038c0994c
7
- data.tar.gz: dca18424e36eb7b166ad8331a0c0c5444edc713cef9dcf287b84b0a160eec7efa06d6177ae25f0743919b3c027db05b8713d38c55bf1cb9d554b05b010688efb
6
+ metadata.gz: 3fea87d4db4cf75cb92b9a86d96a52e430aa7fe219a2f636f1bab6cb9f3c344e11612bfb87bfcc3148e515769738cc92c37ec604be13e8c1c16299b0ffa845a2
7
+ data.tar.gz: 1257311dae7a0a84bce3057a69798a26e63b37e0aa4ee361e5aa44c13a6b1e3317c621710186d6089cca9bf30e67fb7b9488f2ec0b0f60b33a7a726500bcae2c
data/Gemfile CHANGED
@@ -7,10 +7,11 @@ gem "crypto-unit"
7
7
  gem "sentry-raven"
8
8
  gem "aws-sdk-ses"
9
9
  gem "faraday"
10
+ gem "rack"
11
+ gem "async-rack", "0.5.1"
10
12
 
11
13
  group :development do
12
14
  gem "bundler"
13
- gem "jeweler"
14
15
  end
15
16
 
16
17
  group :test do
data/Gemfile.lock CHANGED
@@ -1,20 +1,24 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- addressable (2.4.0)
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-partitions (1.68.0)
8
- aws-sdk-core (3.17.0)
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.0)
13
+ aws-sigv4 (~> 1.1)
11
14
  jmespath (~> 1.0)
12
- aws-sdk-ses (1.6.0)
13
- aws-sdk-core (~> 3)
14
- aws-sigv4 (~> 1.0)
15
- aws-sigv4 (1.0.2)
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.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.5)
28
- faraday (0.9.2)
31
+ eventmachine (1.2.7)
32
+ faraday (0.15.4)
29
33
  multipart-post (>= 1.2, < 3)
30
- ffi (1.9.21)
31
- ffi-rzmq (2.0.5)
32
- ffi-rzmq-core (>= 1.0.6)
33
- ffi-rzmq-core (1.0.6)
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.3.0)
36
- github_api (0.16.0)
37
- addressable (~> 2.4.0)
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, < 0.10)
40
- hashie (>= 3.4)
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.5.7)
56
- highline (1.7.10)
58
+ hashie (3.6.0)
59
+ highline (2.0.2)
57
60
  http_parser.rb (0.6.0)
58
- jeweler (2.3.9)
61
+ jeweler (2.1.1)
59
62
  builder
60
- bundler
63
+ bundler (>= 1.0)
61
64
  git (>= 1.2.5)
62
- github_api (~> 0.16.0)
65
+ github_api
63
66
  highline (>= 1.6.15)
64
67
  nokogiri (>= 1.5.10)
65
- psych
66
68
  rake
67
69
  rdoc
68
- semver2
69
- jmespath (1.3.1)
70
- jwt (1.5.6)
70
+ semver
71
+ jmespath (1.4.0)
72
+ jwt (2.2.1)
71
73
  log4r (1.1.10)
72
- mime-types (2.99.3)
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.0.0)
77
- nokogiri (1.8.2)
78
- mini_portile2 (~> 2.3.0)
79
- oauth2 (1.4.0)
80
- faraday (>= 0.8, < 0.13)
81
- jwt (~> 1.0)
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
- psych (3.0.2)
86
- rack (1.6.8)
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.0)
93
- rdoc (6.0.1)
94
- rspec (3.7.0)
95
- rspec-core (~> 3.7.0)
96
- rspec-expectations (~> 3.7.0)
97
- rspec-mocks (~> 3.7.0)
98
- rspec-core (3.7.1)
99
- rspec-support (~> 3.7.0)
100
- rspec-expectations (3.7.0)
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.7.0)
103
- rspec-mocks (3.7.0)
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.7.0)
106
- rspec-support (3.7.1)
107
- semver2 (3.4.2)
108
- sentry-raven (2.6.3)
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.5.0)
111
- sqlite3 (1.3.13)
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.16.0
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 script
88
+ systemd & Upstart scripts
89
89
  -------------
90
- If running on Ubuntu, you may also want to create an upstart script, so here's an example (`/etc/init/txcatcher_btc.conf`):
90
+ If running on Ubuntu, you may also want to create a systemd or an Upstart script, see templates:
91
91
 
92
- start on started bitcoind
93
- stop on shutdown
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
- env HOME="/home/deploy"
99
- env RVM_WRAPPERS_PATH="/usr/local/rvm/gems/ruby-2.3.4/wrappers"
100
- env TXCATCHER_CONFIG="/home/deploy/.txcatcher/config.yml"
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 your bitcoind or litecoind are also started with an upstart script: https://github.com/bitcoin/bitcoin/blob/0.13/contrib/init/bitcoind.conf
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 `start txcatcher_btc` and `stop txcatcher_btc`.
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.2
1
+ 0.2.3
@@ -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 messages from ZeroMQ is parsed,
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.recv_multipart(topic, message)
66
- message
65
+ socket.recv_strings(message)
67
66
  if message[1]
68
- message_hex = hexlify(message[1].copy_out_string).downcase
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
@@ -16,7 +16,7 @@ require_relative 'txcatcher/initializer'
16
16
  require_relative 'txcatcher/catcher'
17
17
  require_relative 'txcatcher/cleaner'
18
18
 
19
- include TxCatcher::Initializer
19
+ extend TxCatcher::Initializer
20
20
  prepare
21
21
 
22
22
  require_relative 'txcatcher/models/transaction'
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/bitcoind_test.rawtx")
15
- @block_sock.bind("ipc:///tmp/bitcoind_test.hashblock")
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: "bitcoind_test")
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/bitcoind_test.rawtx')
24
- @block_sock.unbind('ipc:///tmp/bitcoind_test.hashblock')
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
@@ -31,7 +31,7 @@ require_relative '../lib/txcatcher/models/deposit'
31
31
 
32
32
  def unhexlify(msg)
33
33
  msg.scan(/../).collect { |c| c.to_i(16).chr }.join
34
- end
34
+ end
35
35
 
36
36
  RSpec.configure do |config|
37
37
 
data/txcatcher.gemspec CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "txcatcher".freeze
9
- s.version = "0.2.2"
9
+ s.version = "0.2.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
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.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
- rubyforge_project:
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