block

package
v0.0.0-...-37cad83 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Difficulty = 12

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Hash         []byte
	Transactions []*transaction.Transaction
	PrevHash     []byte
	Nonce        int
}

func CreateBlock

func CreateBlock(transactions []*transaction.Transaction, prevHash []byte) *Block

func Deserialize

func Deserialize(data []byte) (*Block, error)

func Genesis

func Genesis(coinbase *transaction.Transaction) *Block

func (*Block) HashString

func (b *Block) HashString() string

func (*Block) Serialize

func (b *Block) Serialize() ([]byte, error)

func (*Block) String

func (b *Block) String() string

type ProofOfWork

type ProofOfWork struct {
	Block  *Block
	Target *big.Int
}

func NewProof

func NewProof(b *Block) *ProofOfWork

func (*ProofOfWork) Run

func (pow *ProofOfWork) Run() (int, []byte)

func (*ProofOfWork) Validate

func (pow *ProofOfWork) Validate() bool

Jump to

Keyboard shortcuts

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