oasis-rofl-client
Python client SDK for Oasis ROFL.
Installation
pip install oasis-rofl-client
Or using uv:
uv add install oasis-rofl-client
The package requires Python 3.9+ and depends on httpx for async HTTP operations.
Quickstart
RoflClient provides methods for interacting with ROFL services:
from oasis_rofl_client import RoflClient
client = RoflClient()
key = client.generate_key("my-key-id")
print(f"Generated SECP256K1 key: {key}")
You can also use an async version:
import asyncio
from oasis_rofl_client import AsyncRoflClient
async def main():
client = AsyncRoflClient()
key = await client.generate_key("my-key-id")
print(f"Generated SECP256K1 key: {key}")
asyncio.run(main())
API Reference
RoflClient
The main client class for interacting with ROFL runtime services.
Constructor
RoflClient(url: str = '', timeout: float = 60.0)
url: Optional URL or Unix socket path- If empty (default): Uses Unix socket at
/run/rofl-appd.sock - If starts with
http://orhttps://: Uses HTTP transport - Otherwise: Treats as Unix socket path
- If empty (default): Uses Unix socket at
timeout: Request timeout in seconds (default: 60)sign_submitwaits for the transaction result, including time queued in appd, so apps that submit many transactions at once need a longer timeout. A timeout does not cancel the transaction, and it can still land.
Methods
get_app_id() -> str
Get app ID.
- Returns: Bech32-encoded ROFL app ID
- Raises:
httpx.HTTPStatusErrorif the request fails
generate_key(key_id: str, kind: KeyKind = KeyKind.SECP256K1) -> str
Fetches or generates a cryptographic key from ROFL.
- Parameters:
key_id: Identifier for the keykind: Type of key to generate (default:KeyKind.SECP256K1). Available options:KeyKind.RAW_256: Generate 256 bits of entropyKeyKind.RAW_384: Generate 384 bits of entropyKeyKind.ED25519: Generate an Ed25519 private keyKeyKind.SECP256K1: Generate a Secp256k1 private key
- Returns: The private key as a hex string
- Raises:
httpx.HTTPStatusErrorif the request fails
sign_submit(tx: TxParams, encrypt: bool = True) -> dict[str, Any]
Sign the given Ethereum transaction with an endorsed ephemeral key and submit it to Sapphire.
Note: Transaction nonce and gas price are ignored.
- Parameters:
tx: Transaction parametersencrypt: End-to-end encrypt the transaction before submitting (default: True)
- Returns: Deserialized response data object
- Raises:
httpx.HTTPStatusErrorif the request fails - Raises:
cbor2.CBORDecodeValueErrorIf the response data is invalid
get_metadata() -> dict[str, str]
Get all user-set metadata key-value pairs.
- Returns: Dictionary of metadata key-value pairs
- Raises:
httpx.HTTPStatusErrorif the request fails
set_metadata(metadata: dict[str, str]) -> None
Set metadata key-value pairs.
This replaces all existing app-provided metadata. Will trigger a registration refresh if the metadata has changed.
- Parameters:
metadata: Dictionary of metadata key-value pairs to set
- Raises:
httpx.HTTPStatusErrorif the request fails
query(method: str, args: bytes) -> bytes
Query the on-chain paratime state.
- Parameters:
method: The query method nameargs: CBOR-encoded query arguments
- Returns: CBOR-encoded response data
- Raises:
httpx.HTTPStatusErrorif the request fails
Examples
For a complete working example, see examples/basic_usage.py.
Release Process
Publishing to PyPI is fully automated via GitHub Actions.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details or visit http://www.apache.org/licenses/LICENSE-2.0.
Metadata
Release files for oasis-rofl-client 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oasis_rofl_client-0.2.1.tar.gz | 178.5 kB | Without provenance | Details for oasis_rofl_client-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oasis_rofl_client-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for oasis_rofl_client-0.2.1-py3-none-any.whl |
Total release size: 187.5 kB
Release files / oasis_rofl_client-0.2.1.tar.gz
| Download URL | oasis_rofl_client-0.2.1.tar.gz |
|---|---|
| Size | 178.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83713d45cfc817f1fb584b9afeb76d067b893d38a5b8804586e227ad02d8db28
|
|
BLAKE2b-256 checksum How to use checksums |
a88c3bdcfe6df222c1ef630d205aaf19629d2cff66ee44852bd1cf6ac1617b39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / oasis_rofl_client-0.2.1-py3-none-any.whl
| Download URL | oasis_rofl_client-0.2.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf0eac1e679f2cace71fb65871268794830edd7eac1e033722ebf46e1f5f50a3
|
|
BLAKE2b-256 checksum How to use checksums |
0cad0751d8ac88fa0b0470674832bc554b14d471a6dda644d4b3cef7958bf958
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for oasis-rofl-client 0.2.1
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.