Documentation
¶
Overview ¶
Basically adapation from the file at https://github.com/tsileo/blkparser
Copy/paste from the file at https://github.com/tsileo/blkparser
Basically adapation from the file at https://github.com/tsileo/blkparser
Package blkparser basically is an adaptation from a file at https://github.com/tsileo/blkparser
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeVariableLengthInteger ¶
Get the Tx count, decode the variable length integer https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer
func GetShaString ¶
func HashString ¶
Types ¶
type Block ¶
type Block struct { Raw []byte `json:"-"` Hash string `json:"hash"` Height uint `json:"height"` Txs []*Tx `json:"tx,omitempty"` Version uint32 `json:"ver"` MerkleRoot string `json:"mrkl_root"` BlockTime uint32 `json:"time"` Bits uint32 `json:"bits"` Nonce uint32 `json:"nonce"` Size uint32 `json:"size"` TxCnt uint32 `json:"n_tx"` TotalBTC uint64 `json:"total_out"` BlockReward float64 `json:"-"` Parent string `json:"prev_block"` Next string `json:"next_block"` }
type Blockchain ¶
Blockchain is a struct representing a block chain
func NewBlockchain ¶
func NewBlockchain(path string, magic [4]byte) (blockchain *Blockchain, err error)
NewBlockchain returns a freshly generated blockchain path is the name of the file where the blockchain starts
func (*Blockchain) FetchNextBlock ¶
func (blockchain *Blockchain) FetchNextBlock() (rawblock []byte, err error)
FetchNextBlock reads the next block?
func (*Blockchain) NextBlock ¶
func (blockchain *Blockchain) NextBlock() (block *Block, err error)
NextBlock() returns the next block in the chain