Class: Golomb

Golomb()

Golomb - BIP 158 block filters

Constructor

new Golomb()

Create a block filter.

Properties:
Name Type Description
m Number
n Number
p Number
data Buffer
Source:
See:

Methods

(static) fromBytes(N, P, data) → {Golomb}

Instantiate a block filter from a N, P, and raw data.

Parameters:
Name Type Description
N Number
P Number
data Buffer
Source:
Returns:
Type
Golomb

(static) fromItems(P, 128-bit, items) → {Golomb}

Instantiate a block filter from a P, 128-bit key and items.

Parameters:
Name Type Description
P Number
128-bit Buffer

key

items Array.<Buffer>
Source:
Returns:
Type
Golomb

(static) fromNBytes(P, data) → {Golomb}

Instantiate a block filter from a P, and raw data.

Parameters:
Name Type Description
P Number
data Buffer
Source:
Returns:
Type
Golomb

(static) fromNPBytes(data) → {Golomb}

Instantiate a block filter from raw data.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
Golomb

(static) fromPBytes(N, data) → {Golomb}

Instantiate a block filter from a N, and raw data.

Parameters:
Name Type Description
N Number
data Buffer
Source:
Returns:
Type
Golomb

(static) fromRaw(data) → {Golomb}

Instantiate a block filter from raw data.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
Golomb

_readU64(br)

Read uint64 from a bit reader.

Parameters:
Name Type Description
br BufferReader

BitReader

Source:
Throws:

on EOF

fromBytes(N, P, data) → {Golomb}

Instantiate a block filter from a N, P, and raw data.

Parameters:
Name Type Description
N Number
P Number
data Buffer
Source:
Returns:
Type
Golomb

fromItems(P, 128-bit, items) → {Golomb}

Instantiate a block filter from a P, 128-bit key and items.

Parameters:
Name Type Description
P Number
128-bit Buffer

key

items Array.<Buffer>
Source:
Returns:
Type
Golomb

fromNBytes(P, data) → {Golomb}

Instantiate a block filter from a P, and raw data.

Parameters:
Name Type Description
P Number
data Buffer
Source:
Returns:
Type
Golomb

fromNPBytes(data) → {Golomb}

Instantiate a block filter from raw data.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
Golomb

fromPBytes(N, data) → {Golomb}

Instantiate a block filter from a N, and raw data.

Parameters:
Name Type Description
N Number
data Buffer
Source:
Returns:
Type
Golomb

fromRaw(data) → {Golomb}

Instantiate a block filter from raw data.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
Golomb

hash(encnullable) → {Hash|Buffer}

Hash the block filter.

Parameters:
Name Type Attributes Description
enc String <nullable>

Can be 'hex' or null.

Source:
Returns:

hash

Type
Hash | Buffer

Get the block filter header. hash of block filter concatenated with previous block filter header.

Parameters:
Name Type Description
prev Hash

previous filter header.

Source:
Returns:

hash

Type
Hash | Buffer

match(key, data) → {Boolean}

Get the membership of given item in the block filter.

Parameters:
Name Type Description
key Buffer

128-bit key.

data Buffer

item.

Source:
Returns:

match

Type
Boolean

matchAny(key) → {Boolean}

Get the membership of any item of given items in the block filter.

Parameters:
Name Type Description
key Buffer

128-bit key.

items. Array.<Buffer>
Source:
Returns:

match

Type
Boolean

readU64(br)

Read uint64 from a bit reader.

Parameters:
Name Type Description
br BufferReader

BitReader

Source:

toBytes() → {Buffer}

Serialize the block filter as raw filter bytes.

Source:
Returns:

filter

Type
Buffer

toNBytes() → {Buffer}

Serialize the block filter as N and raw filter bytes

Source:
Returns:

filter

Type
Buffer

toNPBytes() → {Buffer}

Serialize the block filter as N, P and raw filter bytes

Source:
Returns:

filter

Type
Buffer

toPBytes() → {Buffer}

Serialize the block filter as P and raw filter bytes

Source:
Returns:

filter

Type
Buffer

toRaw() → {Buffer}

Serialize the block filter as default filter bytes.

Source:
Returns:

filter

Type
Buffer