tapyrus 0.2.7 → 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 +6 -22
- 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 +10 -0
- data/lib/tapyrus/script/multisig.rb +13 -12
- data/lib/tapyrus/script/script.rb +72 -71
- 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 +14 -15
- 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 +7 -9
- 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 -14
- metadata +21 -4
- data/.travis.yml +0 -14
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'
|
@@ -37,9 +36,9 @@ Gem::Specification.new do |spec|
|
|
37
36
|
spec.add_development_dependency 'leveldb-native'
|
38
37
|
|
39
38
|
spec.add_development_dependency 'bundler'
|
39
|
+
spec.add_development_dependency 'prettier'
|
40
40
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
41
41
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
42
42
|
spec.add_development_dependency 'timecop'
|
43
43
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
44
|
-
|
45
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: 2021-
|
11
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ecdsa
|
@@ -206,6 +206,20 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: prettier
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
209
223
|
- !ruby/object:Gem::Dependency
|
210
224
|
name: rake
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -271,11 +285,13 @@ executables:
|
|
271
285
|
extensions: []
|
272
286
|
extra_rdoc_files: []
|
273
287
|
files:
|
288
|
+
- ".github/workflows/ruby.yml"
|
274
289
|
- ".gitignore"
|
290
|
+
- ".prettierignore"
|
291
|
+
- ".prettierrc.yaml"
|
275
292
|
- ".rspec"
|
276
293
|
- ".ruby-gemset"
|
277
294
|
- ".ruby-version"
|
278
|
-
- ".travis.yml"
|
279
295
|
- CODE_OF_CONDUCT.md
|
280
296
|
- Gemfile
|
281
297
|
- LICENSE.txt
|
@@ -390,6 +406,7 @@ files:
|
|
390
406
|
- lib/tapyrus/store/db/level_db.rb
|
391
407
|
- lib/tapyrus/store/spv_chain.rb
|
392
408
|
- lib/tapyrus/tx.rb
|
409
|
+
- lib/tapyrus/tx_builder.rb
|
393
410
|
- lib/tapyrus/tx_in.rb
|
394
411
|
- lib/tapyrus/tx_out.rb
|
395
412
|
- lib/tapyrus/util.rb
|
@@ -421,7 +438,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
421
438
|
- !ruby/object:Gem::Version
|
422
439
|
version: '0'
|
423
440
|
requirements: []
|
424
|
-
rubygems_version: 3.0.
|
441
|
+
rubygems_version: 3.0.3
|
425
442
|
signing_key:
|
426
443
|
specification_version: 4
|
427
444
|
summary: The implementation of Tapyrus Protocol for Ruby.
|