btcacc

package
v0.0.0-...-6ac58e8 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HashSize = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash [HashSize]byte

func (Hash) String

func (hash Hash) String() string

String returns the Hash as the hexadecimal string of the byte-reversed hash.

type LeafData

type LeafData struct {
	BlockHash [32]byte
	TxHash    Hash
	Index     uint32 // txout index
	Height    int32
	Coinbase  bool
	Amt       int64
	PkScript  []byte
}

LeafData is all the data that goes into a leaf in the utreexo accumulator. Everything here is enough data to verify the bitcoin signatures

func (*LeafData) Deserialize

func (l *LeafData) Deserialize(r io.Reader) (err error)

func (*LeafData) LeafHash

func (l *LeafData) LeafHash() [32]byte

LeafHash turns a LeafData into a LeafHash

func (*LeafData) OPString

func (ld *LeafData) OPString() string

OPString returns just the outpoint of this leafdata as a string

func (*LeafData) Serialize

func (l *LeafData) Serialize(w io.Writer) (err error)

Serialize puts LeafData onto a writer

func (*LeafData) SerializeSize

func (l *LeafData) SerializeSize() int

SerializeSize says how big a leafdata is

func (*LeafData) ToString

func (l *LeafData) ToString() (s string)

ToString turns a LeafData into a string

type UData

type UData struct {
	Height   int32
	AccProof accumulator.BatchProof
	Stxos    []LeafData
	TxoTTLs  []int32
}

func GenUData

func GenUData(delLeaves []LeafData, forest *accumulator.Forest, height int32) (
	ud UData, err error)

GenUData creates a block proof, calling forest.ProveBatch with the leaf indexes to get a batched inclusion proof from the accumulator. It then adds on the leaf data, to create a block proof which both proves inclusion and gives all utxo data needed for transaction verification.

func UDataFromCompactBytes

func UDataFromCompactBytes(b []byte) (UData, error)

func (*UData) Deserialize

func (ud *UData) Deserialize(r io.Reader) (err error)

func (*UData) ProofSanity

func (ud *UData) ProofSanity(nl uint64, h uint8) bool

Verify checks the consistency of uData: that the utxos are proven in the batchproof

func (*UData) Serialize

func (ud *UData) Serialize(w io.Writer) (err error)

func (*UData) SerializeSize

func (ud *UData) SerializeSize() int

SerializeSize outputs the size of the udata when it is serialized

func (*UData) ToCompactBytes

func (ud *UData) ToCompactBytes() (b []byte)

Jump to

Keyboard shortcuts

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