Skip to main content

Ceramic and OrbisDB Python Client

These Orbis and Ceramic clients implements the payload building, encoding, and signing needed to interact with the Ceramic Network. It currently supports ModelInstanceDocument.

Features

  • Implements payload building, encoding, and signing for Ceramic interactions
  • Currently supports ModelInstanceDocument

Install the library using pip

pip3 install ceramicsdk

Instantiating a Client

You can use the Orbis Studio or run a local or self-hosted OrbisDB Instance to locate and configure your context ID, environment ID, and node endpoints (used below).

This README will utilize this data model as the input example.

First, generate a Decentralized Identifier (DID) using a DID library.

from ceramicsdk import OrbisDB

# using an existing data model example
table = "kjzl6hvfrbw6c6adsnzvbyr6itmf0igfy25xu0mqzei2pe2xw1hlusqyuknb9ky"

# using an existing context id
context = "<your-context-here>"

# dedicated orbis and ceramic endpoints 
o_endpoint = "<your-endpoint-here>"
c_endpoint = "<your-endpoint-here>"

# create a private key
privkey = os.urandom(32).hex()

# creating a client
db = OrbisDB(c_endpoint, o_endpoint, context, table, privkey)

Creating a Row

# input content must conform to data model used
doc = db.add_row({
    page: "/home",
    address: "0x8071f6F971B438f7c0EA72C950430EE7655faBCe",
    customer_user_id: 3,
    timestamp: "2024-09-25T15:06:14.957719+00:00"
})

Reading Data

env_id = "<your-env-id-here>"

# select rows without any filters
docs = orbis.read(env_id)

# using a defined query
q = 'SELECT * FROM kjzl6hvfrbw6c6adsnzvbyr6itmf0igfy25xu0mqzei2pe2xw1hlusqyuknb9ky as table WHERE table.customer_user_id = 3'
queried_rows = db.query(env_id, q)

Updating Data

# add a filter to select specific row
filters={"customer_user_id": 3}

# new content to replace the old
new_content={"customer_user_id": 2}

updated_rows = db.update_rows(env_id, filters, new_content)

Credits

This project is largely based on the work done by the team at https://github.com/valory-xyz/ceramic-py/, and by the team at https://github.com/indexnetwork/ceramic-python. We are grateful for their contributions to the Ceramic ecosystem and the open-source community.

Metadata

Release files for ceramicsdk 0.1.4

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

Source distribution (sdist)

Source distribution for ceramicsdk 0.1.4
File Size Uploaded Provenance Actions
ceramicsdk-0.1.4.tar.gz 12.0 kB Without provenance Details for ceramicsdk-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ceramicsdk 0.1.4
File Interpreter ABI Platform Actions
ceramicsdk-0.1.4-py3-none-any.whl Python 3 none any Details for ceramicsdk-0.1.4-py3-none-any.whl

Total release size: 25.6 kB

Release files / ceramicsdk-0.1.4.tar.gz

Download URL ceramicsdk-0.1.4.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
26009c1c9361b6059b434d4ab6182bc98aa17962a0838d302662d23b79d02b0c
BLAKE2b-256 checksum
How to use checksums
a7bae197e221a24e62f04475bf690293b92c931df0b0d1273d7a7254d632fa5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / ceramicsdk-0.1.4-py3-none-any.whl

Download URL ceramicsdk-0.1.4-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e03b32ee41f6c3fe0edeaeefa5d497f5c133ab2437f5be9de022fe034cb42cf
BLAKE2b-256 checksum
How to use checksums
2ed8e31d334b79aba59052215fddaee17160528bf535da13e3c7dafb1812a6dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Security for ceramicsdk 0.1.4

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.

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