jsonblock

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOpenTransactionIndexerFiles

func CreateOpenTransactionIndexerFiles(folderName string) transactionindexing.ITransactionIndexer

func HardCodedJsonBlock

func HardCodedJsonBlock(height int64) string

func HardCodedJsonBlockCount

func HardCodedJsonBlockCount() int64

func HashOfString

func HashOfString(in string) indexedhashes.Sha256

func TestGenesisHandle_helper

func TestGenesisHandle_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestInvalidHandle_helper

func TestInvalidHandle_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

func TestJustFiveCoinbaseBlocks_helper

func TestJustFiveCoinbaseBlocks_helper(blockchain chainreadinterface.IBlockChain, t *testing.T)

Types

type AddressHandle

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

func (*AddressHandle) Hash

func (ah *AddressHandle) Hash() indexedhashes.Sha256

Functions in jsonblock.AddressHandle to implement chainreadinterface.IAddressHandle

func (*AddressHandle) HashSpecified

func (ah *AddressHandle) HashSpecified() bool

func (*AddressHandle) Height

func (ah *AddressHandle) Height() int64

func (*AddressHandle) HeightSpecified

func (ah *AddressHandle) HeightSpecified() bool

func (*AddressHandle) NthTxo

func (*AddressHandle) TxoCount

func (ah *AddressHandle) TxoCount() (int64, error)

type BlockHandle

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

func (*BlockHandle) Hash

func (bh *BlockHandle) Hash() (indexedhashes.Sha256, error)

func (*BlockHandle) HashSpecified

func (bh *BlockHandle) HashSpecified() bool

func (*BlockHandle) Height

func (bh *BlockHandle) Height() int64

func (*BlockHandle) HeightSpecified

func (bh *BlockHandle) HeightSpecified() bool

func (*BlockHandle) IsBlockHandle

func (bh *BlockHandle) IsBlockHandle()

func (*BlockHandle) IsInvalid

func (bh *BlockHandle) IsInvalid() bool

type HardCodedBlockFetcher

type HardCodedBlockFetcher struct {
}

func (*HardCodedBlockFetcher) CountBlocks

func (fbf *HardCodedBlockFetcher) CountBlocks() (int64, error)

func (*HardCodedBlockFetcher) FetchBlockJsonBytes

func (fbf *HardCodedBlockFetcher) FetchBlockJsonBytes(height int64) ([]byte, error)

type IBlockJsonFetcher

type IBlockJsonFetcher interface {
	CountBlocks() (int64, error)
	FetchBlockJsonBytes(height int64) ([]byte, error)
}

IBlockJsonFetcher describes an object that serves each block as json bytes

type ITransIndicesPath

type ITransIndicesPath interface {
	BlockHeight() int64
	NthTransInBlock() int64
}

type ITransLocatorByHash

type ITransLocatorByHash interface {
	GetTransIndicesPathByHash(sha256 indexedhashes.Sha256) (ITransIndicesPath, error)
}

ITransLocatorByHash describes an object that obtains a transaction's Indices Path (block/trans) based on hash

type JsonBlockEssential

type JsonBlockEssential struct {
	J_height int                  `json:"height"`
	J_hash   string               `json:"hash"`
	J_tx     []jsonTransEssential `json:"tx"`

	// Non essential integers
	// Changes here should be reflected in postJsonGatherNonEssentialInts()
	J_version      int64   `json:"version"`
	J_time         int64   `json:"time"`
	J_mediantime   int64   `json:"mediantime"`
	J_nonce        int64   `json:"nonce"`
	J_difficulty   float64 `json:"difficulty"`
	J_strippedsize int64   `json:"strippedsize"`
	J_size         int64   `json:"size"`
	J_weight       int64   `json:"weight"`
	// contains filtered or unexported fields
}

func (*JsonBlockEssential) Hash

func (*JsonBlockEssential) HashSpecified

func (b *JsonBlockEssential) HashSpecified() bool

func (*JsonBlockEssential) Height

func (b *JsonBlockEssential) Height() int64

func (*JsonBlockEssential) HeightSpecified

func (b *JsonBlockEssential) HeightSpecified() bool

func (*JsonBlockEssential) IsBlockHandle

func (b *JsonBlockEssential) IsBlockHandle()

func (*JsonBlockEssential) IsInvalid

func (b *JsonBlockEssential) IsInvalid() bool

func (*JsonBlockEssential) NonEssentialInts

