blockcf

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: MIT Imports: 2 Imported by: 1

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 = 20

P is the collision probability used for block committed filters (2^-20)

Variables

This section is empty.

Functions

func BuildFilter

func BuildFilter(block *types.Block, unlockHashes []types.UnlockHash) (*types.GCSFilter, error)

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

unlockHashes is a list of unlock hashes to be added to this filter, in addition to those directly visible form this block. These are expected to be hashes from file contracts that are associated with storage proofs in this block. TODO please see the note by FileContractUnlockHashMap

func Key

func Key(hash *types.BlockID) [gcs.KeySize]byte

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

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) AddUnlockHash

func (e *Entries) AddUnlockHash(unlockhash types.UnlockHash)

AddUnlockHash adds a unlock hash to the entries

Jump to

Keyboard shortcuts

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