Skip to main content

The Python client for working with the Celestia blockchain platform.

Project description

pyCelestia

This module provides a Python interface for interacting with the Celestia Node API. All methods communicate with the API via JSON-RPC, offering a flexible and developer-friendly solution for integrating Celestia functionality into applications.

It is designed for developers who want to interact with the Celestia network without dealing with the complexities of low-level RPC request handling.

🚀 Installation

pip install pycelestia  

🔧 Usage

Connecting to Celestia Node

Below is an example of how to connect to a real Celestia node using its RPC endpoint.

from pycelestia import Client

# Configuration for connecting to a Celestia node
node_url = "https://celestia-rpc.example.com"  # Replace with the actual RPC node URL
auth_token = "your-auth-token"  # Replace with your authentication token (if required)

# Initialize the client
client = Client(base_url=node_url)

# Example usage of the API
async with client.connect(auth_token) as api:
    balance = await api.state.balance()

Custom Deserialization Example

from pydantic import BaseModel

class CustomBalanceModel(BaseModel):
    amount: int
    denom: str

async with client.connect(auth_token) as api:
    # The `deserializer` parameter allows you to transform raw API data into a desired format
    last_height = await api.header.local_head(deserializer=lambda data: int(data['header']['height']))
    isinstance(last_height, int) # True
    # Use the Pydantic model to validate and transform the balance response
    balance = await api.state.balance(deserializer=CustomBalanceModel.model_validate)
    isinstance(balance.amount, int) # True

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

pycelestia-0.1.7.tar.gz (58.9 kB view details)

Uploaded Source

Built Distributions

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

pycelestia-0.1.7-cp313-cp313-manylinux_2_28_x86_64.whl (318.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pycelestia-0.1.7-cp312-cp312-manylinux_2_28_x86_64.whl (318.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pycelestia-0.1.7-cp311-cp311-manylinux_2_28_x86_64.whl (318.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pycelestia-0.1.7-cp310-cp310-manylinux_2_28_x86_64.whl (319.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

Details for the file pycelestia-0.1.7.tar.gz.

File metadata

  • Download URL: pycelestia-0.1.7.tar.gz
  • Upload date:
  • Size: 58.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pycelestia-0.1.7.tar.gz
Algorithm Hash digest
SHA256 bc829b085bea8c64aaa5493cce488e1891266b15be69ff3c5c237578360cf401
MD5 47ad69e580f20b96ed97c0061d2dae75
BLAKE2b-256 fdb19e132674916e99f9d4f1eb632e00870e65bcdb8c0dabd8e3c74f2d1efdc0

See more details on using hashes here.

File details

Details for the file pycelestia-0.1.7-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycelestia-0.1.7-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a5be4fb0b6c5730829afc9d929ca29818a7784057ffd4a01de9a5981f79262d
MD5 d4b11ac5c4a277e5f2e2abbf5610192b
BLAKE2b-256 9ac7357347373179265033d31b67d8409ff3d759f77490bf96fd3479c83ce8f5

See more details on using hashes here.

File details

Details for the file pycelestia-0.1.7-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycelestia-0.1.7-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4483d18a4bc2b7610bceeab4d4d1528f89dae489cd9450e1ac6eaffa160e6442
MD5 b897a4f16348fb8d5d584818c96d06ca
BLAKE2b-256 7a8207c0760e057f68170f879cae96a9d804a0be2f484f85128bda40f1b7a6f0

See more details on using hashes here.

File details

Details for the file pycelestia-0.1.7-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycelestia-0.1.7-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6ec8821dd98b5fcc7af62c1cec0d3fa69cc72b6c8fce6f755a802e842b57d47d
MD5 813d0431a085bbe59e20ae621c33ca1a
BLAKE2b-256 b288c1af2e82c6cf59e2cce23c1f76e2782062bcf85034d3ee11f65712fd8195

See more details on using hashes here.

File details

Details for the file pycelestia-0.1.7-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycelestia-0.1.7-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b7e583e0b7f7bb518d77b3c96de1c31c6b2b745858b73e9122d1180bee95703d
MD5 200b66e152ba08017965039fea346fd2
BLAKE2b-256 65468354df0f1bf135f294c9d54263242a8e71f68efc574b063a376b19d0d496

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