bip44 0.2.14 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +4 -0
- data/bip44.gemspec +1 -0
- data/lib/bip44.rb +9 -1
- data/lib/bip44/bitcoin.rb +6 -1
- data/lib/bip44/ethereum.rb +5 -0
- data/lib/bip44/version.rb +1 -1
- data/lib/bip44/wallet.rb +6 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f28cae3a0a831f0f9a93a548dd7ab78a0174a87
|
4
|
+
data.tar.gz: a166c537d9484506fd7eebe66948f3f4212742e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c415efbdeae48477f77d5aeb040362e05cf3cde48de7f8ed4d1ebefe31382852ffe81b9a82a70cadfa7210e70cd0fdc3bb563156a96857cfc4433650ed867e0
|
7
|
+
data.tar.gz: f987ae433ee8c0ed06a78c402b3da87241192f562f154e01476b869e9e0a04d4a169271ee9b805bb2364ef48637a4608a467c822084598ac731639d3120390b2
|
data/.DS_Store
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/bip44.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.15"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "minitest", "~> 5.0"
|
27
|
+
spec.add_development_dependency "execjs", "~> 2.4.0"
|
27
28
|
|
28
29
|
spec.add_dependency "money-tree"
|
29
30
|
spec.add_dependency "ecdsa", "~> 1.2.0"
|
data/lib/bip44.rb
CHANGED
@@ -15,22 +15,30 @@ module Bip44
|
|
15
15
|
words = BipMnemonic.to_mnemonic(bits: 128)
|
16
16
|
puts words
|
17
17
|
seed = BipMnemonic.to_seed(mnemonic: words)
|
18
|
+
puts "seed: #{seed}"
|
18
19
|
ethereum_wallet = Bip44::Wallet.from_seed(seed, "m/44'/60'/0'/0")
|
19
20
|
puts 'ethereum xprv: ' + ethereum_wallet.xprv
|
20
21
|
puts 'ethereum xpub: ' + ethereum_wallet.xpub
|
21
22
|
bitcoin_wallet = Bip44::Wallet.from_seed(seed, "m/44'/0'/0'/0")
|
22
23
|
puts 'bitcoin xprv: ' + bitcoin_wallet.xprv
|
23
24
|
puts 'bitcoin xpub: ' + bitcoin_wallet.xpub
|
25
|
+
dash_wallet = Bip44::Wallet.from_seed(seed, "m/44'/5'/0'/0")
|
26
|
+
puts 'dash xprv: ' + dash_wallet.xprv
|
27
|
+
puts 'dash xpub: ' + dash_wallet.xpub
|
24
28
|
end
|
25
29
|
|
26
30
|
def self.from_mnemonic(words)
|
27
31
|
seed = BipMnemonic.to_seed(mnemonic: words)
|
32
|
+
puts "seed: #{seed}"
|
28
33
|
ethereum_wallet = Bip44::Wallet.from_seed(seed, "m/44'/60'/0'/0")
|
29
34
|
puts 'ethereum xprv: ' + ethereum_wallet.xprv
|
30
35
|
puts 'ethereum xpub: ' + ethereum_wallet.xpub
|
31
36
|
bitcoin_wallet = Bip44::Wallet.from_seed(seed, "m/44'/0'/0'/0")
|
32
37
|
puts 'bitcoin xprv: ' + bitcoin_wallet.xprv
|
33
38
|
puts 'bitcoin xpub: ' + bitcoin_wallet.xpub
|
39
|
+
dash_wallet = Bip44::Wallet.from_seed(seed, "m/44'/5'/0'/0")
|
40
|
+
puts 'dash xprv: ' + dash_wallet.xprv
|
41
|
+
puts 'dash xpub: ' + dash_wallet.xpub
|
34
42
|
end
|
35
|
-
|
36
43
|
end
|
44
|
+
|
data/lib/bip44/bitcoin.rb
CHANGED
@@ -5,8 +5,13 @@ module Bip44
|
|
5
5
|
node.to_address
|
6
6
|
end
|
7
7
|
|
8
|
+
def get_bitcoin_address(index)
|
9
|
+
sub_wallet = sub_wallet()
|
10
|
+
sub_wallet.bitcoin_address
|
11
|
+
end
|
12
|
+
|
8
13
|
def bitcoin_address
|
9
|
-
@wallet_node.public_key.
|
14
|
+
@wallet_node.public_key.to_address
|
10
15
|
end
|
11
16
|
end
|
12
17
|
end
|
data/lib/bip44/ethereum.rb
CHANGED
@@ -5,6 +5,11 @@ module Bip44
|
|
5
5
|
sub_wallet.ethereum_address
|
6
6
|
end
|
7
7
|
|
8
|
+
def get_child_ethereum_address(index)
|
9
|
+
sub_wallet = sub_wallet()
|
10
|
+
sub_wallet.ethereum_address
|
11
|
+
end
|
12
|
+
|
8
13
|
def ethereum_address
|
9
14
|
# from bitcoin public key to ethereum public key
|
10
15
|
group = ECDSA::Group::Secp256k1
|
data/lib/bip44/version.rb
CHANGED
data/lib/bip44/wallet.rb
CHANGED
@@ -42,10 +42,15 @@ module Bip44
|
|
42
42
|
@wallet_node.to_bip32(:private)
|
43
43
|
end
|
44
44
|
|
45
|
-
def private_key
|
45
|
+
def private_key(wif: true)
|
46
|
+
return @wallet_node.private_key.to_wif if wif == true
|
46
47
|
@wallet_node.private_key.to_hex
|
47
48
|
end
|
48
49
|
|
50
|
+
def public_key
|
51
|
+
@wallet_node.public_key.uncompressed.to_hex
|
52
|
+
end
|
53
|
+
|
49
54
|
private
|
50
55
|
|
51
56
|
def initialize(wallet_node)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bip44
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wuminzhe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: execjs
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.4.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: money-tree
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|