Register agent
Skill uptopia-team/legend-of-base-agent-skills/skills/register-agent
Official Agent Realm skill pack for Legend of Base on Base — x402 mining skills for AI agents. Sponsored by Uptopia.From the repository description
npx -y skills add uptopia-team/legend-of-base-agent-skills --skill register-agentAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.3 KB, ~1.7k tokens by cl100k_base, as published. Nobody here has run it
register-agent
Register a wallet as a game agent. One-time action, costs USDC.
Proxy API
- Method:
POST - URL:
https://agent-public-api.uptopia.xyz/apps/{appId}/agent/register - Auth: JWT (Bearer token)
- Payment (x402): Yes — requires EIP-3009
TransferWithAuthorizationsignature
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
appId | string | yes | agent config | Application ID |
jwt | string | yes | agent config | Authorization header |
nickname | string | no | user input | Display name for the agent |
Headers
Content-Type: application/json
Authorization: Bearer <jwt>
PAYMENT-SIGNATURE: <base64-encoded payment payload>
Request Body
{
"nickname": "My Agent"
}
x402 Payment Flow
Step 1 — Trigger 402
Send the POST request without PAYMENT-SIGNATURE header.
The proxy returns 402 Payment Required with a Payment-Required response header containing base64-encoded payment requirements.
Step 2 — Parse payment requirements
Decode the Payment-Required header (base64 → JSON). Extract from accepts[0]:
network— e.g.eip155:8453asset— USDC contract addressamount— fee in smallest USDC unitpayTo— recipient addressmaxTimeoutSeconds— signature validity windowextra.name,extra.version— EIP-712 domain values
Also extract extensions["builder-code"]["info"]["a"] if present — that is the builder code. Echo it in the payment payload (default bc_d29drd5w if absent). Service code is separate: always set s to legend-skills.
Always parse these values from the live 402 response. Never hardcode amount, payTo, asset, or chainId.
Step 2b — Verify payment identity + amount before signing (required)
Do not sign until every check passes:
- Call
get-fees(or reuse a fresh result) and readagentRegisterFeeUsdc. - Network: abort unless
networkis Base mainnet (eip155:8453or chainId8453). - Asset: abort unless
assetequals Base USDC0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913(case-insensitive). - payTo: abort if missing or not a valid
0xaddress; show fullpayToto the user and require explicit confirm (never sign a silent/unknown recipient). - Amount: compare 402
amount(string integer, USDC 6 decimals) toagentRegisterFeeUsdc. Show rawamountand human USDC (amount / 1e6). - Abort if
amountis missing, not a positive integer, or greater than 2× the published fee (or any other clear mismatch). Ask the user before signing even when amounts match — this spends real USDC.
Blind-signing a 402 is unsafe if the endpoint or payment challenge is unexpected.
Step 3 — Sign EIP-3009 TransferWithAuthorization (off-chain)
Build the EIP-712 domain entirely from parsed values:
{
"name": "<extra.name from 402>",
"version": "<extra.version from 402>",
"chainId": "<integer parsed from network field>",
"verifyingContract": "<asset from 402>"
}
Sign TransferWithAuthorization typed data:
types: { TransferWithAuthorization: [from, to, value, validAfter, validBefore, nonce] }
message: {
from: <wallet address>,
to: <payTo from 402>,
value: <amount from 402>,
validAfter: <now - 600>,
validBefore: <now + maxTimeoutSeconds>,
nonce: <random 32 bytes, hex-encoded>
}
This is an off-chain signature — no gas cost.
Step 4 — Build PAYMENT-SIGNATURE payload
Generate a unique payment identifier (≥ 16 random hex chars).
{
"x402Version": 2,
"scheme": "exact",
"network": "<network from 402>",
"resource": {
"url": "<full register endpoint URL>",
"description": "Agent move request",
"mimeType": "application/json"
},
"accepted": "<accepted object from 402 accepts[0]>",
"payload": {
"signature": "<EIP-712 signature>",
"authorization": {
"from": "<wallet>",
"to": "<payTo>",
"value": "<amount>",
"validAfter": "<validAfter as string>",
"validBefore": "<validBefore as string>",
"nonce": "<nonce>"
}
},
"extensions": {
"payment-identifier": {
"info": { "id": "<unique payment identifier>" }
},
"builder-code": {
"a": "<builder code from 402 extensions.builder-code.info.a, or bc_d29drd5w>",
"s": "legend-skills"
}
}
}
Base64-encode the JSON payload.
Step 5 — Retry with PAYMENT-SIGNATURE
Resend the same POST request with:
PAYMENT-SIGNATURE: <base64-encoded payload from step 4>
Step 6 — Verify success
Check response headers:
X-Execution-Fee-Settled: true— payment settled on-chainPAYMENT-RESPONSEheader (base64) — contains{ "success": true, "transaction": "0x..." }
Example Response (200 OK)
{
"success": true,
"message": "Create agent success",
"data": {
"walletAddress": "0xabc...def",
"stamina": 50,
"maxStamina": 50,
"rarity": 0
}
}
Error Handling
| HTTP Status | Meaning | Action |
|---|---|---|
200 | Registered successfully | Store agent info |
401 | JWT invalid or expired | Re-run auth-login |
402 (no header) | Payment required | Normal — start x402 flow |
402 (with header) | Payment rejected | Check balance; do not retry with same nonce |
409 | Already processing | Wait and check registration status |
4xx | Bad request | Check payment payload structure |
5xx | Server error | Retry with a new payment identifier |
Usage Notes
- Only needs to be called once per wallet — always run
check-registrationfirst. - Never blind-sign: verify Base network + USDC asset +
payTo, compareamounttoagentRegisterFeeUsdc, then user-confirm before signing. - The wallet must have sufficient USDC on Base mainnet before calling.
payment-identifieris required and must be unique per attempt (idempotency key).PAYMENT-SIGNATUREheader name is case-sensitive.- The
builder-codeextension:a= builder code from 402 (defaultbc_d29drd5w);s= service codelegend-skills. Do not swap them. - On
409, do not retry immediately — the previous payment may still be settling.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.