blockchain

package module
v0.0.0-...-c46b3ce Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: GPL-3.0 Imports: 20 Imported by: 0

README

gethitihteg

Geth Idempotence Toolkit

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites
golang
Installing

A step by step series of examples that tell you have to get a development env running

Say what the step will be

#GOPATH must be set or default to ./
git clone https://github.com/Magicking/gethitihteg.git "${GOPATH:-./}"github.com/Magicking/gethitihteg
Using
  • Deploying contract
export PRIVATE_KEY="..."
export RPC_URL="https://ropsten.infura.io"
cd "${GOPATH:-./}"github.com/Magicking/gethitihteg
go run cmd/deployer/deployer.go --rpc-url "${RPC_URL}" --key "${PRIVATE_KEY}" --sol token.sol int:42

License

This project is licensed under the GPLv3 License - see the LICENSE file for details

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unpack

func Unpack(s reflect.Value, unpackProfile reflect.Type) (out []interface{})

Unpack arguments conforming to model

Types

type AgentOperator

type AgentOperator struct {
	Address common.Address

	Transactor *bind.TransactOpts
	// contains filtered or unexported fields
}

func NewAgentOperator

func NewAgentOperator(privateKey *ecdsa.PrivateKey) (*AgentOperator, error)

func (*AgentOperator) Sign

func (ao *AgentOperator) Sign(rawTx *types.Transaction) (*types.Transaction, error)

type BlockchainContext

type BlockchainContext struct {
	NC *NodeConnector
	AO *AgentOperator
}

func NewBlockchainContext

func NewBlockchainContext(raw_url, pkey_hex string, retry int) (*BlockchainContext, error)

type BoundContract

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

BoundContract is the base wrapper object that reflects a contract on the Ethereum network. It contains a collection of methods that are used by the higher level contract bindings to operate.

func CreateContract

func CreateContract(opts *bind.TransactOpts, abi abi.ABI, bytecode []byte, backend bind.ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error)

CreateContract deploys a contract onto the Ethereum blockchain and binds the deployment address with a Go wrapper.

func CreateContractHelper

func CreateContractHelper(client bind.ContractBackend, hexKey, rawABI, contractBin string, cacheNonce *big.Int, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error)

func DeployContract

func DeployContract(opts *bind.TransactOpts, abi abi.ABI, bytecode []byte, backend bind.ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error)

DeployContract deploys a contract onto the Ethereum blockchain and binds the deployment address with a Go wrapper.

func NewBoundContract

func NewBoundContract(address common.Address, abi abi.ABI, caller bind.ContractCaller, transactor bind.ContractTransactor) *BoundContract

NewBoundContract creates a low level contract interface through which calls and transactions may be made through.

func (*BoundContract) Call

func (c *BoundContract) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*BoundContract) Transact

func (c *BoundContract) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*BoundContract) Transfer

func (c *BoundContract) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type ChanMsg

type ChanMsg int
const (
	DeathPill ChanMsg = iota
	Subscribe
)

type ClientConnector

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

ClientConnector defines typed wrappers for the Ethereum RPC API.

func NewClientConnector

func NewClientConnector(rawurl string, try_max int) (*ClientConnector, error)

NewClientConnector creates a client that uses the given RPC client.

func (*ClientConnector) Close

func (ec *ClientConnector) Close()

Close close the RPC connection.

func (*ClientConnector) Dial

func (ec *ClientConnector) Dial() error

Dial connects a client to the given URL.

func (*ClientConnector) HeaderByHash

func (ec *ClientConnector) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

HeaderByHash returns the block header with the given hash.

func (*ClientConnector) TransactionByHashFull

func (ec *ClientConnector) TransactionByHashFull(ctx context.Context, hash common.Hash) (tx *types.Transaction, blockhash *common.Hash, err error)

TransactionByHash returns the transaction with the given hash.

type EventManager

type EventManager interface {
	FireEvent(ctx context.Context, evt *types.Log)
}

type NodeConnector

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

func NewNodeConnector

func NewNodeConnector(rawurl string, try_max int) (*NodeConnector, error)

func (*NodeConnector) CallContract

func (nc *NodeConnector) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*NodeConnector) Close

func (ec *NodeConnector) Close()

Close close the RPC connection.

func (*NodeConnector) CodeAt

func (nc *NodeConnector) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

func (*NodeConnector) EstimateGas

func (nc *NodeConnector) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

func (*NodeConnector) FilterLogs

func (nc *NodeConnector) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

func (*NodeConnector) GetBalanceAt

func (nc *NodeConnector) GetBalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

func (*NodeConnector) GetClient

func (nc *NodeConnector) GetClient(ctx context.Context) (*ethclient.Client, error)

TODO Should return a fresh non-syncing ethereum client

func (*NodeConnector) GetTransaction

func (nc *NodeConnector) GetTransaction(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)

TransactionByHash returns the transaction with the given hash.

func (*NodeConnector) PendingCodeAt

func (nc *NodeConnector) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*NodeConnector) PendingNonceAt

func (nc *NodeConnector) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*NodeConnector) SendTransaction

func (nc *NodeConnector) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*NodeConnector) SubscribeFilterLogs

func (nc *NodeConnector) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*NodeConnector) SubscribeToEvents

func (nc *NodeConnector) SubscribeToEvents(ctx context.Context, addr common.Address, evt_mgr EventManager) chan ChanMsg

func (*NodeConnector) SuggestGasPrice

func (nc *NodeConnector) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*NodeConnector) WaitForFundOrCodeAt

func (nc *NodeConnector) WaitForFundOrCodeAt(account common.Address, blockNumber *big.Int, duration time.Duration) (bool, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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