block

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DYNAFED_HF_MASK = uint32(1 << 31)
)

Variables

This section is empty.

Functions

func DeserializeTransactions

func DeserializeTransactions(
	buf *bytes.Buffer,
) ([]*transaction.Transaction, error)

Types

type Block

type Block struct {
	Header           *Header
	TransactionsData *Transactions
}

func NewFromBuffer

func NewFromBuffer(buf *bytes.Buffer) (*Block, error)

func NewFromHex

func NewFromHex(h string) (*Block, error)

func (*Block) SerializeBlock

func (b *Block) SerializeBlock() ([]byte, error)

type CompactParams

type CompactParams struct {
	// "scriptPubKey" used for block signing
	SignBlockScript []byte
	/// Maximum, in bytes, of the size of a blocksigning witness
	SignBlockWitnessLimit uint32
	/// Merkle root of extra data
	ElidedRoot []byte
}

CompactParams params where the fedpeg data and extension space are not included, and are assumed to be equal to the values from the previous block

type DynamicFederation

type DynamicFederation struct {
	Current          *DynamicFederationParams
	Proposed         *DynamicFederationParams
	SignBlockWitness [][]byte
}

type DynamicFederationParams

type DynamicFederationParams struct {
	CompactParams *CompactParams
	FullParams    *FullParams
}

type ExtData

type ExtData struct {
	// Liquid v1-style static `signblockscript` and witness
	Proof *Proof
	// Dynamic federations
	DynamicFederation *DynamicFederation
	// is dynamic federation
	IsDyna bool
}

ExtData block signature and dynamic federation-related data

type FullParams

type FullParams struct {
	// "scriptPubKey" used for block signing
	SignBlockScript []byte
	// Maximum, in bytes, of the size of a blocksigning witness
	SignBlockWitnessLimit uint32
	// Untweaked `scriptPubKey` used for pegins
	FedpegProgram []byte
	// For v0 fedpeg programs, the witness script of the untweaked
	// pegin address. For future versions, this data has no defined
	// meaning and will be considered "anyone can spend".
	FedpegScript []byte
	/// "Extension space" used by Liquid for PAK key entries
	ExtensionSpace [][]byte
}

FullParams full dynamic federations parameters

type Header struct {
	// Version - should be 0x20000000 except when versionbits signalling
	Version uint32
	// Previous blockhash
	PrevBlockHash []byte
	// Transaction Merkle root
	MerkleRoot []byte
	// Block timestamp
	Timestamp uint32
	// Block Height
	Height uint32
	// Block signature and dynamic federation-related data
	ExtData *ExtData
}

func DeserializeHeader

func DeserializeHeader(
	buf *bytes.Buffer,
) (*Header, error)

func (*Header) Hash

func (h *Header) Hash() (chainhash.Hash, error)

Hash gets the bytes with SerializeForHash and DoubleHash the bytes

func (*Header) Serialize

func (h *Header) Serialize() ([]byte, error)

Serialize returns the block bytes includes all the data of the block

func (*Header) SerializeForHash

func (h *Header) SerializeForHash() ([]byte, error)

SerializeForHash returns the block bytes for block hash it does not include some data of the block (like witness or solution in case of signed blocks)

type MerkleBlock

type MerkleBlock struct {
	BlockHeader       *wire.BlockHeader
	PartialMerkleTree *PartialMerkleTree
}

func NewMerkleBlockFromBuffer

func NewMerkleBlockFromBuffer(buf *bytes.Buffer) (*MerkleBlock, error)

func NewMerkleBlockFromHex

func NewMerkleBlockFromHex(h string) (*MerkleBlock, error)

func (*MerkleBlock) ExtractMatches

func (m *MerkleBlock) ExtractMatches() (*chainhash.Hash, []chainhash.Hash, error)

type PartialMerkleTree

type PartialMerkleTree struct {
	TxTotalCount uint32
	TxHashes     [][]byte
	FBad         bool
	VBits        []bool
}

type Proof

type Proof struct {
	// Block "public key"
	Challenge []byte
	// Satisfying witness to the above Challenge, or nothing
	Solution []byte
}

Proof Liquid v1-style static `signblockscript` and witness

type Transactions

type Transactions struct {
	Transactions []*transaction.Transaction
}

func (*Transactions) SerializeTransactions

func (t *Transactions) SerializeTransactions(
	s *bufferutil.Serializer,
) error

Jump to

Keyboard shortcuts

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