bip44 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bip44/ethereum.rb +15 -0
- data/lib/bip44/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cb9a4011cc4d1836a9b58041479ffef0eb01dbe
|
4
|
+
data.tar.gz: cb6201d16e72ff7b1a98c7e3291f70a8293f6dd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1e4ddc192d0ca5c581950a4d98f5ae98f057e1c8a2d82406043f48a6bfe3c132557bb715a39c153374535fad761178c9400fc151d6a55f021d806ccde885e4a
|
7
|
+
data.tar.gz: 65c8782b864522f2fb55f484e70bf60677c9aada26915fd193ddfaf7f70d6a7bab2d94376958be75e9b93cdafa754761e578f702e3276d95f584aa3cc9812c94
|
data/lib/bip44/ethereum.rb
CHANGED
@@ -14,5 +14,20 @@ module Bip44
|
|
14
14
|
address = Bip44::Utils.bin_to_hex(address_bytes)
|
15
15
|
Bip44::Utils.prefix_hex(address)
|
16
16
|
end
|
17
|
+
|
18
|
+
def ethereum_address
|
19
|
+
node = @wallet_node
|
20
|
+
|
21
|
+
# from bitcoin public key to ethereum public key
|
22
|
+
group = ECDSA::Group::Secp256k1
|
23
|
+
public_key = ECDSA::Format::PointOctetString.decode(node.public_key.to_bytes, group) # a point
|
24
|
+
ethereum_public = public_key.x.to_s(16) + public_key.y.to_s(16)
|
25
|
+
|
26
|
+
# from ethereum public key to ethereum address
|
27
|
+
bytes = Bip44::Utils.hex_to_bin(ethereum_public)
|
28
|
+
address_bytes = Digest::SHA3.new(256).digest(bytes)[-20..-1]
|
29
|
+
address = Bip44::Utils.bin_to_hex(address_bytes)
|
30
|
+
Bip44::Utils.prefix_hex(address)
|
31
|
+
end
|
17
32
|
end
|
18
33
|
end
|
data/lib/bip44/version.rb
CHANGED
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wuminzhe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|