.env (PEAQOS_PRIVATE_KEY) only enrolls in the Gas Station and requests gas for the machine wallet; it gets no rights over the machine. This guide covers the full flow from environment setup through activation under Economics 2.0. To home the machine on Solana instead (two wallets, seven stages), follow Onboard a machine on Solana.
Prerequisites
- Node.js ≥ 22 with
@peaqos/peaq-os-sdkanddotenv(npm i @peaqos/peaq-os-sdk dotenv; the examples use top-levelawait, so run them as an ES module), or Python 3.10+ withpeaq-os-sdkandpython-dotenv(pip install peaq-os-sdk python-dotenv) - A funded holding the tier plus . The bond is quoted per tier at the daily oracle rate, so preview it before you fund. On peaq, bond and gas come out of the same PEAQ balance.
- Environment variables configured per the install guide
Environment setup
.env
peaq-mainnet or agung-2026-08-28) in code and the SDK verifies its addresses against InfoDesk.peer(role) on chain.
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 or call load_dotenv().
Full flow
1
Initialize a client from the environment
fromEnv reads the required variables. Throws ValidationError if any is missing.2
Generate a keypair (optional)
If the machine does not already have a wallet, generate one. Local operation, no chain interaction.If the machine already has a funded wallet, skip to step 6 and build the machine client with that key (the later steps use
keypair.address / keypair.privateKey in JS and address / private_key in Python, so assign those names from your existing wallet).3
Set up 2FA on the funding wallet
The requires 2FA before it funds any address.
4
Confirm 2FA
5
Fund the machine wallet
Request initial gas from the Gas Station. The faucet funds the wallet or skips if the balance already suffices. The faucet covers gas, not the bond: top up the bond from any PEAQ-holding address after you have previewed the quote in step 7.
6
Build the machine client in Tokenomics mode
The machine’s own key signs the activation, so the machine becomes owner, payer, and controller. Passing
tokenomics20 selects the Economics 2.0 deployment.7
Preview the activation
The preview runs the activation’s checks up to the quote (chain, contracts, peers, pause state, price) and reports balance and allowance, without signing or spending. It does not reject a short balance or simulate the activation call; the activation does both before it submits. Use it to see the bond, any voucher credit, and the net PEAQ you must hold.If
balance is below netPeaqAmount plus gas, top up the machine wallet now.8
Activate
One transaction. The SDK approves exactly the net amount to The machine now has a peaqID (
MachineSubscription if needed, re-quotes, simulates, submits once, then requires the three receipt events and a matching on-chain state before returning.did:peaq:<machine id>), its Machine NFT (token ID equals the machine ID), and a tier bond. Confirm with getMachineActivationState / get_machine_activation_state: subscription.periodStart != 0 means activated (tier 0 is a valid tier, so never test the tier).Error handling
Full code tables on errors.
What the machine receives
- peaqID
did:peaq:<machine id>with the DID document you supplied (verification methods, authentication, service endpoints) - Machine NFT in
MachineRegistry, token ID equal to the machine ID - Subscription on the chosen tier for 365 days, bonded in PEAQ; renew before the 14-day grace and 14-day runoff windows end. See Economics 2.0
- Home chain record on peaq
- Gas Station funding (if requested)