func (b *JsonBlockEssential) NonEssentialInts() (*map[string]int64, error)

func (*JsonBlockEssential) NthTransaction

func (*JsonBlockEssential) TransactionCount

func (b *JsonBlockEssential) TransactionCount() (int64, error)

type OneBlockChain

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

OneBlockChain - We call it a one block chain, as one block is in memory at any point in time

func (*OneBlockChain) AddressInterface

func (*OneBlockChain) BlockInterface

func (*OneBlockChain) GenesisBlock

func (obc *OneBlockChain) GenesisBlock() chainreadinterface.IBlockHandle

func (*OneBlockChain) GenesisTransaction

func (obc *OneBlockChain) GenesisTransaction() (chainreadinterface.ITransHandle, error)

func (*OneBlockChain) InvalidBlock

func (obc *OneBlockChain) InvalidBlock() chainreadinterface.IBlockHandle

func (*OneBlockChain) InvalidTrans

func (obc *OneBlockChain) InvalidTrans() chainreadinterface.ITransHandle

func (*OneBlockChain) IsBlockTree

func (obc *OneBlockChain) IsBlockTree() bool

func (*OneBlockChain) LatestBlock

func (obc *OneBlockChain) LatestBlock() (chainreadinterface.IBlockHandle, error)

func (*OneBlockChain) LatestTransaction

func (obc *OneBlockChain) LatestTransaction() (chainreadinterface.ITransHandle, error)

func (*OneBlockChain) NextBlock

func (*OneBlockChain) NextTransaction

func (*OneBlockChain) ParentBlock

func (*OneBlockChain) PreviousTransaction

func (*OneBlockChain) TransInterface

func (*OneBlockChain) TxiInterface

func (*OneBlockChain) TxoInterface

type TransHandle

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

func (*TransHandle) Hash

func (th *TransHandle) Hash() (indexedhashes.Sha256, error)

func (*TransHandle) HashSpecified

func (th *TransHandle) HashSpecified() bool

func (*TransHandle) Height

func (th *TransHandle) Height() int64

func (*TransHandle) HeightSpecified

func (th *TransHandle) HeightSpecified() bool

func (*TransHandle) IndicesPath

func (th *TransHandle) IndicesPath() (int64, int64)

func (*TransHandle) IndicesPathSpecified

func (th *TransHandle) IndicesPathSpecified() bool

func (*TransHandle) IsInvalid

func (th *TransHandle) IsInvalid() bool

func (*TransHandle) IsTransHandle

func (th *TransHandle) IsTransHandle()

type TxiHandle

type TxiHandle struct {
	TxxIndicesPath
}

func (*TxiHandle) IndicesPath

func (th *TxiHandle) IndicesPath() (int64, int64, int64)

func (*TxiHandle) IndicesPathSpecified

func (th *TxiHandle) IndicesPathSpecified() bool

func (*TxiHandle) ParentIndex

func (th *TxiHandle) ParentIndex() int64

func (*TxiHandle) ParentSpecified

func (th *TxiHandle) ParentSpecified() bool

func (*TxiHandle) ParentTrans

func (th *TxiHandle) ParentTrans() chainreadinterface.ITransHandle

func (*TxiHandle) TxiHeight

func (th *TxiHandle) TxiHeight() int64

func (*TxiHandle) TxiHeightSpecified

func (th *TxiHandle) TxiHeightSpecified() bool

type TxoHandle

type TxoHandle struct {
	TxxIndicesPath
}

func (*TxoHandle) IndicesPath

func (th *TxoHandle) IndicesPath() (int64, int64, int64)

func (*TxoHandle) IndicesPathSpecified

func (th *TxoHandle) IndicesPathSpecified() bool

func (*TxoHandle) ParentIndex

func (th *TxoHandle) ParentIndex() int64

func (*TxoHandle) ParentSpecified

func (th *TxoHandle) ParentSpecified() bool

func (*TxoHandle) ParentTrans

func (th *TxoHandle) ParentTrans() chainreadinterface.ITransHandle

func (*TxoHandle) TxoHeight

func (th *TxoHandle) TxoHeight() int64

func (*TxoHandle) TxoHeightSpecified

func (th *TxoHandle) TxoHeightSpecified() bool

type TxxIndicesPath

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

TxxIndicesPath specifies block height, nth transaction within block, and vin/vout index (vindex) It is used for TxiHandle and TxoHandle

Jump to

Keyboard shortcuts

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