ethereum

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ethereum provides on-chain transaction backend and wallet backend for the ethereum blockchain platform. The actual implementation of the functionality is done in internal package. This implementation can be configured for both real and test uses and shared by this package and the the ethereumtest package.

In addition to the intended functionality, this package is also structured to isolate all the imports from "go-ethereum" project and "go-perun/ethereum/backend" package in go-perun project, as the former is licensed under LGPL and the latter imports (and hence statically links) to code that is licensed under LGPL.

In order to provide this isolation the exported methods in this packages use only those types defined in the root package of this project and in std lib. This restriction enables the other packages in perun-node to compile this package as plugin and load the symbols from it in runtime (using "plugin" library) without importing any package from "go-perun/backend/ethereum" or "go-ethereum" or this package. This enables the possibility to generate a perun-node binary that does not contain any components licensed under LGPL, yet use the functionality from such libraries by dynamically linking to them during runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BalanceAt added in v0.4.0

func BalanceAt(url string, chainConnTimeout, onChainTxTimeout time.Duration, addr pwallet.Address) (
	*big.Int, error)

BalanceAt reads the on-chain balance of the given address.

func NewChainBackend

func NewChainBackend(url string,
	chainID int,
	chainConnTimeout,
	onChainTxTimeout time.Duration,
	cred perun.Credential) (
	perun.ChainBackend, error)

NewChainBackend initializes a connection to blockchain node and sets up a wallet with given credentials for funding on-chain transactions and channel balances.

It uses the provided credentials to initialize a new keystore wallet.

The function signature uses only types defined in the root package of this project and types from std lib. This enables the function to be loaded as symbol without importing this package when it is compiled as plugin.

func NewContractRegistry added in v0.6.0

func NewContractRegistry(chain perun.ROChainBackend, adjudicator, assetETH pwallet.Address) (
	perun.ContractRegistry, error)

NewContractRegistry initializes a contract registry and sets the adjudicator and asset ETH contract addresses.

If it returns an error, it could be one of the following: - InvalidContractError if the contract at given adjudicator or asset ETH address is invalid. - Standard error if the adjudicator address in the asset ETH contract does not match the passed value.

func NewROChainBackend added in v0.6.0

func NewROChainBackend(url string, chainID int, chainConnTimeout time.Duration) (
	perun.ROChainBackend, error)

NewROChainBackend initializes a connection to blockchain node that can be used only for validating contracts.

The function signature uses only types defined in the root package of this project and types from std lib. This enables the function to be loaded as symbol without importing this package when it is compiled as plugin.

func NewWalletBackend

func NewWalletBackend() perun.WalletBackend

NewWalletBackend initializes an ethereum specific wallet backend.

The function signature uses only types defined in the root package of this project and types from std lib. This enables the function to be loaded as symbol without importing this package when it is compiled as plugin.

Types

This section is empty.

Directories

Path Synopsis
Package ethereumtest provides test helpers for using ethereum backend in test.
Package ethereumtest provides test helpers for using ethereum backend in test.
Package internal implements the ethereum related backend functionality.
Package internal implements the ethereum related backend functionality.

Jump to

Keyboard shortcuts

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