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 bloom_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.5.tar.gz (4.3 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.5-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bloom_cascade-1.0.5.tar.gz
  • Upload date:
  • Size: 4.3 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.5.tar.gz
Algorithm Hash digest
SHA256 8e633f8c6b1fa976afc2b2758303f87fd117fdc7fc5e659c300520bb8650bfed
MD5 8b787075f10395eea097cac9cb1db9d5
BLAKE2b-256 c51185b328f8e82dd93734f69b4b76981533abb0146cf0b76e37542215895946

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bloom_cascade-1.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6a5c27bc28729dd6baba0666b76c7492aaed51036da1995ad410fb37d48225f0
MD5 d532538a1e31e18b194f386e45db8185
BLAKE2b-256 e6eb75a46a93fcfde309f79ecac1d2580c55c77a701cc83731299e1620b217b8

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