Python
Create Instance
The Python SDK supports EVM and Substrate transactions. It can either:
- Return an unsigned transaction object for manual submission, or
- Automatically submit the transaction if a private key (EVM) or mnemonic seed (Substrate) is provided.
Currently, the SDK supports modules for Decentralized Identifiers (DID), Storage, RBAC (Role-Based Access Control), and Transfers. With Machine Station Factory and UMT modules coming soon.
To get started, you’ll need to determine:
- Whether you’re building for EVM or Substrate, and
- Whether you want the SDK to sign and send transactions, or just prepare them.
create_instance(base_url, chain_type, seed)
Initializes the SDK and returns an instance ready to interact with the network.
Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
base_url | string | Required | Required | HTTPS/WSS URL used to connect to the blockchain. Reference connecting to peaq for supported URLs. Use HTTPS for EVM and WSS for Substrate (and EVM reads). |
chain_type | ChainType | Required | Required | Defines whether the instance will generate EVM or Substrate transactions. |
seed | string | Optional | Optional | Private key (EVM) or mnemonic phrase (Substrate) used to execute write transactions on behalf of the user. If not set, the peaq transaction object is returned to the user for manual submission. |