blockchain

package
v0.0.0-...-6b2095d Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OrphanBlocks = make([]*Block, 0)

Functions

func GetNBlockHashesAfter

func GetNBlockHashesAfter(start [32]byte, n int) ([][32]byte, error)

func NewBlock

func NewBlock(block *Block)

func Start

func Start()

Types

type Block

type Block struct {
	Height       int
	Version      int
	Hash         [32]byte
	PrevHash     [32]byte
	MerkleRoot   [32]byte
	Time         int
	Bits         int
	Nonce        int
	Transactions []*Transaction
}
var FirstHeader *Block
var LastBlock *Block

func GetBlockAfter

func GetBlockAfter(hash [32]byte) (*Block, error)

func (*Block) GetHash

func (b *Block) GetHash() [32]byte

type Transaction

type Transaction struct {
	Version   int
	Flag      [2]uint8
	Inputs    []*TxIn
	Outputs   []*TxOut
	Witnesses [][]byte
	LockTime  int
}

type TxIn

type TxIn struct {
	PrevTxHash  [32]byte
	PrevTxIndex int
	Script      []byte
	Sequence    [4]byte
}

type TxOut

type TxOut struct {
	Value  int
	Script []byte
}

Jump to

Keyboard shortcuts

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