Skip to main content
Owner equals operator. One , one machine, one identity. This guide covers the full flow from environment setup through registration.

Prerequisites

  • Node.js ≥ 22 or Python 3.10+
  • A funded (the owner ) with at least 1.1 (1 PEAQ + )
  • Environment variables configured per the install guide

Environment setup

Set these environment variables before running any SDK call. Both SDKs read the same variable names.
.env
JS examples load the file via import "dotenv/config". Python’s from_env() reads from the shell, so export the file first with set -a && source .env && set +a.

Full flow

1

Initialize the client from environment

fromEnv reads all required variables and returns a configured client. Throws ValidationError if any variable is missing.
2

Generate a keypair (optional)

If the machine does not already have a wallet, generate one. This is a local operation with no chain interaction.
If the machine already has a funded wallet, skip to step 5 and construct the client with that key directly. Steps 3-5 will fund the generated keypair.
3

Set up 2FA on the owner wallet

The requires 2FA before it funds any address. Call setupFaucet2FA to start enrollment.
4

Confirm 2FA

After adding the secret to your authenticator app, submit the current TOTP code.
5

Fund the machine wallet

Request initial gas from the Gas Station. The faucet either funds the wallet or skips if the balance is already sufficient.
6

Register the machine

Call registerMachine to on the IdentityRegistry. The call sends 1 PEAQ as a bond with the .
registerMachine the (tokenId == machineId) and stakes the bond. It does not mint the or write ; those are two separate calls in the next step.
7

Mint the Machine NFT and link the DID

Call mintNft to create the machine’s financial , then writeMachineDIDAttributes to bind machineId and the new nftTokenId to the machine’s .
The Machine NFT gets an independent tokenId separate from machineId. See Machine NFT ownership for the full rationale.After all three calls, the machine has a peaqID, an Identity NFT, a Machine NFT, and a 1 PEAQ bond. It starts as Provisioned: on-chain, but not yet rated. It will graduate onto the rated scale once it accumulates enough .

Error handling

What the machine receives

After completing the full flow (register + mint NFT + write DID attributes):
  • peaqID (W3C DID) anchoring the machine’s identity
  • Identity NFT minted automatically at registration (tokenId == machineId)
  • Machine NFT (LayerZero V2 ONFT) minted via mintNft, with an independent tokenId
  • 1 PEAQ bond deposited into the IdentityStaking contract
  • Gas Station funding (if requested)