blockcf

package module
v0.0.0-...-903812d Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: ISC Imports: 6 Imported by: 0

README

blockcf

GoDoc

Package blockcf provides functions to build committed filters from blocks. Unlike the gcs package, which is a general implementation of golomb coded sets, this package is tailored for specific filter creation for Hdfchain blocks.

Documentation

Overview

Package blockcf provides functions for building committed filters for blocks using Golomb-coded sets in a way that is useful for light clients such as SPV wallets.

Committed filters are a reversal of how bloom filters are typically used by a light client: a consensus-validating full node commits to filters for every block with a predetermined collision probability and light clients match against the filters locally rather than uploading personal data to other nodes. If a filter matches, the light client should fetch the entire block and further inspect it for relevant transactions.

Index

Constants

View Source
const (
	// P is the collision probability used for block committed filters (2^-20)
	P = 20
)

Variables

This section is empty.

Functions

func Extended

func Extended(block *wire.MsgBlock) (*gcs.FilterV1, error)

Extended builds an extended GCS filter from a block. An extended filter supplements a regular basic filter by including all transaction hashes of regular and stake transactions, and adding the witness data (a.k.a. the signature script) found within every non-coinbase regular transaction.

func Key

func Key(hash *chainhash.Hash) [gcs.KeySize]byte

Key creates a block committed filter key by truncating a block hash to the key size.

func Regular

func Regular(block *wire.MsgBlock) (*gcs.FilterV1, error)

Regular builds a regular GCS filter from a block. A regular GCS filter will contain all the previous regular outpoints spent within a block, as well as the data pushes within all the outputs created within a block which can be spent by regular transactions.

Types

type Entries

type Entries [][]byte

Entries describes all of the filter entries used to create a GCS filter and provides methods for appending data structures found in blocks.

func (*Entries) AddHash

func (e *Entries) AddHash(hash *chainhash.Hash)

AddHash adds a hash to an entries slice.

func (*Entries) AddOutPoint

func (e *Entries) AddOutPoint(outpoint *wire.OutPoint)

AddOutPoint adds a serialized outpoint to an entries slice.

func (*Entries) AddRegularPkScript

func (e *Entries) AddRegularPkScript(script []byte)

AddRegularPkScript adds the regular tx output script to an entries slice.

func (*Entries) AddSigScript

func (e *Entries) AddSigScript(script []byte)

AddSigScript adds any data pushes of a signature script to an entries slice.

func (*Entries) AddStakePkScript

func (e *Entries) AddStakePkScript(script []byte)

AddStakePkScript adds the output script without the stake opcode tag to an entries slice.

Jump to

Keyboard shortcuts

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