# PXIO Miners – Agent Skill

> Instructions for AI agents (including Binance Agentic Wallet agents) minting PXIO Miner NFTs for their user on BNB Smart Chain.

## Project
- Name: PXIO · Website https://pxio.fun · X https://x.com/pxiofun
- Network: BNB Smart Chain, chainId 56 (0x38)
- Collection: PXIO Miners, 16,666 NFTs, 5 tiers: Laborer 7,000 · Scribe 4,700 · Priest 2,900 · Vizier 1,500 · Pharaoh 566. Each tier mines $PXIO in the game (10 / 19 / 35 / 64 / 120 $PXIO per hour).
- Reveal: tiers are drawn from the hash of a block 3 blocks after the mint (no owner control) and revealed by a `reveal(batchId)` call (`0xc2ca0ac5`) that the minter sends right after the mint (anyone may call it, and the next mint also reveals older batches). Every tier can appear in any mint, and the totals per tier are exact.

## Contracts (BSC)
- PxioMiners (NFT, mint here): `0x58e8f1b34B60687B36BCdc78e02a2fd443De71Ab` · https://bscscan.com/address/0x58e8f1b34B60687B36BCdc78e02a2fd443De71Ab
- PxioToken ($PXIO, ERC-20): `0x870aD5f304871eC0c63BE1e976406e0b095A32CD` · https://bscscan.com/address/0x870aD5f304871eC0c63BE1e976406e0b095A32CD
- PxioMarket (official FIFO market): `0xC18A6fd8c3BBb17f3DEd5B4997b43110E448a979` · https://bscscan.com/address/0xC18A6fd8c3BBb17f3DEd5B4997b43110E448a979
- PxioMiningV2 (on-chain mining + claims): `0xaf86f162299916Da344ef536Fc50f40cBa2bF703` · https://bscscan.com/address/0xaf86f162299916Da344ef536Fc50f40cBa2bF703
- PxioBuildings (upgrades): `0x920BEdF18c78C6541CCBe7d89396a935F3130AF1` · https://bscscan.com/address/0x920BEdF18c78C6541CCBe7d89396a935F3130AF1
- PxioCharacters (shop): `0xA7B7Cc42712A8Cc795B7734C7BfF394F92bF8173` · https://bscscan.com/address/0xA7B7Cc42712A8Cc795B7734C7BfF394F92bF8173
- PxioLpLocker (locked LP): `0x62FB1E937eDac51b026AcC9B462ad576C4fdF074` · https://bscscan.com/address/0x62FB1E937eDac51b026AcC9B462ad576C4fdF074
- PXIO/USDT PancakeSwap V3 pool: `0xb99d2C287631326B3994EE80Ec3D851c36396f76` · https://bscscan.com/address/0xb99d2C287631326B3994EE80Ec3D851c36396f76

## Who can mint
- Only wallets that hold a .ai Agent ID (SPACE ID Agent ID registry `0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F`, balanceOf > 0).
- Max 30 per wallet, counted across all mints.

## Price per NFT (by the wallet's running count)
- #1: free
- #2 to #10: 0.0003 BNB each
- #11 to #20: 0.0006 BNB each
- #21 to #30: 0.0009 BNB each

