block

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package block defines the interface required for all blockchain or network connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func End

func End(bc map[string]Chain)

End closes gracefully all the blockchain clients opened.

func Init

func Init(bc []config.BlockConfig) (m map[string]Chain, err error)

Init loads all the clients read from the config to blockchains into a map.

Types

type Chain

type Chain interface {
	// member-type methods
	MaxBlocks() int // number of blocks that are controlled for orphans (uncles)
	AvgBlock() int  // average block mining rate in seconds
	// methods
	Close()
	Balance(account, token string) (bal, tokBal *big.Int, err error)
	GetBlock(block uint64, full bool, response interface{}) error
	DecodeBlock(b interface{}) (types.Block, error)
	DecodeTxs(t interface{}) ([]types.Trans, error)
	GetToken(token string) (types.Token, error)
	Send(fromAddress, toAddress, token, amount string, data []byte, key string, priceIn uint64,
		dryRun bool) (fee *big.Int, hash []byte, err error)
	Get(hash string) (t *types.Trans, err error)
}

Chain is an interface that contains the required methods. It has been designed to be as much standard as possible, however, there may be specific blockchains or networks that would require different types or more methods.

Directories

Path Synopsis
Package ethereum implements interface for ethereum networks.
Package ethereum implements interface for ethereum networks.
Package types common blockchain types.
Package types common blockchain types.

Jump to

Keyboard shortcuts

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