Nukez

Docs · PyNukez

PyNukez SDK

python · v4.0.21

Examples

Python examples

Quote, pay, store, verify.

These examples show the SDK path end to end. Use the payment helper only when you want local payment execution for the selected quote leg.

Quote

Request storage and inspect payment options

Start with the default storage quote and inspect the selected SOL leg plus the available alternatives.

python
from pynukez import Nukez client = Nukez(    keypair_path="~/.config/solana/id.json",  # optional local signer path    base_url="https://api.nukez.xyz",    network="mainnet-beta",) req = client.request_storage(units=1, provider="gcs") print(req.pay_req_id)print(req.pay_to_address)print(req.amount_sol) for option in req.payment_options or []:    print(option["pay_asset"], option["network"], option["amount"])

Code notes

The default quote path returns a selected native SOL leg plus the full payment_options list. PyNukez parses those options so your app can display or select a payment rail deliberately.

The gateway should never receive your keypair file. Browser apps, relays, and hardware-backed flows can provide their own signer.

Payment

Select a token leg and confirm the receipt

Request a specific payment asset, execute the transfer locally, then pass the helper confirmation data back to PyNukez.

python
req = client.request_storage(    units=1,    provider="gcs",    pay_network="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",    pay_asset="USDC",) print(req.pay_asset)       # USDCprint(req.pay_to_address)  # treasury token accountprint(req.amount_raw)      # token base units from nukez_pay import pay_from_request payment = pay_from_request(    req,    svm_keypair="~/.config/solana/id.json",    svm_rpc="https://api.mainnet-beta.solana.com",) receipt = client.confirm_storage(req.pay_req_id, **payment.confirm_kwargs())

Code notes

To pay with a Solana token, request the specific network and asset first. The optional helper executes the transfer, then the SDK confirms using the returned transaction signature.

The helper supports SOL, Solana SPL, native EVM, and ERC-20 legs. It is optional and local.

Storage proof

Provision, upload, attest, and verify

Use the confirmed receipt id as the handle for locker provisioning, file upload, attestation, and receipt checks.

python
manifest = client.provision_locker(receipt.id) urls = client.create_file(    receipt_id=receipt.id,    filename="notes.txt",    content_type="text/plain",)client.upload_bytes(urls.upload_url, b"hello nukez", content_type="text/plain")client.confirm_file(receipt.id, "notes.txt", confirm_url=urls.confirm_url) att = client.attest(receipt.id, sync=True)full = client.verify_storage(receipt.id)hash_check = client.verify_receipt_hash(receipt.id) print(att.merkle_root)print(full.verified)print(hash_check.matches)

Code notes

Once payment is confirmed, the rest of the flow is pure storage and proof work: provision, create file URLs, upload bytes, confirm content, attest, and verify.

The receipt id is the stable handle for every proof operation that follows.

§ next