tapyrus 0.2.3 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +37 -0
- data/.prettierignore +3 -0
- data/.prettierrc.yaml +3 -0
- data/CODE_OF_CONDUCT.md +7 -7
- data/README.md +14 -17
- data/Rakefile +3 -3
- data/lib/openassets.rb +0 -2
- data/lib/openassets/marker_output.rb +0 -4
- data/lib/openassets/payload.rb +4 -10
- data/lib/schnorr.rb +2 -3
- data/lib/schnorr/signature.rb +3 -6
- data/lib/tapyrus.rb +7 -30
- data/lib/tapyrus/base58.rb +7 -6
- data/lib/tapyrus/block.rb +1 -2
- data/lib/tapyrus/block_header.rb +15 -9
- data/lib/tapyrus/bloom_filter.rb +5 -3
- data/lib/tapyrus/chain_params.rb +1 -4
- data/lib/tapyrus/chainparams/dev.yml +3 -2
- data/lib/tapyrus/chainparams/prod.yml +3 -2
- data/lib/tapyrus/constants.rb +29 -23
- data/lib/tapyrus/errors.rb +1 -3
- data/lib/tapyrus/ext.rb +1 -1
- data/lib/tapyrus/ext/ecdsa.rb +4 -4
- data/lib/tapyrus/ext/json_parser.rb +1 -4
- data/lib/tapyrus/ext_key.rb +38 -34
- data/lib/tapyrus/key.rb +31 -35
- data/lib/tapyrus/key_path.rb +15 -12
- data/lib/tapyrus/logger.rb +20 -16
- data/lib/tapyrus/merkle_tree.rb +19 -20
- data/lib/tapyrus/message.rb +14 -16
- data/lib/tapyrus/message/addr.rb +1 -7
- data/lib/tapyrus/message/base.rb +0 -3
- data/lib/tapyrus/message/block.rb +2 -9
- data/lib/tapyrus/message/block_transaction_request.rb +3 -6
- data/lib/tapyrus/message/block_transactions.rb +2 -6
- data/lib/tapyrus/message/block_txn.rb +0 -4
- data/lib/tapyrus/message/cmpct_block.rb +1 -7
- data/lib/tapyrus/message/error.rb +1 -4
- data/lib/tapyrus/message/fee_filter.rb +1 -4
- data/lib/tapyrus/message/filter_add.rb +0 -4
- data/lib/tapyrus/message/filter_clear.rb +0 -4
- data/lib/tapyrus/message/filter_load.rb +2 -5
- data/lib/tapyrus/message/get_addr.rb +0 -4
- data/lib/tapyrus/message/get_block_txn.rb +0 -4
- data/lib/tapyrus/message/get_blocks.rb +0 -3
- data/lib/tapyrus/message/get_data.rb +1 -4
- data/lib/tapyrus/message/get_headers.rb +1 -3
- data/lib/tapyrus/message/header_and_short_ids.rb +3 -9
- data/lib/tapyrus/message/headers.rb +0 -4
- data/lib/tapyrus/message/headers_parser.rb +3 -8
- data/lib/tapyrus/message/inv.rb +1 -4
- data/lib/tapyrus/message/inventories_parser.rb +2 -7
- data/lib/tapyrus/message/inventory.rb +12 -5
- data/lib/tapyrus/message/mem_pool.rb +0 -4
- data/lib/tapyrus/message/merkle_block.rb +4 -9
- data/lib/tapyrus/message/network_addr.rb +7 -6
- data/lib/tapyrus/message/not_found.rb +0 -3
- data/lib/tapyrus/message/ping.rb +0 -3
- data/lib/tapyrus/message/pong.rb +0 -3
- data/lib/tapyrus/message/prefilled_tx.rb +0 -4
- data/lib/tapyrus/message/reject.rb +0 -3
- data/lib/tapyrus/message/send_cmpct.rb +1 -3
- data/lib/tapyrus/message/send_headers.rb +0 -3
- data/lib/tapyrus/message/tx.rb +0 -4
- data/lib/tapyrus/message/ver_ack.rb +1 -5
- data/lib/tapyrus/message/version.rb +2 -5
- data/lib/tapyrus/mnemonic.rb +17 -15
- data/lib/tapyrus/network.rb +0 -2
- data/lib/tapyrus/network/connection.rb +0 -3
- data/lib/tapyrus/network/message_handler.rb +61 -60
- data/lib/tapyrus/network/peer.rb +13 -12
- data/lib/tapyrus/network/peer_discovery.rb +3 -5
- data/lib/tapyrus/network/pool.rb +12 -12
- data/lib/tapyrus/node.rb +1 -1
- data/lib/tapyrus/node/cli.rb +12 -14
- data/lib/tapyrus/node/configuration.rb +1 -3
- data/lib/tapyrus/node/spv.rb +2 -3
- data/lib/tapyrus/opcodes.rb +9 -7
- data/lib/tapyrus/out_point.rb +5 -5
- data/lib/tapyrus/rpc/http_server.rb +21 -22
- data/lib/tapyrus/rpc/request_handler.rb +42 -44
- data/lib/tapyrus/rpc/tapyrus_core_client.rb +53 -25
- data/lib/tapyrus/script/color.rb +20 -2
- data/lib/tapyrus/script/multisig.rb +13 -12
- data/lib/tapyrus/script/script.rb +104 -67
- data/lib/tapyrus/script/script_error.rb +1 -4
- data/lib/tapyrus/script/script_interpreter.rb +439 -399
- data/lib/tapyrus/script/tx_checker.rb +20 -10
- data/lib/tapyrus/secp256k1.rb +0 -4
- data/lib/tapyrus/secp256k1/native.rb +17 -18
- data/lib/tapyrus/secp256k1/rfc6979.rb +7 -4
- data/lib/tapyrus/secp256k1/ruby.rb +10 -12
- data/lib/tapyrus/slip39.rb +20 -5
- data/lib/tapyrus/slip39/share.rb +41 -29
- data/lib/tapyrus/slip39/sss.rb +101 -57
- data/lib/tapyrus/store.rb +1 -3
- data/lib/tapyrus/store/chain_entry.rb +0 -4
- data/lib/tapyrus/store/db.rb +0 -2
- data/lib/tapyrus/store/db/level_db.rb +5 -9
- data/lib/tapyrus/store/spv_chain.rb +11 -17
- data/lib/tapyrus/tx.rb +45 -37
- data/lib/tapyrus/tx_builder.rb +158 -0
- data/lib/tapyrus/tx_in.rb +1 -6
- data/lib/tapyrus/tx_out.rb +2 -7
- data/lib/tapyrus/util.rb +20 -7
- data/lib/tapyrus/validation.rb +12 -11
- data/lib/tapyrus/version.rb +1 -1
- data/lib/tapyrus/wallet/account.rb +22 -18
- data/lib/tapyrus/wallet/base.rb +12 -9
- data/lib/tapyrus/wallet/db.rb +6 -9
- data/lib/tapyrus/wallet/master_key.rb +2 -4
- data/tapyrusrb.gemspec +13 -16
- metadata +20 -31
- data/.travis.yml +0 -12
data/lib/tapyrus/wallet/db.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
module Tapyrus
|
2
2
|
module Wallet
|
3
|
-
|
4
3
|
class DB
|
5
|
-
|
6
4
|
KEY_PREFIX = {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
account: 'a', # key: account index, value: Account raw data.
|
6
|
+
master: 'm', # value: wallet seed.
|
7
|
+
version: 'v', # value: wallet version
|
8
|
+
key: 'k' # key: path to the key, value: public key
|
11
9
|
}
|
12
10
|
|
13
11
|
attr_reader :level_db
|
@@ -27,7 +25,7 @@ module Tapyrus
|
|
27
25
|
def accounts
|
28
26
|
from = KEY_PREFIX[:account] + '00000000'
|
29
27
|
to = KEY_PREFIX[:account] + 'ffffffff'
|
30
|
-
level_db.each(from: from, to: to).map { |k, v| v}
|
28
|
+
level_db.each(from: from, to: to).map { |k, v| v }
|
31
29
|
end
|
32
30
|
|
33
31
|
def save_account(account)
|
@@ -50,7 +48,7 @@ module Tapyrus
|
|
50
48
|
id = [account.purpose, account.index].pack('I*').bth
|
51
49
|
from = KEY_PREFIX[:key] + id + '00000000'
|
52
50
|
to = KEY_PREFIX[:key] + id + 'ffffffff'
|
53
|
-
level_db.each(from: from, to: to).map { |k, v| v}
|
51
|
+
level_db.each(from: from, to: to).map { |k, v| v }
|
54
52
|
end
|
55
53
|
|
56
54
|
# get master_key
|
@@ -75,7 +73,6 @@ module Tapyrus
|
|
75
73
|
def version
|
76
74
|
level_db.get(KEY_PREFIX[:version]).to_i
|
77
75
|
end
|
78
|
-
|
79
76
|
end
|
80
77
|
end
|
81
78
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Tapyrus
|
2
2
|
module Wallet
|
3
|
-
|
4
3
|
# HD Wallet master seed
|
5
4
|
class MasterKey
|
6
5
|
include Tapyrus::HexConverter
|
@@ -53,7 +52,7 @@ module Tapyrus
|
|
53
52
|
# [encrypted(false:0, true:1)][salt(var str)][seed(var str)]
|
54
53
|
def to_payload
|
55
54
|
flg = encrypted ? 1 : 0
|
56
|
-
pack_var_int(flg) << [salt, seed].map{|v|pack_var_string(v.htb)}.join
|
55
|
+
pack_var_int(flg) << [salt, seed].map { |v| pack_var_string(v.htb) }.join
|
57
56
|
end
|
58
57
|
|
59
58
|
# get master key
|
@@ -67,7 +66,7 @@ module Tapyrus
|
|
67
66
|
# @return [Tapyrus::ExtKey]
|
68
67
|
def derive(path)
|
69
68
|
derived_key = key
|
70
|
-
parse_key_path(path).each{|num| derived_key = derived_key.derive(num)}
|
69
|
+
parse_key_path(path).each { |num| derived_key = derived_key.derive(num) }
|
71
70
|
derived_key
|
72
71
|
end
|
73
72
|
|
@@ -105,7 +104,6 @@ module Tapyrus
|
|
105
104
|
key_iv = OpenSSL::PKCS5.pbkdf2_hmac_sha1(passphrase, salt, 2000, enc.key_len + enc.iv_len)
|
106
105
|
[key_iv[0, enc.key_len], key_iv[enc.key_len, enc.iv_len]]
|
107
106
|
end
|
108
|
-
|
109
107
|
end
|
110
108
|
end
|
111
109
|
end
|
data/tapyrusrb.gemspec
CHANGED
@@ -4,21 +4,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'tapyrus/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'tapyrus'
|
8
|
+
spec.version = Tapyrus::VERSION
|
9
|
+
spec.authors = ['azuchi']
|
10
|
+
spec.email = ['azuchi@chaintope.com']
|
7
11
|
|
8
|
-
spec.
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
+
spec.summary = 'The implementation of Tapyrus Protocol for Ruby.'
|
13
|
+
spec.description = 'The implementation of Tapyrus Protocol for Ruby.'
|
14
|
+
spec.homepage = 'https://github.com/chaintope/tapyrusrb'
|
15
|
+
spec.license = 'MIT'
|
12
16
|
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
spec.
|
16
|
-
spec.
|
17
|
-
|
18
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
-
spec.bindir = "exe"
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ["lib"]
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
22
21
|
|
23
22
|
spec.add_runtime_dependency 'ecdsa'
|
24
23
|
spec.add_runtime_dependency 'eventmachine'
|
@@ -30,8 +29,6 @@ Gem::Specification.new do |spec|
|
|
30
29
|
spec.add_runtime_dependency 'eventmachine_httpserver'
|
31
30
|
spec.add_runtime_dependency 'iniparse'
|
32
31
|
spec.add_runtime_dependency 'siphash'
|
33
|
-
spec.add_runtime_dependency 'protobuf', '3.8.5'
|
34
|
-
spec.add_runtime_dependency 'scrypt'
|
35
32
|
spec.add_runtime_dependency 'activesupport', '>= 5.2.3'
|
36
33
|
spec.add_runtime_dependency 'json_pure', '>= 2.3.1'
|
37
34
|
|
@@ -39,9 +36,9 @@ Gem::Specification.new do |spec|
|
|
39
36
|
spec.add_development_dependency 'leveldb-native'
|
40
37
|
|
41
38
|
spec.add_development_dependency 'bundler'
|
39
|
+
spec.add_development_dependency 'prettier'
|
42
40
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
43
41
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
44
42
|
spec.add_development_dependency 'timecop'
|
45
43
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
46
|
-
|
47
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapyrus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
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: 2021-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ecdsa
|
@@ -151,63 +151,49 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - '='
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 3.8.5
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - '='
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 3.8.5
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: scrypt
|
154
|
+
name: activesupport
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
170
156
|
requirements:
|
171
157
|
- - ">="
|
172
158
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
159
|
+
version: 5.2.3
|
174
160
|
type: :runtime
|
175
161
|
prerelease: false
|
176
162
|
version_requirements: !ruby/object:Gem::Requirement
|
177
163
|
requirements:
|
178
164
|
- - ">="
|
179
165
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
166
|
+
version: 5.2.3
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
168
|
+
name: json_pure
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
184
170
|
requirements:
|
185
171
|
- - ">="
|
186
172
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
173
|
+
version: 2.3.1
|
188
174
|
type: :runtime
|
189
175
|
prerelease: false
|
190
176
|
version_requirements: !ruby/object:Gem::Requirement
|
191
177
|
requirements:
|
192
178
|
- - ">="
|
193
179
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
180
|
+
version: 2.3.1
|
195
181
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
182
|
+
name: leveldb-native
|
197
183
|
requirement: !ruby/object:Gem::Requirement
|
198
184
|
requirements:
|
199
185
|
- - ">="
|
200
186
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
202
|
-
type: :
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
203
189
|
prerelease: false
|
204
190
|
version_requirements: !ruby/object:Gem::Requirement
|
205
191
|
requirements:
|
206
192
|
- - ">="
|
207
193
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
194
|
+
version: '0'
|
209
195
|
- !ruby/object:Gem::Dependency
|
210
|
-
name:
|
196
|
+
name: bundler
|
211
197
|
requirement: !ruby/object:Gem::Requirement
|
212
198
|
requirements:
|
213
199
|
- - ">="
|
@@ -221,7 +207,7 @@ dependencies:
|
|
221
207
|
- !ruby/object:Gem::Version
|
222
208
|
version: '0'
|
223
209
|
- !ruby/object:Gem::Dependency
|
224
|
-
name:
|
210
|
+
name: prettier
|
225
211
|
requirement: !ruby/object:Gem::Requirement
|
226
212
|
requirements:
|
227
213
|
- - ">="
|
@@ -290,7 +276,7 @@ dependencies:
|
|
290
276
|
- - "~>"
|
291
277
|
- !ruby/object:Gem::Version
|
292
278
|
version: '3.0'
|
293
|
-
description:
|
279
|
+
description: The implementation of Tapyrus Protocol for Ruby.
|
294
280
|
email:
|
295
281
|
- azuchi@chaintope.com
|
296
282
|
executables:
|
@@ -299,11 +285,13 @@ executables:
|
|
299
285
|
extensions: []
|
300
286
|
extra_rdoc_files: []
|
301
287
|
files:
|
288
|
+
- ".github/workflows/ruby.yml"
|
302
289
|
- ".gitignore"
|
290
|
+
- ".prettierignore"
|
291
|
+
- ".prettierrc.yaml"
|
303
292
|
- ".rspec"
|
304
293
|
- ".ruby-gemset"
|
305
294
|
- ".ruby-version"
|
306
|
-
- ".travis.yml"
|
307
295
|
- CODE_OF_CONDUCT.md
|
308
296
|
- Gemfile
|
309
297
|
- LICENSE.txt
|
@@ -418,6 +406,7 @@ files:
|
|
418
406
|
- lib/tapyrus/store/db/level_db.rb
|
419
407
|
- lib/tapyrus/store/spv_chain.rb
|
420
408
|
- lib/tapyrus/tx.rb
|
409
|
+
- lib/tapyrus/tx_builder.rb
|
421
410
|
- lib/tapyrus/tx_in.rb
|
422
411
|
- lib/tapyrus/tx_out.rb
|
423
412
|
- lib/tapyrus/util.rb
|
@@ -452,5 +441,5 @@ requirements: []
|
|
452
441
|
rubygems_version: 3.0.3
|
453
442
|
signing_key:
|
454
443
|
specification_version: 4
|
455
|
-
summary:
|
444
|
+
summary: The implementation of Tapyrus Protocol for Ruby.
|
456
445
|
test_files: []
|