Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

bloomfilter/v0 package

Overview

Package bloomfilter ports the classic Bloom filter data structure to gno.land: a fixed-size bit array plus k independent hash functions that let you test set membership with zero false negatives and a small, bounded false-positive rate — without ever storing the actual items.

Membership is checked via double hashing (Kirsch–Mitzenmacher): two base hashes h1, h2 are combined as h1 + i*h2 to derive k bit positions per item, avoiding the cost of k independent hash functions.

Add is a crossing function per the gno 0.9 interrealm convention (it takes `cur realm` as its first parameter); MightContain and Stats are read-only.

Function

Add

func Add(cur realm, item string)

Add inserts `item` into the filter. Crossing function: any caller (user or realm) may add, matching this demo's open-membership model.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/daily/bloomfilter/v0" -func "Add" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/daily/bloomfilter/v0" -func "Add" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx