peaq Robot SDK for robotics on the peaq network (Substrate)
Project description
peaq Robotics 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
- 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 --pre -U peaq-robotics-sdk
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_PASSWORDto 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|FINALTxOptions(mode=...)TransactionStatus:BROADCAST|IN_BLOCK|FINALIZEDTransactionStatusCallback(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"))
Access
Access management provides roles, permissions, and assignments.
# Create role and permission, assign permission to role, grant role to user
role_tx = robot.access.create_role("ROBOT_OPERATOR", "Operator role")
perm_tx = robot.access.create_permission("ROBOT_CONTROL", "Control permission")
assign_tx = robot.access.assign_permission_to_role("ROBOT_CONTROL", "ROBOT_OPERATOR")
grant_tx = robot.access.grant_role("ROBOT_OPERATOR", "USER_123")
# Read role (best-effort)
role_info = robot.access.read_role("ROBOT_OPERATOR")
print(role_info)
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
- Set a local funder mnemonic in
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
peaq_robot.robotics.IdentityService– thin facade overRobotIdentitypeaq_robot.robotics.DataVault– thin facade overRobotStorage
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
- Keep public APIs stable and backwards compatible
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file peaq_robotics_sdk-0.0.1.tar.gz.
File metadata
- Download URL: peaq_robotics_sdk-0.0.1.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc9b2cfb5dac352d461ac207105f4b828f603a92f4081cd1f04d76a4cfe22862
|
|
| MD5 |
cda2704a1e0426ffa7c52ce1d673078c
|
|
| BLAKE2b-256 |
3de1132ccc4af7c38e4649ab73acfd6d6a2a78f20d6626b63c6ce029102ad356
|
Provenance
The following attestation bundles were made for peaq_robotics_sdk-0.0.1.tar.gz:
Publisher:
publish-robot-sdk.yml on peaqnetwork/peaq-robotics-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peaq_robotics_sdk-0.0.1.tar.gz -
Subject digest:
bc9b2cfb5dac352d461ac207105f4b828f603a92f4081cd1f04d76a4cfe22862 - Sigstore transparency entry: 541242196
- Sigstore integration time:
-
Permalink:
peaqnetwork/peaq-robotics-sdk@b3fbbc23285ecfb5fad013012a660fe7e7e7aa4a -
Branch / Tag:
refs/heads/dev - Owner: https://github.com/peaqnetwork
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-robot-sdk.yml@b3fbbc23285ecfb5fad013012a660fe7e7e7aa4a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file peaq_robotics_sdk-0.0.1-py3-none-any.whl.
File metadata
- Download URL: peaq_robotics_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc29dc98fb307c9951e9ab8a74dbeea4c118411c2100761fd61f134a5ac2a327
|
|
| MD5 |
dfcd18b9297147535771d0073b1675b4
|
|
| BLAKE2b-256 |
cabd15266cbf4a01576ee8067e79dc2af775895a145b68a7078cbcd8f85ff1f5
|
Provenance
The following attestation bundles were made for peaq_robotics_sdk-0.0.1-py3-none-any.whl:
Publisher:
publish-robot-sdk.yml on peaqnetwork/peaq-robotics-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peaq_robotics_sdk-0.0.1-py3-none-any.whl -
Subject digest:
dc29dc98fb307c9951e9ab8a74dbeea4c118411c2100761fd61f134a5ac2a327 - Sigstore transparency entry: 541242198
- Sigstore integration time:
-
Permalink:
peaqnetwork/peaq-robotics-sdk@b3fbbc23285ecfb5fad013012a660fe7e7e7aa4a -
Branch / Tag:
refs/heads/dev - Owner: https://github.com/peaqnetwork
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-robot-sdk.yml@b3fbbc23285ecfb5fad013012a660fe7e7e7aa4a -
Trigger Event:
workflow_dispatch
-
Statement type: