Skip to main content

peaq Robot SDK for robotics on the peaq network (Substrate)

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

peaq Robot SDK

Highlights

  • DID management (create/read), Protobuf-based storage, chainstate reads
  • On-chain storage for telemetry/config (JSON-friendly)
  • Keystore-backed wallets with optional encryption
  • Confirmation modes and status callbacks, aligned with peaq-sdk-py
  • Clean imports: from peaq_robot import PeaqRobot

Install

From this repo (monorepo-style):

cd packages/python
pip install -r requirements.txt
pip install -e .

From TestPyPI (resolve deps from PyPI):

python -m venv .venv && source .venv/bin/activate
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple peaq-robot-sdk==0.0.0.dev4

Note: Python 3.8–3.12 are supported. Python 3.13 is currently not supported due to upstream wheel availability.

Wallets and Keystore

  • Default keystore location: ~/.peaq_robot/wallet.json
  • Override path: PEAQ_ROBOT_KEYSTORE=/custom/path.json
  • Optional encryption: set PEAQ_ROBOT_KEY_PASSWORD to encrypt the keystore with Fernet+PBKDF2

Create or load automatically:

from peaq_robot import PeaqRobot
robot = PeaqRobot()            # loads from keystore or creates on first run
print(robot.address)

Generate a fresh wallet and persist to keystore:

robot = PeaqRobot.create_wallet()

Use explicit keys (won’t be stored unless you call create_wallet):

PeaqRobot(mnemonic="..."), PeaqRobot(private_key="0x...")

Network selection

The SDK resolves a network URL for you:

  • Default testnet (Agung): wss://peaq-agung.api.onfinality.io/ws
  • Aliases: "agung"|"test"|"testnet" → Agung; "peaq"|"main"|"mainnet"wss://quicknode3.peaq.xyz
  • HTTPS QuickNode converts to WSS automatically
from peaq_robot import PeaqRobot
robot = PeaqRobot(network="peaq")          # mainnet quicknode3
robot = PeaqRobot(network="wss://...")     # custom WSS

Transactions: confirmation modes and callbacks

Types are in peaq_robot.types:

  • ConfirmationMode: FAST | FINAL
  • TxOptions(mode=...)
  • TransactionStatus: BROADCAST | IN_BLOCK | FINALIZED
  • TransactionStatusCallback (Pydantic model)

Write methods accept optional tx_options and on_status:

from peaq_robot.types import TxOptions, ConfirmationMode

# FAST (default): returns tx-hash string
tx = robot.store.add_data("LOG", {"ok": True})

# FINAL: returns SubstrateSendResult with finalize awaitable; emits status callbacks
def on_status(s):
    print(s.model_dump())

res = robot.store.add_data(
    "LOG2", {"ok": True},
    tx_options=TxOptions(mode=ConfirmationMode.FINAL),
    on_status=on_status,
)
final_receipt = asyncio.run(res.finalize)

DID (identity)

Create (idempotent friendly) and read:

name = f"did:peaq:{robot.address}"
try:
    robot.id.create_identity(name=name)   # returns hash (FAST)
except Exception as e:
    # For duplicates, you might get AttributeAlreadyExist
    if "AttributeAlreadyExist" in str(e):
        pass

doc = robot.id.read_identity()
print(doc["decoded_data"])  # parsed protobuf

Storage

robot.store.add_data("TELEMETRY_001", {"battery": 87.3})
print(robot.store.read_data("TELEMETRY_001"))

Demos and examples

  • examples/wallet_demo.py: end-to-end flow
    • Set a local funder mnemonic in examples/.env:
      • PEAQ_ROBOT_FUND_MNEMONIC="abandon ... about"
    • Run: python examples/wallet_demo.py
  • examples/options_test.py: exercises FAST/FINAL modes and callbacks

Project layout

packages/
  python/
    peaq_robot/           # SDK implementation
    README.md             # package README for PyPI
    setup.py, requirements.txt, pytest.ini
examples/
  wallet_demo.py
  options_test.py

Robotics wrappers (WIP)

  • peaq_robot.robotics.IdentityService – thin facade over RobotIdentity
  • peaq_robot.robotics.DataVault – thin facade over RobotStorage

Development

python3 -m venv .venv && source .venv/bin/activate
cd packages/python
pip install -r requirements.txt
pip install -e .
cd ../../
python examples/wallet_demo.py

Contributing

  1. Keep public APIs stable and backwards compatible
  2. Align Substrate ergonomics (confirmation modes, callbacks) with peaq-sdk-py
  3. Add examples/tests for new options

License

MIT

Style

  • Classes: PascalCase (e.g., PeaqRobot)
  • Modules/packages: lowercase (e.g., peaq_robot)
  • Methods/functions: snake_case

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

peaq_robot_sdk-0.0.2.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

peaq_robot_sdk-0.0.2-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file peaq_robot_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: peaq_robot_sdk-0.0.2.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for peaq_robot_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b8d4ef9877ff7064812ca84fd5076e4444bdcf430affa096c5a52f1c7256e4bc
MD5 59269b9b8ac62c3f76f9e601f31c1cbd
BLAKE2b-256 d36e19ed4dacfdfff41b8e37d8141ea9d7e53cb76aff50e3f12f080ba8b37df5

See more details on using hashes here.

Provenance

The following attestation bundles were made for peaq_robot_sdk-0.0.2.tar.gz:

Publisher: publish-robot-sdk.yml on peaqnetwork/peaq-robot-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file peaq_robot_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: peaq_robot_sdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for peaq_robot_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e69d19708740587c6b234f2b8cf5256ff835327c3ff531f3e69734a6541d9b40
MD5 d59f1c43dd4178b00fb045e38863dcd9
BLAKE2b-256 532863ccbe2b28661aaa9615c33604a00f8efd4aafe67479aa9238dbeea0a392

See more details on using hashes here.

Provenance

The following attestation bundles were made for peaq_robot_sdk-0.0.2-py3-none-any.whl:

Publisher: publish-robot-sdk.yml on peaqnetwork/peaq-robot-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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