types

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHash added in v1.1.0

func MakeHash(data any) string

func MakeHashNonce added in v1.2.0

func MakeHashNonce(data any, nonce *uint64) string

Types

type Attribute

type Attribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Block

type Block struct {
	Header       *BlockHeader  `json:"header"`
	Transactions []Transaction `json:"transactions"`
}

func GenesisBlock added in v1.1.0

func GenesisBlock(hash string, height uint64, genesisTime time.Time) *Block

func (*Block) ApproximatedSize added in v1.7.0

func (b *Block) ApproximatedSize() int

ApproximatedSize computes an approximation of how big the block would be once converted into a Protobuf Block model

type BlockHeader added in v1.1.0

type BlockHeader struct {
	Height    uint64    `json:"height"`
	Hash      string    `json:"hash"`
	PrevNum   *uint64   `json:"prev_num"`
	PrevHash  *string   `json:"prev_hash"`
	FinalNum  uint64    `json:"final_num"`
	FinalHash string    `json:"final_hash"`
	Timestamp time.Time `json:"timestamp"`
}

type Event

type Event struct {
	Type       string      `json:"type"`
	Attributes []Attribute `json:"attributes"`
}

type Transaction

type Transaction struct {
	Type     string   `json:"type"`
	Hash     string   `json:"hash"`
	Sender   string   `json:"sender"`
	Receiver string   `json:"receiver"`
	Amount   *big.Int `json:"amount"`
	Fee      *big.Int `json:"fee"`
	Success  bool     `json:"success"`
	Events   []Event  `json:"events"`
}

Jump to

Keyboard shortcuts

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