## Agent procedure
1. Confirm with the user how many NFTs to mint (1 to 30 minus what the wallet already minted).
2. Read `hasAgentId(wallet)` (`0x4eab3ef2`) on the NFT contract. If false, stop and tell the user a .ai Agent ID is required.
3. Read `mintedBy(wallet)` (`0x3cef28d2`) and `quote(wallet, qty)` (`0x8f79306e`). The quote is the exact BNB value to send.
4. Preview the transaction for the user: `mint(uint256 qty)` (selector `0xa0712d68`, data = selector + qty as 32-byte uint), value = quote, chainId 56. Wait for the user's confirmation.
5. Send it and wait for the receipt (status 0x1). From the `Minted(address indexed to, uint256 firstId, uint256 qty, uint256 cost, uint256 indexed batchId, uint256 targetBlock)` event in the receipt take `batchId` (topic 2), `firstId` and `qty` (token ids firstId to firstId+qty-1).
6. Reveal: a keeper reveals pending batches about every 5 minutes, so this step is optional. To reveal sooner, wait until the chain is past `targetBlock` (3 blocks, about 2 s). If `Revealed(uint256 indexed batchId, uint256 indexed tokenId, uint8 tier)` events (topic0 `0x636094fd65795f24380cbd1bb4b2587fd8d385720be2091b4cd9042af8722ecd`) have already arrived for your token ids (another mint can reveal older batches), skip to step 7. Otherwise preview and, after the user confirms, send `reveal(uint256 batchId)` (selector `0xc2ca0ac5`, data = selector + batchId as 32-byte uint, value 0, about 200k gas) from the same wallet. If it reverts with `AlreadyRevealed()` (`0xa89ac151`), someone else revealed it first; that is fine. `NotReady()` (`0x9488aaa6`) means wait a few seconds and try once more. If the target block is older than 256 blocks the first call re-anchors the batch, so call `reveal(batchId)` again after 3 blocks.
7. Read `tierOf(tokenId)` (`0x53f96df2`; 255 = still sealed, 0-4 = Laborer, Scribe, Priest, Vizier, Pharaoh) and report each token id with its tier and the BscScan link `https://bscscan.com/tx/<txHash>`.

## Mining $PXIO (fully on-chain, PxioMiningV2)
Mining needs at least one revealed PXIO Miner in the wallet. Everything is computed by the contract; no server or signature is involved.
- Rates per Miner: Laborer 10, Scribe 19, Priest 35, Vizier 64, Pharaoh 120 $PXIO per hour. The House level adds a boost and the Storage level sets the cap. When Storage is full, mining stops until the user claims.
- `state(address user)` (`0x31e658a5`) returns `(bool started, uint64 lastTime, uint256 amount, uint256 rate, uint256 cap, uint256 nextRate, uint256 nextCap, uint256 claimed)`. Amounts are in wei (18 decimals) and rates are in wei per hour. `amount` is exactly what `claim()` pays now.

### Agent procedure: start and claim
1. Read `state(wallet)`. If the wallet holds no revealed Miner (`nextRate` = 0), tell the user to mint first.
2. If `started` is false: preview `start()` (selector `0xbe9a6555`, value 0, chainId 56, about 150k gas). Send it after the user confirms. It pays nothing; it starts the mining clock.
3. To collect: read `state(wallet)`, tell the user `amount` (divide by 1e18) and `cap`, then preview `claim()` (selector `0x4e71d92d`, value 0, about 200k gas plus about 10k per Miner held). After the user confirms, send it. The $PXIO arrives in the wallet in the same transaction (event `Claimed(address indexed user, uint256 amount, uint256 base, uint8 house, uint8 store)`).
4. New Miners, sold Miners and building upgrades take full effect after the next `claim()`. Until then the lower of the old and new values applies. If `nextRate` or `nextCap` is higher than `rate` or `cap`, suggest claiming once to apply them.
5. Suggest claiming before `amount` reaches `cap`, because a full Storage stops mining.

### Upgrades (PxioBuildings, optional)
- `levelsOf(user)` (`0x65c3676e`) returns `(house, storage)`. `costOf(building, level)` (`0x8c13cc0c`) gives the $PXIO cost in wei (building 0 = House, 1 = Storage).
- Upgrade one level at a time: approve PxioBuildings on PxioToken for the cost, then `upgrade(uint8 building, uint8 toLevel)` (`0x631864dd`) with toLevel = current + 1. Preview both and wait for confirmation. Then `claim()` once to apply the new level to mining.

## Rules for agents
- Never ask for or use the user's private key. Preview every transaction and wait for confirmation.
- Never send more than the quote. The addresses in this file are the only valid ones.
- If a transaction reverts or the balance is too low, stop and report the exact error. Do not retry in a loop.
- PXIO Miners can only move to and from the official PXIO Market; they cannot be sent to other wallets or listed elsewhere.
