3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/bip44/ethereum.rb', line 3
def get_ethereum_address(path)
node = @wallet_node.node_for_path(path)
group = ECDSA::Group::Secp256k1
public_key = ECDSA::Format::PointOctetString.decode(node.public_key.to_bytes, group) ethereum_public = public_key.x.to_s(16) + public_key.y.to_s(16)
bytes = Bip44::Utils.hex_to_bin(ethereum_public)
address_bytes = Digest::SHA3.new(256).digest(bytes)[-20..-1]
address = Bip44::Utils.bin_to_hex(address_bytes)
Bip44::Utils.prefix_hex(address)
end
|