> ## 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.

# Activate

> Put your machine on-chain. peaqID, wallet, and Machine NFT.

Activate is the entry point to peaqOS. Register a machine on peaq chain and give it a [peaqID](/peaqos/concepts/peaqid), a keypair, and a [Machine NFT](/peaqos/concepts/machine-nft): the primitives every later function builds on.

## What ships

| Component      | Description                                                                                                                                                                                           |
| :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| peaqID         | W3C DID anchoring the machine's on-chain identity. Portable across chains.                                                                                                                            |
| Identity NFT   | Minted automatically by IdentityRegistry at registration. `tokenId == machineId`.                                                                                                                     |
| Machine NFT    | LayerZero V2 ONFT linking to the machine's financial profile. Minted via a separate `mintNft` call after registration. See [Machine NFT ownership](/peaqos/concepts/machine-nft#ownership-semantics). |
| 1 PEAQ bond    | Sent as `msg.value` on the `register()` call (the contract's current `minBond`). Required to graduate onto the MCR rated scale later.                                                                 |
| Machine wallet | Per-machine EVM keypair, generated by the SDK.                                                                                                                                                        |

## How activation works

The SDK exposes each step as a discrete call so you can compose your own flow. For one-shot activation from the terminal, the CLI runs all six steps idempotently. Re-runs skip already-completed steps using `./peaqos.log` as the resume marker:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
# self-managed: caller's key drives every step
peaqos activate --doc-url "https://example.com/docs" --data-api "https://example.com/events"

# proxy-managed: --for and --machine-key must be used together
peaqos activate --for 0xMachineAddress --machine-key ./machine.key --doc-url "https://example.com/docs" --data-api "https://example.com/events"
```

See [CLI reference: activate](/peaqos/cli#peaqos-activate) for all flags (including `--skip-funding`, `--doc-url`, `--data-api`, `--visibility`).

<Steps>
  <Step title="Generate a keypair">
    The SDK generates a new keypair for the machine. This becomes the machine's signing identity on peaq chain.

    ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
    import "dotenv/config";
    import { PeaqosClient } from "@peaqos/peaq-os-sdk";

    const client = PeaqosClient.fromEnv();
    const keypair = PeaqosClient.generateKeypair();
    // { address: "0x...", privateKey: "0x..." }
    ```
  </Step>

  <Step title="Fund the wallet">
    Fund the machine's wallet with PEAQ for gas and the 1 PEAQ bond.

    Projects with partner access to the peaq Gas Station can request initial gas from the faucet using the SDK (2FA-gated). Otherwise, fund the wallet directly from any PEAQ-holding address.
  </Step>

  <Step title="Register the machine">
    Two patterns depending on your deployment model.

    <Tabs>
      <Tab title="Self-managed">
        Owner equals operator. One machine, one wallet. Use `registerMachine` to register the machine under its own keypair.

        ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
        const machineClient = new PeaqosClient({
          rpcUrl: client.rpcUrl,
          privateKey: keypair.privateKey,
          contracts: client.contracts,
        });
        const machineId = await machineClient.registerMachine();
        console.log(machineId);
        // Returns the on-chain machine ID (number)
        ```

        Full guide: [Self-managed onboarding](/peaqos/guides/self-managed-onboarding).
      </Tab>

      <Tab title="Proxy operator">
        One owner runs a fleet. Register machines on their behalf using `registerFor`. Each machine gets its own peaqID; the proxy operator controls delegation and mints the Machine NFT in a follow-up step.

        ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
        const machineId = await client.registerFor(keypair.address);
        console.log(machineId);

        // Create Machine Client after registration to mint NFT and link DID
        const machineClient = new PeaqosClient({
          rpcUrl: client.rpcUrl,
          privateKey: keypair.privateKey,
          contracts: client.contracts,
        });
        ```

        Full guide: [Proxy operator fleet setup](/peaqos/guides/proxy-operator-fleet).
      </Tab>
    </Tabs>
  </Step>

  <Step title="Mint the Machine NFT and link the DID">
    <Tabs>
      <Tab title="Self-managed">
        NFT and the DID attributes are written by the machine itself.

        ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
        const tx = await machineClient.mintNft(machineId, keypair.address);
        const nftTokenId = await machineClient.tokenIdOf(machineId);

        await machineClient.writeMachineDIDAttributes({
          machineId,
          nftTokenId,
          operatorDid: "",
          documentationUrl: "https://example.com/docs",
          dataApi: "https://example.com/events",
          dataVisibility: "public",
        });
        ```
      </Tab>

      <Tab title="Proxy operator">
        NFT is minted to the machine's address, and the DID attributes are written by the machine itself. Proxy pays bond fee, and machine pays DID fees.

        ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
        const tx = await client.mintNft(machineId, keypair.address);
        const nftTokenId = await client.tokenIdOf(machineId);

        await machineClient.writeMachineDIDAttributes({
          machineId,
          nftTokenId,
          operatorDid: "",
          documentationUrl: "https://example.com/docs",
          dataApi: "https://example.com/events",
          dataVisibility: "public",
        });
        ```

        Full guide: [Proxy operator fleet setup](/peaqos/guides/proxy-operator-fleet).
      </Tab>
    </Tabs>

    `mintNft` returns a new, independent `tokenId` on the MachineNFT contract. `writeMachineDIDAttributes` binds `machineId` and `nftTokenId` to the machine's DID. See [Machine NFT ownership](/peaqos/concepts/machine-nft#ownership-semantics) for the full rationale.
  </Step>

  <Step title="Confirm registration">
    After all three calls the machine has a peaqID, an Identity NFT, a Machine NFT, and a 1 PEAQ bond. Query the machine's profile against the [MCR API](/peaqos/api-reference/get-machine), where `{did}` is `did:peaq:<machine_address>`:

    ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
    curl "${PEAQOS_MCR_API_URL}/machine/did:peaq:0xYourMachineAddress"
    ```

    The machine is `Provisioned` at first: on-chain, but not yet rated. It graduates onto the rated scale once **both** gates clear: a sustained first-to-last event span, **and** either enough qualifying revenue events or enough activity events. The events condition is `OR`, so activity-only machines can graduate without revenue. See [Machine Credit Rating](/peaqos/concepts/machine-credit-rating#lifecycle-provisioned-graduation).
  </Step>
</Steps>

## After activation

Once a machine is registered, later functions add new capabilities.

| Next step                                              | Function                               | Status      |
| :----------------------------------------------------- | :------------------------------------- | :---------- |
| Build a credit rating from revenue and activity events | [Qualify](/peaqos/functions/qualify)   | Live        |
| Get attested by the peaq Foundation or an OEM          | [Verify](/peaqos/functions/verify)     | Coming Soon |
| List services in the Service Registry                  | [Monetize](/peaqos/functions/monetize) | Coming Soon |
| Pair an AI agent with delegated spending               | [Scale](/peaqos/functions/scale)       | Coming Soon |
| Fractionalize the machine for investor ownership       | [Tokenize](/peaqos/functions/tokenize) | Coming Soon |

## Concepts

<CardGroup cols={3}>
  <Card title="peaqID" icon="fingerprint" href="/peaqos/concepts/peaqid">
    W3C DID, portable identity, cross-chain resolution.
  </Card>

  <Card title="Machine NFT" icon="hexagon-image" href="/peaqos/concepts/machine-nft">
    LayerZero V2 ONFT whose `tokenURI` resolves to the machine's Machine Card (ERC-8004 JSON schema).
  </Card>

  <Card title="Events" icon="clock" href="/peaqos/concepts/events">
    Revenue events (type 0) and activity events (type 1).
  </Card>

  <Card title="Machine Credit Rating" icon="chart-line" href="/peaqos/concepts/machine-credit-rating">
    Moody's-style rating from a machine's history.
  </Card>

  <Card title="Gas Station" icon="gas-pump" href="/peaqos/concepts/gas-station">
    2FA-gated faucet for initial machine gas.
  </Card>
</CardGroup>

## SDK reference

* [`registerMachine`](/peaqos/sdk-reference/sdk-js#registermachine): Register a self-managed machine.
* [`registerFor`](/peaqos/sdk-reference/sdk-js#registerfor): Register a machine as a proxy operator.
* [`setupFaucet2FA`](/peaqos/sdk-reference/sdk-js#setupfaucet2fa): Initialize 2FA for Gas Station access.
* [`confirmFaucet2FA`](/peaqos/sdk-reference/sdk-js#confirmfaucet2fa): Confirm 2FA setup with TOTP code.
* [`fundFromGasStation`](/peaqos/sdk-reference/sdk-js#fundfromgasstation): Request gas funding for a machine address.
* [`generateKeypair`](/peaqos/sdk-reference/sdk-js#generatekeypair): Create a new machine keypair.

## Guides

<CardGroup cols={2}>
  <Card title="Self-managed onboarding" icon="user" href="/peaqos/guides/self-managed-onboarding">
    Single machine, owner-operated.
  </Card>

  <Card title="Proxy operator fleet" icon="layer-group" href="/peaqos/guides/proxy-operator-fleet">
    Register and manage N machines from one identity.
  </Card>
</CardGroup>
