blockchain

package
v1.72.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: AGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// HashLength is the expected length of the hash.
	HashLength = 32
	// AddressLength is the expected length of the address.
	AddressLength = 20
)

Lengths of hashes and addresses in bytes.

Variables

View Source
var Error = errs.Class("blockchain")

Error for the package (mainly parsing errors).

Functions

This section is empty.

Types

type Address

type Address [AddressLength]byte

Address is wallet address.

func BytesToAddress

func BytesToAddress(bytes []byte) (a Address, err error)

BytesToAddress create a new address from raw bytes.

func (Address) Bytes

func (a Address) Bytes() []byte

Bytes gets the byte representation of the underlying address.

func (Address) Hex

func (a Address) Hex() string

Hex gets string representation of the underlying address.

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

MarshalJSON implements json marshalling interface.

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(bytes []byte) error

UnmarshalJSON unmarshal JSON into Address.

type Hash

type Hash [HashLength]byte

Hash represents the 32 byte Keccak256 hash of arbitrary data.

func BytesToHash added in v1.66.1

func BytesToHash(bytes []byte) (h Hash, err error)

BytesToHash create a new hash from raw bytes.

func (Hash) Bytes

func (h Hash) Bytes() []byte

Bytes gets the byte representation of the underlying hash.

func (Hash) Hex

func (h Hash) Hex() string

Hex gets the hex string representation of the underlying hash.

func (Hash) MarshalJSON

func (h Hash) MarshalJSON() ([]byte, error)

MarshalJSON implements json marshalling interface.

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(bytes []byte) error

UnmarshalJSON unmarshal JSON into Hash.

Jump to

Keyboard shortcuts

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