Skip to main content

No project description provided

Project description

Bloom cascade

To install, run:

pip install bloom_cascade

To use it, first import it like this:

from bloom_cascade import Cascade

Creating a cascade

Example of building a cascade:

cascade = Cascade()
R = set()
S = set()

for i in range(100):
    R.add(str(i))

for i in range(100,400):
    S.add(str(i))
  
cascade.build_cascade_blob(R, S) 

Recreate a cascade from BLOB data

An example retriving a bloom cascade from a blob transaction on Holesky testnet, using the blobscan API:

import requests
import json
import hexbytes
from cascade import Cascade

clean_tx = '0x8fd37f5db4ab0e4c0b8dad166842d0ac7c3aeb86303a3bce3d5b19656dd65c2c'

tx_url = f"https://api.holesky.blobscan.com/transactions/{clean_tx}"
        
print(f" Requesting: {tx_url}")

# Get transaction details
response = requests.get(tx_url)

if response.status_code != 200:
    print(f" Transaction not found: HTTP {response.status_code}")
    print(f"Response: {response.text}")

tx_data = response.json()

print(f" Transaction found: {tx_data.get('hash', 'Unknown')}")
print(f" Block: {tx_data.get('blockNumber', 'Unknown')}")

if not tx_data.get('blobs'):
    print(" No blob versioned hashes found in transaction")


blob_hash = tx_data['blobs'][0]['versionedHash']
print(f" Found {len(blob_hash)} blob hash(es): {blob_hash}")

blobs_url = f"https://api.holesky.blobscan.com/blobs/{blob_hash}/data"
blobs_response = requests.get(blobs_url)

if blobs_response.status_code != 200:
    print(f" Could not retrieve blobs: HTTP {blobs_response.status_code}")


blobs_data = blobs_response.json()
blobs_data_bytes = bytes.fromhex(blobs_data[2:])



csd = Cascade()
# USE THE DEDICATED FUNCTION FOR PROCCESING BLOBS
csd.deserialize_cascade_blob(blobs_data_bytes)

for i in range(100):
    if csd.is_revoked(str(i)):
        print('d'+ str(i))

for i in range(100,200):
    if not csd.is_revoked(str(i)):
        print('R' + str(i))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bloom_cascade-1.0.4.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bloom_cascade-1.0.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file bloom_cascade-1.0.4.tar.gz.

File metadata

  • Download URL: bloom_cascade-1.0.4.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for bloom_cascade-1.0.4.tar.gz
Algorithm Hash digest
SHA256 0884962a88e977c65ceb1dfb72cf96940a502aaa1d8e952fbf4d891a09f251f4
MD5 266d2cbcceccd4ce9bb6e42777636bcb
BLAKE2b-256 5d725b38a731a29c34fdd9d11d89cb1029ff29e118da6304b1efc16e14794cd2

See more details on using hashes here.

File details

Details for the file bloom_cascade-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: bloom_cascade-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for bloom_cascade-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f59052776f3cb31382590e58209e5d71b71bf51ab4a6fa09019e7b77dc8b9aaa
MD5 ea4424d56a71b381b216a800f1df8968
BLAKE2b-256 0ae48c5ed4d163e503baaf045e5043fcab01e1ab881bd4604d27a184187c8363

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page