eth

package
v0.11.0-rc Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package eth contains interface for interaction with an ethereum blockchain along with structures reflecting events emitted on an ethereum blockchain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SerializePublicKey

func SerializePublicKey(publicKey *ecdsa.PublicKey) ([64]byte, error)

SerializePublicKey takes X and Y coordinates of a signer's public key and concatenates it to a 64-byte long array. If any of coordinates is shorter than 32-byte it is preceded with zeros.

Types

type BondedECDSAKeep

type BondedECDSAKeep interface {
	// OnSignatureRequested installs a callback that is invoked when an on-chain
	// notification of a new signing request for a given keep is seen.
	OnSignatureRequested(
		keepAddress common.Address,
		handler func(event *SignatureRequestedEvent),
	) (subscription.EventSubscription, error)

	// OnConflictingPublicKeySubmitted installs a callback that is invoked upon
	// notification of mismatched public keys that were submitted by keep members.
	OnConflictingPublicKeySubmitted(
		keepAddress common.Address,
		handler func(event *ConflictingPublicKeySubmittedEvent),
	) (subscription.EventSubscription, error)

	// OnPublicKeyPublished installs a callback that is invoked upon
	// notification of a published public key, which means that all members have
	// submitted the same key.
	OnPublicKeyPublished(
		keepAddress common.Address,
		handler func(event *PublicKeyPublishedEvent),
	) (subscription.EventSubscription, error)

	// SubmitKeepPublicKey submits a 64-byte serialized public key to a keep
	// contract deployed under a given address.
	SubmitKeepPublicKey(keepAddress common.Address, publicKey [64]byte) error // TODO: Add promise *async.KeepPublicKeySubmissionPromise

	// SubmitSignature submits a signature to a keep contract deployed under a
	// given address.
	SubmitSignature(
		keepAddress common.Address,
		signature *ecdsa.Signature,
	) error // TODO: Add promise *async.SignatureSubmissionPromise

	// OnKeepClosed installs a callback that will be called on closing the
	// given keep.
	OnKeepClosed(
		keepAddress common.Address,
		handler func(event *KeepClosedEvent),
	) (subscription.EventSubscription, error)

	// OnKeepTerminated installs a callback that will be called on terminating
	// the given keep.
	OnKeepTerminated(
		keepAddress common.Address,
		handler func(event *KeepTerminatedEvent),
	) (subscription.EventSubscription, error)

	// IsAwaitingSignature checks if the keep is waiting for a signature to be
	// calculated for the given digest.
	IsAwaitingSignature(keepAddress common.Address, digest [32]byte) (bool, error)

	// IsActive checks if the keep with the given address is active and responds
	// to signing request. This function returns false only for closed keeps.
	IsActive(keepAddress common.Address) (bool, error)

	// LatestDigest returns the latest digest requested to be signed.
	LatestDigest(keepAddress common.Address) ([32]byte, error)
}

BondedECDSAKeep is an interface that provides ability to interact with BondedECDSAKeep ethereum contracts.

type BondedECDSAKeepCreatedEvent

type BondedECDSAKeepCreatedEvent struct {
	KeepAddress common.Address   // keep contract address
	Members     []common.Address // keep members addresses
}

BondedECDSAKeepCreatedEvent is an event emitted on a new keep creation.

func (*BondedECDSAKeepCreatedEvent) IsMember

func (e *BondedECDSAKeepCreatedEvent) IsMember(address common.Address) bool

IsMember checks if list of members contains the given address.

type BondedECDSAKeepFactory

type BondedECDSAKeepFactory interface {
	// RegisterAsMemberCandidate registers client as a candidate to be selected
	// to a keep.
	RegisterAsMemberCandidate(application common.Address) error

	// OnBondedECDSAKeepCreated installs a callback that is invoked when an
	// on-chain notification of a new bonded ECDSA keep creation is seen.
	OnBondedECDSAKeepCreated(
		handler func(event *BondedECDSAKeepCreatedEvent),
	) (subscription.EventSubscription, error)

	// IsRegisteredForApplication checks if the operator is registered
	// as a signer candidate in the factory for the given application.
	IsRegisteredForApplication(application common.Address) (bool, error)

	// IsEligibleForApplication checks if the operator is eligible to register
	// as a signer candidate for the given application.
	IsEligibleForApplication(application common.Address) (bool, error)

	// IsStatusUpToDateForApplication checks if the operator's status
	// is up to date in the signers' pool of the given application.
	IsStatusUpToDateForApplication(application common.Address) (bool, error)

	// UpdateStatusForApplication updates the operator's status in the signers'
	// pool for the given application.
	UpdateStatusForApplication(application common.Address) error
}

BondedECDSAKeepFactory is an interface that provides ability to interact with BondedECDSAKeepFactory ethereum contracts.

type ConflictingPublicKeySubmittedEvent

type ConflictingPublicKeySubmittedEvent struct {
	SubmittingMember     common.Address
	ConflictingPublicKey []byte
}

ConflictingPublicKeySubmittedEvent is an event emitted each time when one of the members of a keep has submitted a key that does not match the keys submitted so far by other members.

type Handle

type Handle interface {
	// Address returns client's ethereum address.
	Address() common.Address
	// StakeMonitor returns a stake monitor.
	StakeMonitor() (chain.StakeMonitor, error)
	// BlockCounter returns a block counter.
	BlockCounter() chain.BlockCounter

	BondedECDSAKeepFactory
	BondedECDSAKeep
}

Handle represents a handle to an ethereum blockchain.

type KeepClosedEvent

type KeepClosedEvent struct {
}

KeepClosedEvent is an event emitted when a keep has been closed.

type KeepTerminatedEvent

type KeepTerminatedEvent struct {
}

KeepTerminatedEvent is an event emitted when a keep has been terminated.

type PublicKeyPublishedEvent

type PublicKeyPublishedEvent struct {
	PublicKey []byte
}

PublicKeyPublishedEvent is an event emitted once all the members have submitted the same public key and it was accepted by keep as its public key.

type SignatureRequestedEvent

type SignatureRequestedEvent struct {
	Digest [32]byte
}

SignatureRequestedEvent is an event emitted when a user requests a digest to be signed.

Directories

Path Synopsis
Package ethereum contains implementation of ethereum chain interface.
Package ethereum contains implementation of ethereum chain interface.
gen
cmd

Jump to

Keyboard shortcuts

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