Documentation
¶
Index ¶
- Constants
- func CopyBytes(b []byte) (copiedBytes []byte)
- func HashAlg() hash.Hash
- func HashBytes(a types.Hash) []byte
- func HeaderHash(block *types.Block) (hash types.Hash)
- func NewTransaction(nonce uint64, to *Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, ...) *types.Transaction
- func TxHash(tx *types.Transaction) (hash types.Hash)
- func TypeConvert(a *Address) *types.Address
- type Address
- func (a Address) Big() *big.Int
- func (a Address) Bytes() []byte
- func (a Address) Format(s fmt.State, c rune)
- func (a Address) Hash() cmn.Hash
- func (a Address) Hex() string
- func (a Address) MarshalJSON() ([]byte, error)
- func (a *Address) SetBytes(b []byte)
- func (a Address) String() string
- func (a *Address) UnmarshalJSON(input []byte) error
- type BlockNumber
Constants ¶
const ( PendingBlockNumber = BlockNumber(-2) LatestBlockNumber = BlockNumber(-1) EarliestBlockNumber = BlockNumber(0) )
const (
AddressLength = 20
)
Lengths of hashes and addresses in bytes.
const (
DefaultGasPrice = 1
)
Variables ¶
This section is empty.
Functions ¶
func HeaderHash ¶ added in v1.0.0
HeaderHash calculate block's hash
func NewTransaction ¶
func TypeConvert ¶
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the 20 byte address of an Ethereum account.
func BigToAddress ¶
BigToAddress returns Address with byte values of b. If b is larger than len(h), b will be cropped from the left.
func BytesToAddress ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func HexToAddress ¶
HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.
func (Address) Format ¶
Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.
func (Address) MarshalJSON ¶
MarshalText returns the hex representation of a.
func (*Address) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.
func (*Address) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
type BlockNumber ¶
type BlockNumber int64
func (BlockNumber) Int64 ¶
func (bn BlockNumber) Int64() int64
func (BlockNumber) Touint64 ¶
func (bn BlockNumber) Touint64() uint64
func (*BlockNumber) UnmarshalJSON ¶
func (bn *BlockNumber) UnmarshalJSON(data []byte) error
UnmarshalJSON parses the given JSON fragment into a BlockNumber. It supports: - "latest", "earliest" or "pending" as string arguments - the block number Returned errors: - an invalid block number error when the given argument isn't a known strings - an out of range error when the given block number is either too little or too large