> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peaq.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Instance

The [Python SDK](https://pypi.org/project/peaq-sdk/) supports **EVM** and **Substrate** transactions. The following code examples are for versions `0.2.1`, with a new reference coming soon for version `1.0.0`. When installing the SDK, use the following command:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
pip install peaq-sdk==0.2.1
```

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](/peaqchain/build/getting-started/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.                         |

<CodeGroup>
  ```python EVM Unsigned Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )
  ```

  ```python EVM Write Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )
  ```

  ```python Substrate Unsigned Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
  )
  ```

  ```python Substrate Write Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )
  ```
</CodeGroup>
