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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba5af384e71d5a73c26a5912b5f0da009f8c5d83
4
- data.tar.gz: 36fdb1314c82ebff71457cd677737a5753ab6b46
3
+ metadata.gz: 2cb9a4011cc4d1836a9b58041479ffef0eb01dbe
4
+ data.tar.gz: cb6201d16e72ff7b1a98c7e3291f70a8293f6dd6
5
5
  SHA512:
6
- metadata.gz: 092315318b9941dcc880dfafcbd8bbc0b9cd7e4825d395e16df310e89b54a82ebec6512828138301bf3a70b14be161173faf9a61f794283e6207896042afb44c
7
- data.tar.gz: c58dc1d4ad309f9c5136749f7084bf49c1b8142eb7d1f541ffd586808a141a7b12fd248952f8692da06c6b00eb0414408f3e69b189c0b987604d43e8eb92b722
6
+ metadata.gz: b1e4ddc192d0ca5c581950a4d98f5ae98f057e1c8a2d82406043f48a6bfe3c132557bb715a39c153374535fad761178c9400fc151d6a55f021d806ccde885e4a
7
+ data.tar.gz: 65c8782b864522f2fb55f484e70bf60677c9aada26915fd193ddfaf7f70d6a7bab2d94376958be75e9b93cdafa754761e578f702e3276d95f584aa3cc9812c94
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bip44
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
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.9
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-23 00:00:00.000000000 Z
11
+ date: 2018-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler