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.6.tar.gz (55.6 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.6-cp313-cp313-manylinux_2_28_x86_64.whl (288.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pycelestia-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl (288.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pycelestia-0.1.6-cp311-cp311-manylinux_2_28_x86_64.whl (289.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pycelestia-0.1.6-cp310-cp310-manylinux_2_28_x86_64.whl (289.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: pycelestia-0.1.6.tar.gz
  • Upload date:
  • Size: 55.6 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.6.tar.gz
Algorithm Hash digest
SHA256 f64320c8d09ddfa817c3cf05f1b8797a27f25eef5013db44451651ce9b873940
MD5 3dbebfcb5c793e2d3d03776f45c3757a
BLAKE2b-256 cc82d18b475773083baaf0859551a53f79c070520d925508dc02e70502df8bf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycelestia-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7fe08d223e3d2dad6eeff0f13b3c62b3a7acde974fdde817a3142a8bea08a3ae
MD5 e8a740578267b815f583e72687db370b
BLAKE2b-256 db108e79c6733dbe801e9effe713dc4950fc5716c22a5ea5bfd904f4de6c3924

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycelestia-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd00712acf1358696ef2e96b9b1ff123ddf29a098d7f44847fcc7d9366eef5b7
MD5 75c00937687b7b42bd3b7e805cc6ad03
BLAKE2b-256 143f6889c962e62f1064ba31b887ce4eb83b2d5acb471a6f61139ed05670860d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycelestia-0.1.6-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1f719efe74a8285b523eee25385abeee9c01b1859da011d6f98c3b09d93c48f6
MD5 62c8eedc1ecf8a2fb82251239927203d
BLAKE2b-256 f1368053122cb8bc8ee8f46f74b474f43a6eb8b431452cf35dd3662489168afb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycelestia-0.1.6-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ff03b8ff2e23a35310ad59fcffdb1fec357dc906a7e9927f1f77a4fd0c22250a
MD5 3fef11b353355bd5d64baa92e0cfb2ef
BLAKE2b-256 eb080261ae15e10ea4a07d6aaa36825f50b8d0115d169e39216033e7ef44e72a

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