ethereum

package
v0.0.0-...-04e8804 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStillSyncing        = errors.New("Ethereum node is still syncing")
	ErrIncompatibleVersion = errors.New("smart contract has an incompatible version - please upgrade")
	ErrDeprecated          = errors.New("smart contract is marked as deprecated - please check for updates")
	ErrUnexpectedDirectory = errors.New("keystore location appears to be a directory")
	ErrLowBalance          = fmt.Errorf("Please deposit funds into the address listed above. "+
		"A minimum of %s is needed to proceed.", FormatEther(minimumBalance))
)

Functions

func ApplyRate

func ApplyRate(ether *big.Int, rate *big.Rat) *big.Rat

func EnsureKeystoreExists

func EnsureKeystoreExists(path string) error

EnsureKeystoreExists tries to determine whether we already have a keystore. Otherwise it will create a fresh key. The key will be 'encrypted' with an empty password. This provides no protection, but will make the keystore compatible with other Ethereum wallets.

func FormatEther

func FormatEther(ether *big.Int) string

func FormatGwei

func FormatGwei(ether *big.Int) string

Types

type Blockchain

type Blockchain interface {
	CheckSmartContract() error
	CheckBalance() error
	BurnAntiSpamFee(antiSpamID big.Int, antiSpamFee big.Int) error
	CheckAntiSpamConfirmations(antiSpamID big.Int, antiSpamFee big.Int) (int64, error)
	DepositEther(recipient common.Address, adaptorPubKey ed25519.CurvePoint, ether big.Int, antiSpamID big.Int) error
	CheckDepositConfirmations(recipient common.Address, adaptorPubKey ed25519.CurvePoint, ether big.Int, antiSpamID big.Int) (int64, error)
	ClaimDeposit(adaptorPrivKey ed25519.Adaptor, antiSpamID big.Int) error
	LookupAdaptorPrivKey(adaptorPubKey ed25519.CurvePoint) (bool, *ed25519.Adaptor, error)
	ReclaimDeposit(antiSpamID big.Int) error
	RegisterServer(target string, cert []byte) error
	FetchServers(maxAge big.Int) ([]ServerDetails, error)
	WalletAddress() common.Address
	SuggestGasPrice() (*big.Int, error)
}

type GethBlockchain

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

func NewGanacheBlockchain

func NewGanacheBlockchain(contractAddress *common.Address) (*GethBlockchain, error)

func NewLocalNodeBlockchain

func NewLocalNodeBlockchain(endpoint string, keystoreFile string, contractAddress *common.Address,
	maxGasPrice big.Int, boostInterval time.Duration) (*GethBlockchain, error)

func NewSimulatedBlockchain

func NewSimulatedBlockchain() (*GethBlockchain, error)

func (*GethBlockchain) BurnAntiSpamFee

func (c *GethBlockchain) BurnAntiSpamFee(antiSpamID big.Int, antiSpamFee big.Int) error

func (*GethBlockchain) CheckAntiSpamConfirmations

func (c *GethBlockchain) CheckAntiSpamConfirmations(antiSpamID big.Int, antiSpamFee big.Int) (int64, error)

func (*GethBlockchain) CheckBalance

func (c *GethBlockchain) CheckBalance() error

func (*GethBlockchain) CheckDepositConfirmations

func (c *GethBlockchain) CheckDepositConfirmations(
	recipient common.Address, adaptorPubKey ed25519.CurvePoint, ether big.Int, antiSpamID big.Int) (int64, error)

func (*GethBlockchain) CheckSmartContract

func (c *GethBlockchain) CheckSmartContract() error

func (*GethBlockchain) ClaimDeposit

func (c *GethBlockchain) ClaimDeposit(adaptorPrivKey ed25519.Adaptor, antiSpamID big.Int) error

func (*GethBlockchain) DepositEther

func (c *GethBlockchain) DepositEther(
	recipient common.Address, adaptorPubKey ed25519.CurvePoint, ether big.Int, antiSpamID big.Int) error

func (*GethBlockchain) FetchServers

func (c *GethBlockchain) FetchServers(maxAge big.Int) ([]ServerDetails, error)

func (*GethBlockchain) LookupAdaptorPrivKey

func (c *GethBlockchain) LookupAdaptorPrivKey(adaptorPubKey ed25519.CurvePoint) (bool, *ed25519.Adaptor, error)

func (*GethBlockchain) ReclaimDeposit

func (c *GethBlockchain) ReclaimDeposit(antiSpamID big.Int) error

func (*GethBlockchain) RegisterServer

func (c *GethBlockchain) RegisterServer(target string, cert []byte) error

func (*GethBlockchain) SuggestGasPrice

func (c *GethBlockchain) SuggestGasPrice() (*big.Int, error)

func (*GethBlockchain) WalletAddress

func (c *GethBlockchain) WalletAddress() common.Address

type ServerDetails

type ServerDetails struct {
	Target string
	Cert   []byte
}

Jump to

Keyboard shortcuts

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