eth

package
v0.0.0-...-4404711 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallContract

func CallContract(to common.Address, data []byte) ([]byte, error)

func Get4BytesFunctionSignature

func Get4BytesFunctionSignature(sig string) []byte

Get4BytesFunctionSignature return 4 bytes of function signature hash

func GetActiveProviders

func GetActiveProviders(dataset common.Address) ([]common.Address, error)

GetActiveProviders returns the set of currently active data provider addresses of the given dataset address.

func GetAddress

func GetAddress() (common.Address, error)

GetAddress returns the address of the

func GetMappingLocation

func GetMappingLocation(slot int, key common.Address) common.Hash

GetMappingLocation find hash of key in mapping

func GetNonce

func GetNonce() (uint64, error)

func GetStorageAt

func GetStorageAt(contract common.Address, location common.Hash) (common.Hash, error)

GetStorageAt returns the value at the given storage location of the given Ethereum contract address.

func IsActiveProvider

func IsActiveProvider(dataset, provider common.Address) (bool, error)

IsActiveProvider checks if the given data provider address is active in the given dataset address. Returns true if that the case, and false otherwise.

func IsValidDataset

func IsValidDataset(dataset common.Address) bool

IsValidDataset returns true if the given dataset address is valid, and false otherwise

func SendTransaction

func SendTransaction(to common.Address, data []byte) (common.Hash, error)

SendTransaction broadcasts the given message to the Ethereum network. This function also handles transaction signing.

func SetPrivateKey

func SetPrivateKey(newPrivateKey string) error

SetPrivateKey transform private key string to ECDSA Key

func SetRpcClient

func SetRpcClient(rpcUrl string) error

SetRpcClient receive url of ethereum node to initiate rpcClient

func VerifyMessage

func VerifyMessage(message []byte, sig Signature, signer common.Address) bool

VerifyMessage checks if the signature is consistent with the message.

Types

type Signature

type Signature struct {
	V uint8       `json:"v"`
	R common.Hash `json:"r"`
	S common.Hash `json:"s"`
}

func SignMessage

func SignMessage(message []byte) (Signature, error)

SignMessage returns the signature of signing the given message using Ethereum's message signing scheme.

func (Signature) String

func (sig Signature) String() string

Jump to

Keyboard shortcuts

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