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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bloom_cascade-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 1af29b2da5c5e3a7d89a3989d7167dd5a695b1c9bd83ef4a305b8be763b38e3a
MD5 6d15b5666bc1d0bf2fa764d9e8f9a907
BLAKE2b-256 259bae78fe2601efc968f9764d51f40521f21eebb6c5b6cb5d141049ec01ac05

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bloom_cascade-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9a612f432ca2dd888d6f944e9997b8fe09b9d13ff088f3ffce40df6c3c30553
MD5 81ce8b2a3aa579a10ef16b3d50905017
BLAKE2b-256 c32def86461ebefd93915343706fe25db01520b4ca20589dae4737746878d5d3

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