ethereum

package
v0.0.0-...-cda9367 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const PrivateKeyLength = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type Keypair

type Keypair struct {
	// contains filtered or unexported fields
}

func GenerateKeypair

func GenerateKeypair() (*Keypair, error)

func NewKeypair

func NewKeypair(pk ecdsa.PrivateKey) *Keypair

func NewKeypairFromPrivateKey

func NewKeypairFromPrivateKey(priv []byte) (*Keypair, error)

func NewKeypairFromString

func NewKeypairFromString(priv string) (*Keypair, error)

NewKeypairFromPrivateKey parses a string for a hex private key. Must be at least PrivateKeyLength long.

func (*Keypair) Address

func (kp *Keypair) Address() string

Address returns the Ethereum address format

func (*Keypair) CommonAddress

func (kp *Keypair) CommonAddress() common.Address

CommonAddress returns the Ethereum address in the common.Address Format

func (*Keypair) Decode

func (kp *Keypair) Decode(in []byte) error

Decode initializes the keypair using the input

func (*Keypair) Encode

func (kp *Keypair) Encode() []byte

Encode dumps the private key as bytes

func (*Keypair) PrivateKey

func (kp *Keypair) PrivateKey() *ecdsa.PrivateKey

PrivateKey returns the keypair's private key

func (*Keypair) PublicKey

func (kp *Keypair) PublicKey() string

PublicKey returns the public key hex encoded

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL