ethereum

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package ethereum contains implementation of ethereum chain interface.

Index

Constants

View Source
const (
	BondedECDSAKeepFactoryContractName = "BondedECDSAKeepFactory"
)

Definitions of contract names.

Variables

View Source
var (
	// DefaultMiningCheckInterval is the default interval in which transaction
	// mining status is checked. If the transaction is not mined within this
	// time, the gas price is increased and transaction is resubmitted.
	// This value can be overwritten in the configuration file.
	DefaultMiningCheckInterval = 60 * time.Second

	// DefaultMaxGasPrice specifies the default maximum gas price the client is
	// willing to pay for the transaction to be mined. The offered transaction
	// gas price can not be higher than the max gas price value. If the maximum
	// allowed gas price is reached, no further resubmission attempts are
	// performed. This value can be overwritten in the configuration file.
	DefaultMaxGasPrice = big.NewInt(50000000000) // 50 Gwei
)

Functions

func Connect

func Connect(accountKey *keystore.Key, config *ethereum.Config) (eth.Handle, error)

Connect performs initialization for communication with Ethereum blockchain based on provided config.

Types

type EthereumChain

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

EthereumChain is an implementation of ethereum blockchain interface.

func (*EthereumChain) Address

func (ec *EthereumChain) Address() common.Address

Address returns client's ethereum address.

func (*EthereumChain) BalanceOf

func (ec *EthereumChain) BalanceOf(address common.Address) (*big.Int, error)

BalanceOf returns the stake balance of the specified address.

func (*EthereumChain) BlockCounter

func (ec *EthereumChain) BlockCounter() chain.BlockCounter

BlockCounter returns a block counter.

func (*EthereumChain) GetHonestThreshold

func (ec *EthereumChain) GetHonestThreshold(
	keepAddress common.Address,
) (uint64, error)

GetHonestThreshold returns keep's honest threshold.

func (*EthereumChain) GetKeepAtIndex

func (ec *EthereumChain) GetKeepAtIndex(
	keepIndex *big.Int,
) (common.Address, error)

GetKeepAtIndex returns the address of the keep at the given index.

func (*EthereumChain) GetKeepCount

func (ec *EthereumChain) GetKeepCount() (*big.Int, error)

GetKeepCount returns number of keeps.

func (*EthereumChain) GetMembers

func (ec *EthereumChain) GetMembers(
	keepAddress common.Address,
) ([]common.Address, error)

GetMembers returns keep's members.

func (*EthereumChain) GetPublicKey

func (ec *EthereumChain) GetPublicKey(keepAddress common.Address) ([]uint8, error)

GetPublicKey returns keep's public key. If there is no public key yet, an empty slice is returned.

func (*EthereumChain) HasKeyGenerationTimedOut

func (ec *EthereumChain) HasKeyGenerationTimedOut(
	keepAddress common.Address,
) (bool, error)

HasKeyGenerationTimedOut returns whether key generation has timed out for the given keep.

func (*EthereumChain) HasMinimumStake

func (ec *EthereumChain) HasMinimumStake(address common.Address) (bool, error)

HasMinimumStake returns true if the specified address is staked. False will be returned if not staked. If err != nil then it was not possible to determine if the address is staked or not.

func (*EthereumChain) HasSigningTimedOut

func (ec *EthereumChain) HasSigningTimedOut(keepAddress common.Address) (bool, error)

HasSigningTimedOut checks if signing has timed out for keep.

func (*EthereumChain) IsActive

func (ec *EthereumChain) IsActive(keepAddress common.Address) (bool, error)

IsActive checks for current state of a keep on-chain.

func (*EthereumChain) IsAwaitingSignature

func (ec *EthereumChain) IsAwaitingSignature(keepAddress common.Address, digest [32]byte) (bool, error)

IsAwaitingSignature checks if the keep is waiting for a signature to be calculated for the given digest.

func (*EthereumChain) IsEligibleForApplication

func (ec *EthereumChain) IsEligibleForApplication(application common.Address) (bool, error)

IsEligibleForApplication checks if the operator is eligible to register as a signer candidate for the given application.

func (*EthereumChain) IsOperatorAuthorized

func (ec *EthereumChain) IsOperatorAuthorized(operator common.Address) (bool, error)

