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.3.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.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bloom_cascade-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 84f0210a93b676c4b4ed1c0a9cbc6b037013fd4f512a3047bdd8606db14b1dff
MD5 e63e04e9bf00f17f50d4fc7ad811038f
BLAKE2b-256 a0c7beee8fe811fad293350d579992aa5b2efc6a9ad63fac13f1673e3e8c6ab7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bloom_cascade-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2c221c6c3c165bfaf49dbe7207dd82f5ecd792595541bf9331882d3451852cc9
MD5 7795dc1dd16dd7fc4d54968c083ef1cd
BLAKE2b-256 78dd8856b3c21597cafbfdd21ba6affa25717c6e89d8a27a7613a24892d669e4

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