Skip to main content

Gluon simulator library for python.

Project description

pygluon

Gluon simulator library for Python. Simulates the Gluon protocol's reactor mechanics including fission, fusion, and beta decay reactions.

Installation

pip install pygluon

Quick Start

from pygluon.reactors import GluonZReactor
from pygluon.reactors.types import (
    GluonReaction,
    GluonZReactorParameters,
    GluonZReactorState,
    Tokeons,
)

# Configure reactor parameters
params = GluonZReactorParameters(
    critical_neutron_ratio=0.5,
    fission_fee=0.01,
    fusion_fee=0.01,
    beta_decay_fee_slope=0.1,
    beta_decay_fee_intercept=0.005,
    volume_decay_factor=0.99,
)

# Initialize reactor state
state = GluonZReactorState(
    reserves=1000.0,
    neutron_circulating_supply=500.0,
    proton_circulating_supply=500.0,
    prev_volume_delta=0.0,
    prev_reaction_time=0.0,
)

# Create reactor instance
reactor = GluonZReactor(params, state)

# Execute a fission reaction (basecoins -> neutrons + protons)
result = reactor.execute(
    GluonReaction.FISSION,
    balance=100.0,
    neutron_target_price=1.0,
    reaction_time=1.0,
)
print(f"Received: {result.reactor_output}")
print(f"New reserves: {result.reactor_state.reserves}")

Reactions

The Gluon protocol supports four reaction types:

  • FISSION: Convert basecoins into neutrons and protons
  • FUSION: Convert neutrons and protons back into basecoins
  • BETA_DECAY_PLUS: Convert protons into neutrons
  • BETA_DECAY_MINUS: Convert neutrons into protons

Types

The library uses type aliases for documentation:

  • Basecoin - Reserve currency amounts (float)
  • Neutron - Neutron token amounts (float)
  • Proton - Proton token amounts (float)
  • BasecoinPerNeutron - Price ratio (float)
  • BasecoinPerProton - Price ratio (float)
  • Tokeons - A dataclass containing neutrons and protons

License

MIT

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

pygluon-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygluon-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file pygluon-1.0.0.tar.gz.

File metadata

  • Download URL: pygluon-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for pygluon-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0560c1b30f49833d284f161666c6d6e3a02721ec6df26ea3cf0ad408732f318b
MD5 182e8457861ec236866b1b238e52212e
BLAKE2b-256 09cb8143560a3b558462b9c5903f0515953e70d1768eb7e8042f490a8d2d05f9

See more details on using hashes here.

File details

Details for the file pygluon-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pygluon-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for pygluon-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d91bb2bcca7c29a8b6c9c5b04cdac557783db33ce71430f1c0f997481ab908
MD5 5108b442cf55338017e5bdacf92e833d
BLAKE2b-256 8cd4da9929411b75b3505e0e1107e4187d84a7eaa36b55d066261af54e3f3a0d

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