block

package
v0.0.0-...-31eb2eb Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Timestamp     int64
	Transactions  []*transaction.Transaction
	Hash          []byte
	PrevBlockHash []byte
	Nounce        int
}

func NewBlock

func NewBlock(tx []*transaction.Transaction, prevBlockHash []byte) *Block

func NewGenesisBlock

func NewGenesisBlock(coinbase *transaction.Transaction) *Block

func (*Block) HashTransactions

func (b *Block) HashTransactions() []byte

func (*Block) SetHash

func (b *Block) SetHash()

type ProofOfWork

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

func NewProofOfWork

func NewProofOfWork(b *Block) *ProofOfWork

func (*ProofOfWork) Run

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

* Run: Mining new Blocks.

  • What is mining?
  • It's the process of finding a hash that meets certain criteria, in this
  • case the criteria is that the hash should be smaller than target. *

Jump to

Keyboard shortcuts

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