blockchain

package
v0.0.0-...-6823d0b Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PREFIX = []byte{0, 0, 0, 0}

PREFIX is the leading zeros in hash value as proof of work

Functions

This section is empty.

Types

type Block

type Block struct {
	Index uint64
	Nonce uint64
	Data  []byte
	Prev  []byte // previous block hash
	Hash  []byte // current block hash
	// contains filtered or unexported fields
}

Block contains some amount of data in blockchain

func Genesis

func Genesis() *Block

Genesis gets the genesis block which has byte[1024] data byte[256] prev hash

func (*Block) Next

func (b *Block) Next(data []byte) *Block

Next generates the next block given some data

type Miner

type Miner struct {
	paxi.Node
	// contains filtered or unexported fields
}

Miner is the maintainer of blockchain

func NewMiner

func NewMiner(id paxi.ID) *Miner

NewMiner creates new Miner as paxi node

Jump to

Keyboard shortcuts

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