types

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address [20]byte

Address represents a 20-byte address

func AddressFromString

func AddressFromString(s string) (Address, error)

AddressFromString converts a hex string to Address

func (Address) String

func (a Address) String() string

String returns the hex string representation of the address

type Block

type Block struct {
	Height        uint64
	PreviousHash  Hash
	Timestamp     time.Time
	Transactions  []Transaction
	StateRoot     Hash
	ValidatorSet  []ValidatorAddress
	Signature     []byte
	TxRoot        Hash
	ValidatorRoot Hash
}

Block represents a block in the chain

type Hash

type Hash [32]byte

Hash represents a 32-byte hash

func HashFromString

func HashFromString(s string) (Hash, error)

HashFromString converts a hex string to Hash

func (Hash) String

func (h Hash) String() string

String returns the hex string representation of the hash

type Transaction

type Transaction struct {
	Version             uint32
	SourceChain         string
	DestinationChain    string
	Sender              Address
	Receiver            Address
	Amount              uint64
	Nonce               uint64
	Timestamp           time.Time
	Data                []byte
	Gas                 uint64
	GasPrice            uint64
	Signature           []byte
	ValidatorSignatures map[Address][]byte
	AssetSymbol         string
}

Transaction represents a cross-chain transaction

type ValidatorAddress

type ValidatorAddress [20]byte

ValidatorAddress represents a validator's address

func ValidatorAddressFromString

func ValidatorAddressFromString(s string) (ValidatorAddress, error)

ValidatorAddressFromString converts a hex string to ValidatorAddress

Jump to

Keyboard shortcuts

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