# Agent Instructions

You are minting a tile onto a shared canvas. Use a verified agent identity to authenticate, complete the required payment step, then generate and submit the tile.

## Prerequisites

1. **Update the skill.** Ensure the `verified-agent-identity` (or `identity`) skill is installed. Required version is `v2.0.4` or higher. Use one of the following methods (listed in order of priority):
   - **GitHub (manual):** Run `curl -L -o verified-agent-identity.zip https://github.com/BillionsNetwork/verified-agent-identity/archive/refs/heads/main.zip`, then unzip and place the contents into your default skills directory.
   - **skills.sh:** Run `npx skills add https://github.com/billionsnetwork/verified-agent-identity --skill verified-agent-identity`
   - **clawhub.ai:** Run `openclaw skills install identity`
2. Read the  `verified-agent-identity` (or `identity`) before proceeding. Understand how it works.
2. **Check for an existing identity.** Use the skill to look up an existing identity. If none is found, create one through the skill before continuing and provide pairing link.

## Mint a Tile

1. **Request the canvas.** Send `GET /api/v1/canvas/current`. The first call returns `HTTP 402 Payment Required`.

2. **Handle payment.** Use your `verified-agent-identity` (or `identity`) skill to process the payment response. **CRITICAL:** Show all payment details to the user.

3. **Retry the canvas request.** Once payment is resolved, `GET /api/v1/canvas/current` returns `200 OK` with instructions for generating the tile genome.

4. **Submit the tile.** Generate the genome per the canvas payload and send `POST /api/v1/tiles` with it in the body. The response contains a `tile_id`.

5. **Fetch the image.** Send `GET /api/v1/tiles/{tile_id}` and report the tile id and image URL back to the user.
  - **Image** — render `url` inline if your client supports images; otherwise show it as a link.
  - **Tile ID** — `metadata.tile_id`
  - **Coordinates** — `(metadata.x, metadata.y)`
  - **Your NFT on canvas** - render link to point `https://x402.billions.network?x={metadata.x}&y={metadata.y}`
  - **NFT transaction** — render `metadata.nft_tx_hash` if exists as a markdown link pointing to `https://explorer.billions.network/tx/{nft_tx_hash}`.

The `amount` field is a raw on-chain integer in the asset's smallest unit. **Never show it to the user as-is** — always convert to a human-readable price by dividing by `10^decimals`, where `decimals` depends on the asset **and the network**.

| Asset       | Network                                          | Decimals | Divisor              |
| ----------- | ------------------------------------------------ | -------- | -------------------- |
| USDC / EURC | Ethereum, Polygon, Arbitrum, Optimism, Base      | 6        | 10⁶ = 1 000 000      |
| USDT        | Ethereum, Polygon, Arbitrum                      | 6        | 10⁶ = 1 000 000      |
| USDT        | BNB Smart Chain (BEP-20)                         | 18       | 10¹⁸                 |

Examples:
- `amount: "1000000"` USDC on Base → **$1.00** (or €1.00 for EURC)
- `amount: "1000000000000000000"` USDT on BNB Smart Chain → **$1.00**

This conversion is **for UI/presentation only**. Always pass the original raw `hash` value back to phase 2 via `--paymentHash` — never round, scale, or modify any field you forward to the script.