class Secp256k1::Ethereum::Account
- Secp256k1::Ethereum::Account
- Reference
- Object
Overview
Implements an Ethereum
account containing a Keypair
and an address.
Properties:
#key_pair
(Keypair
): theKeypair
containing the secret key.#address
(String
): the public checksummedEthereum
address.
eth = Secp256k1::Ethereum::Account.new
eth.get_secret
# => "53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97"
eth.address
# => "0x224008a0F3d3cB989c807F568c7f99Bf451328A6"
Defined in:
ethereum.crConstructors
-
.new(key_pair : Secp256k1::Keypair)
Generates an
Ethereum::Account
from a providedKeypair
. -
.new
Generates a new
Ethereum::Account
from a fresh randomKeypair
.
Instance Method Summary
-
#address : String
The public checksummed
Ethereum
address. -
#address=(address : String)
The public checksummed
Ethereum
address. -
#get_secret
Gets the private key as hexadecimal formatted string literal.
-
#key_pair : Keypair
The
Keypair
containing the secret key. -
#key_pair=(key_pair : Keypair)
The
Keypair
containing the secret key. -
#to_s
Gets the account formatted as
Ethereum
address.
Constructor Detail
def self.new(key_pair : Secp256k1::Keypair)
#
Generates an Ethereum::Account
from a provided Keypair
.
key = Secp256k1::Keypair.new BigInt.new("53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97", 16)
eth = Secp256k1::Ethereum::Account.new key
# => #<Secp256k1::Ethereum::Account:0x7f81ef21ab80>
def self.new
#
Generates a new Ethereum::Account
from a fresh random Keypair
.
eth = Secp256k1::Ethereum::Account.new
# => #<Secp256k1::Ethereum::Account:0x7f81ef21ab80>
Instance Method Detail
def get_secret
#
Gets the private key as hexadecimal formatted string literal.
eth.get_secret
# => "53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97"