Skip to main content

nakamoto-dice (Python)

pip install requests
from nakamoto_dice import NakamotoDiceClient
import uuid

client = NakamotoDiceClient(session_id=str(uuid.uuid4()))

# Create a game on heads, 5k stake
resp = client.create_game(stake_tier=5000, position="heads")
print(resp["invoice"])  # bolt11 — pay with your wallet of choice

# Wait for someone to join, then poll resolution
import time
while True:
    g = client.get_game(resp["game_id"])
    if g.status == "complete":
        print("result:", g.result)
        break
    time.sleep(3)

# Sweep winnings
balance = client.get_winnings()
if balance.get("max_withdrawable_sats", 0) > 0:
    # Generate a bolt11 from your wallet for that amount, then:
    client.withdraw_winnings("lnbc...")

See examples/play_one_flip.py for a complete worked example.

With an affiliate code

Pass referrer_code at create-time and you (the agent) earn 25% of the dice house cut on any games started under your code:

client.create_game(stake_tier=5000, position="heads", referrer_code=client.get_referral()["code"])

Metadata

Release files for nakamoto-dice 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nakamoto-dice 0.1.0
File Size Uploaded Provenance Actions
nakamoto_dice-0.1.0.tar.gz 4.7 kB Without provenance Details for nakamoto_dice-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nakamoto-dice 0.1.0
File Interpreter ABI Platform Actions
nakamoto_dice-0.1.0-py3-none-any.whl Python 3 none any Details for nakamoto_dice-0.1.0-py3-none-any.whl

Total release size: 9.9 kB

Release files / nakamoto_dice-0.1.0.tar.gz

Download URL nakamoto_dice-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2097edcdf6cd7f1274c1875c94059569ed2d325e336bc144fb405a8ae457fa72
BLAKE2b-256 checksum
How to use checksums
cd1b714a3d956cda27ca5be13ba88b6251ffcbb563599b80f541497855f3b820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / nakamoto_dice-0.1.0-py3-none-any.whl

Download URL nakamoto_dice-0.1.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c5e3aaa35114092ceb36fbd684513b9130d02e772d9e73614b9baca4f7e6064
BLAKE2b-256 checksum
How to use checksums
71b3ca4e7e0e98729ef00f7ff8fb7f6d92573ac0f0569998016c30471d24b8b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for nakamoto-dice 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page