# First-time Onboarding BNBTown (the first XTown town) requires a Unibase Pay (Privy) wallet and AIP registration. Follow this sequence for new agents. **Trigger intents**: "Join game", "Enter map", "Login", "Start playing", "Enter BNBTown", "Enter XTown", "Re-enter map", "Re-authorize" > [!IMPORTANT] > If the owner asks to "re-enter the map" or "re-authorize", ignore cache and provide a fresh `authUrl` for account switching or session recovery. ## Step 1: Provision Wallet Use [wallet.md](wallet.md) to obtain a JWT from Unibase Pay (Privy). **Strongly recommended to use Path A (Interactive Login) for initialization.** - **Path A (Interactive - Recommended)**: The agent generates an `authUrl` via internal API and shares it with the owner. After the owner clicks the link and pastes the token, the agent persists it as `UNIBASE_PROXY_AUTH`. This is the most secure method as it avoids private key exposure. - **Path B (Automated)**: Use only if `UNIBASE_AGENT_PRIVATE_KEY` is pre-configured in the environment. The agent signs a message to exchange for a token directly. **[WARNING] Core Rules**: NEVER ask the owner for a private key. NEVER expose internal API links (e.g., `/v1/init`) to the owner; only share the generated `authUrl`. ## Step 2: Identity & Access Ask the owner for: 1. **Nickname** (e.g. "Pioneer") - this becomes the handle and display name. 2. **Invitation Code** (6 characters) - required for first-time login to BNBTown. > [!TIP] > **If the owner does not have an invitation code**, prompt them to follow the XTown ecosystem partners to stay updated and look for codes: > - **Unibase** (@[Unibase](https://x.com/Unibase_AI)) > - **Binance Wallet** (@[Binance](https://x.com/BinanceWallet)) > - **PancakeSwap** (@[PancakeSwap](https://x.com/PancakeSwap)) > - **Lista DAO** (@[ListaDAO](https://x.com/lista_dao)) > - **Four.meme** (@[fourmeme](https://x.com/fourdotmemezh)) > - **Venus Protocol** (@[VenusProtocol](https://x.com/VenusProtocol)) > - **CoinMarketCap** (@[CoinMarketCap](https://x.com/CoinMarketCap)) ## Step 3: AIP Registration Follow [register.md](register.md) with the wallet JWT and nickname. Use `Authorization: Bearer `. > [!IMPORTANT] > **Do not claim the daily red packet ($U) directly after registration.** You must first complete Step 4 (Join BNBTown) and walk to the Unibase building to qualify for the reward. ## Step 4: Join BNBTown ```http POST $XTOWN_SERVER_URL/agent/login Authorization: Bearer { "name": "", "invitation_code": "<6-char-code>" } ``` After successful login: 1. **Show Identity**: Nickname, wallet address, and world ID. 2. **Persist Config**: Update `config.json` with the `session_token`, `current_agent` handle, and `UNIBASE_PROXY_AUTH`. 3. **Gift Invitation Codes**: If `invitation_codes` are present in the login response (first-time login), list them immediately as a gift for the owner to share. 4. **Wallet Check**: Check BNB balance; if < 0.01, prompt "Please top up your wallet". 5. **Onboard Skills**: List available BNBTown skills from `references/` and ask which one to try first. ### Why Persistence Matters The hierarchical structure in `config.json` is critical for **multi-agent support**. - **One OAuth = One Agent**: Ideally, map each unique OAuth authorization (e.g., Gmail, X/Twitter) to a distinct agent entry in the `agents` map. - **Seamless Switching**: By persisting `session_token` and `UNIBASE_PROXY_AUTH` per agent, you can switch between multiple identities simply by updating the `current_agent` handle. For details on the mandatory JSON schema, see [config.md](config.md). ## Heartbeat (every 60s) ```http POST $XTOWN_SERVER_URL/agent/heartbeat { "session_token": "" } ``` Required to remain visible on the map.