blc

package
v0.2.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewBlockSet)

Functions

func IsValidChain

func IsValidChain(blocks []*Block) bool

Types

type Action

type Action int
const (
	QueryLatestAction Action = iota
	QueryAllAction
	ResponseAction
)

type Block

type Block struct {
	Index        int64  `json:"index"`
	PreviousHash string `json:"previousHash"`
	Timestamp    int64  `json:"timestamp"`
	Data         string `json:"data"`
	Hash         string `json:"hash"`
	Address      string `json:"address"`
}

func (*Block) CalHash

func (b *Block) CalHash() string

func (*Block) String

func (b *Block) String() string

type BlockSet

type BlockSet struct {
	// contains filtered or unexported fields
}

func NewBlockSet

func NewBlockSet(address string) *BlockSet

func (*BlockSet) Add

func (bs *BlockSet) Add(b *Block)

func (*BlockSet) Latest

func (bs *BlockSet) Latest() *Block

func (*BlockSet) LatestMessage

func (bs *BlockSet) LatestMessage() []byte

func (*BlockSet) Len

func (bs *BlockSet) Len() int

func (*BlockSet) List

func (bs *BlockSet) List() []*Block

func (*BlockSet) MarshalJSON

func (bs *BlockSet) MarshalJSON() ([]byte, error)

func (*BlockSet) NextBlock

func (bs *BlockSet) NextBlock(data string) *Block

func (*BlockSet) SetBlocks

func (bs *BlockSet) SetBlocks(blocks []*Block)

type ByIndex

type ByIndex []*Block

func (ByIndex) Len

func (b ByIndex) Len() int

func (ByIndex) Less

func (b ByIndex) Less(i, j int) bool

func (ByIndex) Swap

func (b ByIndex) Swap(i, j int)

type ResponseBlockchain

type ResponseBlockchain struct {
	Type Action `json:"type"`
	Data []byte `json:"data"`
}

Jump to

Keyboard shortcuts

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