class Secp256k1::Ethereum::Account

Overview

Implements an Ethereum account containing a Keypair and an address.

Properties:

eth = Secp256k1::Ethereum::Account.new
eth.get_secret
# => "53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97"
eth.address
# => "0x224008a0F3d3cB989c807F568c7f99Bf451328A6"

Defined in:

ethereum.cr

Constructors

Instance Method Summary

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>

[View source]
def self.new #

Generates a new Ethereum::Account from a fresh random Keypair.

eth = Secp256k1::Ethereum::Account.new
# => #<Secp256k1::Ethereum::Account:0x7f81ef21ab80>

[View source]

Instance Method Detail

def address : String #

The public checksummed Ethereum address.


[View source]
def address=(address : String) #

The public checksummed Ethereum address.


[View source]
def get_secret #

Gets the private key as hexadecimal formatted string literal.

eth.get_secret
# => "53d77137b39427a35d8c4b187f532d3912e1e7135985e730633e1e3c1b87ce97"

[View source]
def key_pair : Keypair #

The Keypair containing the secret key.


[View source]
def key_pair=(key_pair : Keypair) #

The Keypair containing the secret key.


[View source]
def to_s #

Gets the account formatted as Ethereum address.

eth.to_s
# => "0x224008a0F3d3cB989c807F568c7f99Bf451328A6"

[View source]