btc

package
v0.0.0-...-42a6357 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrDecode

func AddrDecode(addr string) ([]byte, error)

AddrDecode accepts an encoded address (P2PKH or P2SH, human readable) returns its public key

func AddrEncode

func AddrEncode(txType uint8, pkey []byte) (string, error)

AddrEncode encodes address from pkey

func DecodeBlock

func DecodeBlock(br parser.Reader) (b *models.Block, err error)

DecodeBlock decodes a block

func DecodeTx

func DecodeTx(br parser.Reader) (*models.Tx, error)

DecodeTx decodes a transaction

func GetBlockReward

func GetBlockReward(height uint32) uint64

GetBlockReward returns block reward value from height

func GetFlag

func GetFlag(db *leveldb.DB, name []byte) (bool, error)

GetFlag checks wether txindex is enabled or not

func GetHeight

func GetHeight(target uint64) (h uint32)

GetHeight returns height from circulating supply

func GetTotalSupply

func GetTotalSupply(height uint32) (s uint64)

GetSupply returns total supply from height

func LoadBlock

func LoadBlock() (func(height uint32) (*models.Block, error), error)

func LoadBlockToFile

func LoadBlockToFile(path string, height uint32) error

LoadBlockToFile prints block content in a file

func LoadFile

func LoadFile(fromh, toh uint32, newFn apply, argFn interface{}) error

LoadFile allows to traverse the blocks by height order while applying a function argFn

func LoadHeaderIndex

func LoadHeaderIndex() (lookup map[uint32]*models.BlockHeader, err error)

LoadHeaderIndex constructs a map of the form map[BlockHeight] = BlockHeader. In particular, BlockHeader contains DataPos and FileNum

func OpenIndexDb

func OpenIndexDb() (*leveldb.DB, error)

OpenIndexDb gets transaction index record

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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