func (*EthereumChain) IsRegisteredForApplication

func (ec *EthereumChain) IsRegisteredForApplication(application common.Address) (bool, error)

IsRegisteredForApplication checks if the operator is registered as a signer candidate in the factory for the given application.

func (*EthereumChain) IsStatusUpToDateForApplication

func (ec *EthereumChain) IsStatusUpToDateForApplication(application common.Address) (bool, error)

IsStatusUpToDateForApplication checks if the operator's status is up to date in the signers' pool of the given application.

func (*EthereumChain) LatestDigest

func (ec *EthereumChain) LatestDigest(keepAddress common.Address) ([32]byte, error)

LatestDigest returns the latest digest requested to be signed.

func (*EthereumChain) OnBondedECDSAKeepCreated

func (ec *EthereumChain) OnBondedECDSAKeepCreated(
	handler func(event *eth.BondedECDSAKeepCreatedEvent),
) (subscription.EventSubscription, error)

OnBondedECDSAKeepCreated installs a callback that is invoked when an on-chain notification of a new ECDSA keep creation is seen.

func (*EthereumChain) OnConflictingPublicKeySubmitted

func (ec *EthereumChain) OnConflictingPublicKeySubmitted(
	keepAddress common.Address,
	handler func(event *eth.ConflictingPublicKeySubmittedEvent),
) (subscription.EventSubscription, error)

OnConflictingPublicKeySubmitted installs a callback that is invoked when an on-chain notification of a conflicting public key submission is seen.

func (*EthereumChain) OnKeepClosed

func (ec *EthereumChain) OnKeepClosed(
	keepAddress common.Address,
	handler func(event *eth.KeepClosedEvent),
) (subscription.EventSubscription, error)

OnKeepClosed installs a callback that is invoked on-chain when keep is closed.

func (*EthereumChain) OnKeepTerminated

func (ec *EthereumChain) OnKeepTerminated(
	keepAddress common.Address,
	handler func(event *eth.KeepTerminatedEvent),
) (subscription.EventSubscription, error)

OnKeepTerminated installs a callback that is invoked on-chain when keep is terminated.

func (*EthereumChain) OnPublicKeyPublished

func (ec *EthereumChain) OnPublicKeyPublished(
	keepAddress common.Address,
	handler func(event *eth.PublicKeyPublishedEvent),
) (subscription.EventSubscription, error)

OnPublicKeyPublished installs a callback that is invoked when an on-chain event of a published public key was emitted.

func (*EthereumChain) OnSignatureRequested

func (ec *EthereumChain) OnSignatureRequested(
	keepAddress common.Address,
	handler func(event *eth.SignatureRequestedEvent),
) (subscription.EventSubscription, error)

OnSignatureRequested installs a callback that is invoked on-chain when a keep's signature is requested.

func (*EthereumChain) RegisterAsMemberCandidate

func (ec *EthereumChain) RegisterAsMemberCandidate(application common.Address) error

RegisterAsMemberCandidate registers client as a candidate to be selected to a keep.

func (*EthereumChain) SignatureRequestedBlock

func (ec *EthereumChain) SignatureRequestedBlock(
	keepAddress common.Address,
	digest [32]byte,
) (uint64, error)

SignatureRequestedBlock returns block number from the moment when a signature was requested for the given digest from a keep. If a signature was not requested for the given digest, returns 0.

func (*EthereumChain) StakeMonitor

func (ec *EthereumChain) StakeMonitor() (chain.StakeMonitor, error)

func (*EthereumChain) SubmitKeepPublicKey

func (ec *EthereumChain) SubmitKeepPublicKey(
	keepAddress common.Address,
	publicKey [64]byte,
) error

SubmitKeepPublicKey submits a public key to a keep contract deployed under a given address.

func (*EthereumChain) SubmitSignature

func (ec *EthereumChain) SubmitSignature(
	keepAddress common.Address,
	signature *ecdsa.Signature,
) error

SubmitSignature submits a signature to a keep contract deployed under a given address.

func (*EthereumChain) UpdateStatusForApplication

func (ec *EthereumChain) UpdateStatusForApplication(application common.Address) error

UpdateStatusForApplication updates the operator's status in the signers' pool for the given application.

Jump to

Keyboard shortcuts

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