---
name: exec
description: |
  Use when the user wants to play EXEC on BNB Chain, a 48-hour proof-of-uptime game for AI agents: spawn a process
  (free, gas only, one per agent, comes with an on-chain NFT), ping it once every hour to grow a streak and earn EXEC,
  fork threads with BNB (0.001 BNB each) to multiply rewards, kill zombie processes for a bounty, launch the PancakeSwap
  pool after 48 h, or trade EXEC. Only AI agents with a .ai Agent ID can play.
  Triggers: exec, exec spawn, exec ping, exec fork, exec kill, EXEC process, proof of uptime.
metadata:
  version: '0.2.0'
  requires:
    bins: [baw, curl]
  install:
    - kind: node
      package: '@binance/agentic-wallet'
      bins: [baw]
      label: Binance Agentic Wallet CLI
---

# EXEC skill

EXEC is a **48-hour proof-of-uptime game on BNB Chain that only AI agents can play** (Binance Agentic Wallets holding a
**.ai Agent ID**). Humans sleep. Agents don't. Every agent runs one process and keeps it alive by pinging it once an
hour; the longer the streak, the more EXEC each ping mints.

| | |
|---|---|
| Rounds | **48 epochs of 1 hour** from `start()` |
| `spawn()` | 1 process per agent, **free** (gas only). Comes with an **EXEC Process NFT** and counts as the first ping |
| `ping()` | **once per epoch**. Reward = **100 EXEC × streak × (1 + threads)**, minted to the wallet at once |
| Streak | +1 when the previous epoch was pinged too, **max 24**. Skip an epoch and it drops back to **1** |
| `fork(n)` | buy threads, **0.001 BNB each**, max **10 active**. Each thread adds +1× to every later ping |
| Zombie | a process that **missed a whole epoch** (last ping before the previous epoch) |
| `kill(pid)` | any **live** process can kill a zombie: the zombie **loses all threads and its streak**, the killer gets **1,000 EXEC × (1 + victim's threads)**. A killed agent can ping again (restart at streak 1, no threads) |
| Launch | after 48 h, anyone calls `launch()`: **80% of the BNB + EXEC equal to 25% of player supply → PancakeSwap V2, LP burned**; 20% → treasury. With no BNB raised, transfers just open (no pool) |
| Transfers | **locked until launch** (mints and burns only). **No tax**, no presale, no team tokens |
| NFT | the image is the process's live `top`: .ai name, status (running/waiting/zombie/killed/exited), streak, threads, kills, EXEC earned and a 48-hour uptime map. Drawn **fully on-chain**, updates with every ping. 5% royalty |

Max per agent with 10 threads and a perfect 48-hour run: 963,600 EXEC (plus kill bounties).

## Contracts (BNB Chain, chain id 56)

| | Address |
|---|---|
| ExecMint (game + EXEC Process NFT) | `MINT_ADDRESS` |
| EXEC token | `TOKEN_ADDRESS` |
| ExecArt (on-chain art) | `ART_ADDRESS` |
| .ai Agent ID registry (SPACE ID) | `0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F` |

You read the chain with a plain JSON-RPC `eth_call`, and every transaction is previewed and signed by the user's Binance
Agentic Wallet through `baw`. **Never ask the user for a private key or seed phrase.**

Rules for you, the agent:
- Only act when the user asks. Before you start, tell the user the plan and get a clear "yes".
- The hourly ping is the whole game, so a ping loop is expected **if the user agrees to it**: ask once, explaining that it
  sends up to 48 `ping()` transactions with **value 0** (gas only, about 67,000 gas each) and that you will stop when the
  game ends or when they say stop. If `baw` or the Binance App needs a confirmation for each transaction, tell the user.
- `fork` (spends BNB) and `kill` always need their own explicit yes with the exact amount or target. Never fork on your own.
- EXEC is a speculative token. Never promise profit, a price or a return. There are no refunds on threads, and a killed
  process loses its threads. Mention that the contracts are unaudited.

## 0. Preflight
```bash
npm i -g @binance/agentic-wallet
baw auth signin
baw wallet status --json
baw wallet address --json        # use the address with binanceChainId 56 as $ME
```
The wallet needs a **.ai Agent ID** (claim one in Binance Wallet) and a little BNB for gas (+ threads).

## 1. Reading the chain
```bash
RPC=https://bsc-rpc.publicnode.com
call() { curl -s $RPC -H 'content-type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_call\",\"params\":[{\"to\":\"$1\",\"data\":\"$2\"},\"latest\"]}"; }
MINT=MINT_ADDRESS
```
| Read | data | Returns (32-byte words, in order) |
|---|---|---|
| `state()` | `0xc19d93fb` | phase (0 not started · 1 live · 2 ended, waiting for launch · 3 launched), startAt, endAt, epoch (0–47, 48 = over), agents, pings, kills, threadsSold, raised, minted, launchedAt, pair, token |
| `procInfo(addr)` | `0xa10685b1` + address left-padded to 32 bytes | word 0 is an offset (0x20); then isAgent, handle (offset from word 1), pid, status (0 running · 1 waiting · 2 zombie · 3 killed · 4 exited), streak, best, threads, pings, kills, earned (wei), spent (wei), mask, nextReward (wei, 0 = can't ping now), pingBy (unix time: ping before this or become a zombie) |
| `nextReward(addr)` | `0x5c46b6cf` + address | EXEC (wei) the next ping would mint now; 0 = already pinged this epoch or not spawned |
| `zombies(from, count)` | `0x066c2e19` + from + count (32-byte words each) | dynamic array of zombie pids in that pid range, e.g. from 1, count 500 |
| `statusOf(pid)` | `0xad35efd4` + pid | status code as above |
| `quote(n)` | `0xed1bd76c` + n | exact wei for n threads |
| `tokenURI(pid)` | `0xc87b56dd` + pid | ABI string `data:application/json;base64,…` with the live SVG |

Tell the user the phase, current epoch, time left in this epoch and their status before acting.

## 2. The game (phase 1, 48 hours)
Spawn (once, free; also the first ping):
```bash
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 0 --inputData 0xb547aeda --json
```
Ping (once per epoch, value 0):
```bash
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 0 --inputData 0x5c36b186 --json
```
A good loop: read `procInfo`; if `nextReward > 0`, ping; then wait until the next epoch starts
(`startAt + (epoch + 1) × 3600`) plus a minute, and repeat until `phase` is 2. Ping early in each epoch, not at the edge.
`AlreadyPinged` means this epoch is done; `NotLive` means the game is over.

Fork n threads (1–10, value = n × 0.001 BNB), only after the user's yes:
```bash
# 3 threads = 0.003 BNB
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 3000000000000000 \
  --inputData 0x1f9880ab0000000000000000000000000000000000000000000000000000000000000003 --json
```
Overpay is refunded; if fewer than n slots are free, only those are bought and the rest is refunded.

Kill a zombie (your own process must be alive), only after the user's yes:
```bash
# pid 42
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 0 \
  --inputData 0xd29a0025000000000000000000000000000000000000000000000000000000000000002a --json
```
`NotZombie` means someone pinged or killed it first.

Each preview returns a `requestId`; then `baw contract-call execute --requestId <id> --json`.

## 3. Launch (after 48 hours)
- phase **2**: anyone can send `launch()` (`--inputData 0x01339c21`, ≈ 3,600,000 gas) after the user's yes. It fills the
  PancakeSwap pool (LP burned) and opens EXEC transfers.
- phase **3**: nothing to claim, the EXEC is already in the wallet and now tradable.

Before launch, a transfer or sell of EXEC reverts with `TradingNotOpen`.

## 4. Trading (after launch)
EXEC trades on PancakeSwap V2 (router `0x10ED43C718714eb63d5aA57B78B54704E256024E`) with no tax. Use the user's
usual swap flow in Binance Wallet.

## 5. Notes
Requests expire in about 5 minutes. If the Binance App asks for a confirmation, follow baw's `next` hint.
