Documentation
¶
Index ¶
- Constants
- func GetValidBackends() map[SupportedBackend]bool
- func GetValidNetParams() map[string]bool
- func NewBlockHeader(data []byte) (*wire.BlockHeader, error)
- type BlockEvent
- type EventType
- type HeaderBytes
- func (b *HeaderBytes) Eq(other *HeaderBytes) bool
- func (b *HeaderBytes) FromBlockHeader(header *wire.BlockHeader)
- func (b *HeaderBytes) Hash() *HeaderHashBytes
- func (b HeaderBytes) Marshal() ([]byte, error)
- func (b *HeaderBytes) Size() int
- func (b HeaderBytes) ToBlockHeader() *wire.BlockHeader
- func (b *HeaderBytes) Unmarshal(data []byte) error
- type HeaderHashBytes
- func (b *HeaderHashBytes) Eq(other *HeaderHashBytes) bool
- func (b *HeaderHashBytes) FromChainhash(hash *chainhash.Hash)
- func (b HeaderHashBytes) Marshal() ([]byte, error)
- func (b *HeaderHashBytes) Size() int
- func (b *HeaderHashBytes) String() string
- func (b HeaderHashBytes) ToChainhash() *chainhash.Hash
- func (b *HeaderHashBytes) Unmarshal(data []byte) error
- type SupportedBackend
- type SupportedNetwork
Constants ¶
const ( // HeaderLen is the fixed length of a Bitcoin block header in bytes. HeaderLen = 80 // HeaderHashLen is length of hash of a BTC header HeaderHashLen = 32 )
Variables ¶
This section is empty.
Functions ¶
func GetValidBackends ¶
func GetValidBackends() map[SupportedBackend]bool
GetValidBackends returns a map of supported Bitcoin backend types
func GetValidNetParams ¶
GetValidNetParams returns a map of valid Bitcoin network parameters
func NewBlockHeader ¶
func NewBlockHeader(data []byte) (*wire.BlockHeader, error)
NewBlockHeader creates a block header from bytes. Returns error if deserialization fails.
Types ¶
type BlockEvent ¶
type BlockEvent struct { BlockHeader *wire.BlockHeader Type EventType Height int64 }
BlockEvent contains information about a blockchain event
func NewBlockEvent ¶
func NewBlockEvent(evtType EventType, blockHeight int64, blockHeader *wire.BlockHeader) *BlockEvent
NewBlockEvent creates a new block event with the given parameters
type HeaderBytes ¶
type HeaderBytes []byte
HeaderBytes represents a Bitcoin block header as a byte slice.
func NewHeaderBytesFromBlockHeader ¶
func NewHeaderBytesFromBlockHeader(header *wire.BlockHeader) HeaderBytes
NewHeaderBytesFromBlockHeader creates a new HeaderBytes from a wire.BlockHeader.
func (*HeaderBytes) Eq ¶
func (b *HeaderBytes) Eq(other *HeaderBytes) bool
Eq checks if two HeaderBytes are equal by comparing their hashes.
func (*HeaderBytes) FromBlockHeader ¶
func (b *HeaderBytes) FromBlockHeader(header *wire.BlockHeader)
FromBlockHeader converts a wire.BlockHeader to HeaderBytes. Panics if serialization or validation fails.
func (*HeaderBytes) Hash ¶
func (b *HeaderBytes) Hash() *HeaderHashBytes
Hash returns the hash of the block header as HeaderHashBytes.
func (HeaderBytes) Marshal ¶
func (b HeaderBytes) Marshal() ([]byte, error)
Marshal returns the byte slice representation of HeaderBytes.
func (*HeaderBytes) Size ¶
func (b *HeaderBytes) Size() int
Size returns the length of the HeaderBytes in bytes.
func (HeaderBytes) ToBlockHeader ¶
func (b HeaderBytes) ToBlockHeader() *wire.BlockHeader
ToBlockHeader converts HeaderBytes to a wire.BlockHeader. Panics if conversion fails.
func (*HeaderBytes) Unmarshal ¶
func (b *HeaderBytes) Unmarshal(data []byte) error
Unmarshal validates and sets HeaderBytes from a byte slice. Returns error if data length is not 80 bytes or if data is not a valid block header.
type HeaderHashBytes ¶
type HeaderHashBytes []byte
HeaderHashBytes represents a Bitcoin header hash as a byte slice
func NewHeaderHashBytesFromChainhash ¶
func NewHeaderHashBytesFromChainhash(hash *chainhash.Hash) HeaderHashBytes
NewHeaderHashBytesFromChainhash creates a new HeaderHashBytes from a chainhash.Hash
func (*HeaderHashBytes) Eq ¶
func (b *HeaderHashBytes) Eq(other *HeaderHashBytes) bool
Eq checks if two HeaderHashBytes are equal
func (*HeaderHashBytes) FromChainhash ¶
func (b *HeaderHashBytes) FromChainhash(hash *chainhash.Hash)
FromChainhash sets the HeaderHashBytes from a chainhash.Hash
func (HeaderHashBytes) Marshal ¶
func (b HeaderHashBytes) Marshal() ([]byte, error)
Marshal returns the byte slice representation of the header hash
func (*HeaderHashBytes) Size ¶
func (b *HeaderHashBytes) Size() int
Size returns the length of the header hash in bytes
func (*HeaderHashBytes) String ¶
func (b *HeaderHashBytes) String() string
String returns the string representation of the header hash
func (HeaderHashBytes) ToChainhash ¶
func (b HeaderHashBytes) ToChainhash() *chainhash.Hash
ToChainhash converts the HeaderHashBytes to a chainhash.Hash pointer
func (*HeaderHashBytes) Unmarshal ¶
func (b *HeaderHashBytes) Unmarshal(data []byte) error
Unmarshal validates and sets the header hash from a byte slice
type SupportedBackend ¶
type SupportedBackend string
SupportedBackend represents a supported Bitcoin backend implementation (btcd, bitcoind)
const ( Btcd SupportedBackend = "btcd" Bitcoind SupportedBackend = "bitcoind" )
Constants defining the supported Bitcoin backend implementations.
func (SupportedBackend) String ¶
func (b SupportedBackend) String() string
type SupportedNetwork ¶
type SupportedNetwork string
SupportedNetwork represents a supported Bitcoin network type (mainnet, testnet, etc.)
const ( Mainnet SupportedNetwork = "mainnet" Testnet SupportedNetwork = "testnet" Simnet SupportedNetwork = "simnet" Regtest SupportedNetwork = "regtest" Signet SupportedNetwork = "signet" )
Constants defining the supported Bitcoin networks.
func (SupportedNetwork) String ¶
func (n SupportedNetwork) String() string