Documentation
¶
Index ¶
- func BitcoinDir() string
- func ParseBlockHeaderFromFile(blockFile *BlockFile, block *Block) error
- func ParseBlockTransactionsFromFile(blockFile *BlockFile, block *Block) error
- func ReverseHex(b []byte) []byte
- func Varint(n uint64) []byte
- type Block
- type BlockFile
- func (blockFile *BlockFile) Close()
- func (blockFile *BlockFile) Peek(length int) ([]byte, error)
- func (blockFile *BlockFile) ReadByte() byte
- func (blockFile *BlockFile) ReadBytes(length uint64) []byte
- func (blockFile *BlockFile) ReadInt32() int32
- func (blockFile *BlockFile) ReadInt64() int64
- func (blockFile *BlockFile) ReadUint16() uint16
- func (blockFile *BlockFile) ReadUint32() uint32
- func (blockFile *BlockFile) ReadUint64() uint64
- func (blockFile *BlockFile) ReadVarint() uint64
- func (blockFile *BlockFile) Seek(offset int64, whence int) (int64, error)
- func (blockFile *BlockFile) Size() (int64, error)
- type BlockHeader
- type Hash256
- type MagicId
- type Script
- type Transaction
- type TxInput
- type TxOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitcoinDir ¶
func BitcoinDir() string
func ParseBlockHeaderFromFile ¶
Parse the header fields except the MagicId TODO: Currently won't return any error
Types ¶
type Block ¶
type Block struct {
BlockHeader // actual pos below Length field
MagicId MagicId
Length uint32
TransactionCount uint64 // txn_count
Transactions []Transaction
StartPos uint64 // not actually in blockchain data
}
func NewBlockFromFile ¶
type BlockFile ¶
type BlockFile struct {
FileNum uint32
// contains filtered or unexported fields
}
func (*BlockFile) ReadUint16 ¶
func (*BlockFile) ReadUint32 ¶
func (*BlockFile) ReadUint64 ¶
func (*BlockFile) ReadVarint ¶
type BlockHeader ¶
type BlockHeader struct {
Version int32
HashPrev Hash256
HashMerkle Hash256
Timestamp time.Time
TargetDifficulty uint32 // bits
Nonce uint32
// contains filtered or unexported fields
}
func (*BlockHeader) Hash ¶
func (blockHeader *BlockHeader) Hash() Hash256
type Transaction ¶
type Transaction struct {
Version int32
Locktime uint32
Vin []TxInput
Vout []TxOutput
StartPos uint64 // not actually in blockchain data
// contains filtered or unexported fields
}
func NewTxFromFile ¶
func ParseBlockTransactionFromFile ¶
func ParseBlockTransactionFromFile(blockFile *BlockFile) (*Transaction, error)
func (Transaction) HasWitness ¶
func (tx Transaction) HasWitness() bool
func (Transaction) Txid ¶
func (tx Transaction) Txid() Hash256
Click to show internal directories.
Click to hide internal directories.