chain

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCKSTATE_BABY     = 0x00
	BLOCKSTATE_HEALTH   = 0x01
	BLOCKSTATE_DANGER   = 0x02
	BLOCKSTATE_UNHEALTH = 0x03
	BLOCKSTATE_DEAD     = 0x04
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	BN   uint64 `json:"block number"`
	Logs []Log  `json:"logs"`
}

Block ...

func NewBlock

func NewBlock(BN uint64) *Block

func (*Block) AddLog

func (this *Block) AddLog(L *Log) error

func (*Block) Clear

func (this *Block) Clear()

type Chain

type Chain struct {
	I int
	// contains filtered or unexported fields
}

func (*Chain) BN

func (this *Chain) BN() uint64

func (*Chain) Genesis

func (this *Chain) Genesis(path string)

func (*Chain) ReadBlock

func (this *Chain) ReadBlock(BN uint64) *Block

func (*Chain) RunTicker

func (this *Chain) RunTicker(B *Block)

func (*Chain) StopTicker

func (this *Chain) StopTicker()

func (*Chain) WriteBlock

func (this *Chain) WriteBlock(B *Block)

type Config

type Config struct {
	Version uint16   `json:"version"`
	UID     *big.Int `json:"uid"`
	Name    string   `json:"name"`
}

Config ...

type Log

type Log struct {
	Sender    []byte       `json:"sender"`
	SupposeBN []byte       `json:"suppose Block number"`
	Message   []byte       `json:"message"`
	Sig       *C.Signature `json:"signature"`
	Hash      []byte       `json:"hash"`
}

Log ...

func NewLog

func NewLog(Sender []byte, SupposeBN []byte, Message []byte, R []byte, S []byte, H []byte) *Log

NewLog ...

func (*Log) VerifySig

func (L *Log) VerifySig() bool

Jump to

Keyboard shortcuts

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