module Secp256k1::Ethereum
Overview
Implements the Ethereum
address space for the Secp256k1
library.
Defined in:
ethereum.crClass Method Summary
-
.address_checksum(adr : String)
Returns a checksummed
Ethereum
address as per EIP-55. -
.address_from_private(priv : BigInt)
Generates a checksummed
Ethereum
address from a private key. -
.address_from_public_key(pub : String)
Generates a checksummed
Ethereum
address for an uncompressed public key. - .address_from_public_point(p : Secp256k1::ECPoint)
Class Method Detail
Returns a checksummed Ethereum
address as per EIP-55.
Reference: eips.ethereum.org/EIPS/eip-55
Parameters:
adr
(String
): an uncheckedEthereum
address.
Secp256k1::Ethereum.address_checksum "0x7598c0fbaeb021161ce2e598f45ddee90fe5c6f7"
# => "0x7598c0FBAEB021161ce2E598F45dDEe90FE5C6f7"
Raises if address is malformed.
Generates a checksummed Ethereum
address from a private key.
Parameters:
priv
(BigInt
): a private key as number.
Secp256k1::Ethereum.address_from_private BigInt.new("b795cd2c5ce0cc632ca1f65e921b9c751b363e97fcaeec81c02a85b763448268", 16)
# => "0x7598c0FBAEB021161ce2E598F45dDEe90FE5C6f7"
Note, that the returned Ethereum
address is already checksummed.
Generates a checksummed Ethereum
address for an uncompressed public key.
Parameters:
pub
(String
): an uncompressed public key string.
Secp256k1::Ethereum.address_from_public_key "d885aed4bcaf3a8c95a57e3be08caa1bd6a060a68b9795c03129073597fcb19a67299d1cf25955e9b6425583cbc33f4ab831f5a31ef88c7167e9eb714cc758a5"
# => "0x7598c0FBAEB021161ce2E598F45dDEe90FE5C6f7"
Note, that the returned Ethereum
address is already checksummed.
Raises if the public key is malformed.
Generates a checksummed Ethereum
address from an public key as ECPoint
.
Parameters:
p
(ECPoint
): a public key point withx
andy
coordinates.
See .address_from_public_key
and ECPoint
for usage instructions.