Skip to Content
X404 Protocol docs
Official documentation/ SOCIAL PROTOCOL
X404 · Official documentation v1

Profiles & Metadata

Data structure, URIs, and security presentation.

Profile interface#

Fresh deployments from 2026-10-24: Recruit 100 (default admission mining power, configurable per game) → Warrior 300 → Chief 2,700 → Retirement 8,100 mining power, paid on each actual milestone, totaling 11,200 per full cycle at the default. Later paid cycles earn real promotions again. Free seed warriors receive no admission or initial warrior reward. Taking over a seat (paid takeover or accepted transfer) pays the admission and warrior amounts on that seat's first handover (after an accepted transfer, once the new holder fills the seat); later paid takeovers pay only admission and later transfers pay nothing. Replacement is not retirement.

All mining power uses this game’s 6-decimal Honor.goldBalance ledger. Admission, promotion, retirement and the once-only profile reward increase lifetime combat power. Tasks, wars, sales and ordinary extensions only credit mining power. Spending never reduces power. Country creation/joining cost 10,000 / 20 mining power. Initial prestige imports lifetime power; leaving removes it and rejoining imports it once again.

Each game has its own mining power redemption pool. Availability, claim times and actual redemption results are determined by the game page and on-chain transactions.

ts
const profile = await social.profile(account);
const tx = await social.setProfile('ipfs://YOUR_CID', 1000n, 'alice');
await tx.wait();

setProfileReceive metadataURI and followerLimit, setProfileWithUsernameAdditional username updates in the same transaction. URI must contain 1–2048 UTF-8 bytes; 0 followerLimit means unlimited number of followers, and non-zero value cannot be less than the number of existing followers.

Metadata structure#

json
{
  "name": "Alice",
  "description": "Community creator",
  "image": "ipfs://avatar-cid",
  "properties": {
    "website": "https://my-app.example",
    "twitter": "alice",
    "discord": "alice.community",
    "telegram": "alice"
  }
}

metadataURICan point to IPFS, HTTPS or data URI. SDK'smetadataURI()Generate an inline JSON URI and check the encoded 2048-byte limit. Larger data is placed in its own metadata service or IPFS.

Display and reading strategies#

The contract stores the URI and does not verify the JSON it points to for the application team. The front end renders the display name, introduction, and post as text and does not execute HTML. Images and external links follow your own domain name and content strategy.

When the background obtains the HTTPS URI provided by the user, it is necessary to prevent SSRF: restrict the protocol, resolved address, redirection, response size and timeout, and block intranet and cloud metadata addresses. The Go SDK does not actively request these URIs.

ProfileRegisteredAssign identity; ProfileUpdatedProvide account, URI and fan caps; UsernameUpdatedProvide preceding and following usernames; standardURIEvent maintenance ERC-1155 metadata. Business indexes use these semantic events to avoid double counting of standard and business events.

Structured profiles and completion status#

UsesetProfileDetails stores directly queryable fields. Display name and avatar are required for completion; biography, website and social accounts are optional. It also generates JSON metadata compatible with the profile page.

ts
import {PROFILE_FIELDS} from '@x404/sdk';
await (await social.setProfileDetails({
  name: 'Alice', avatar: 'ipfs://YOUR_AVATAR_CID', bio: '社区开发者',
  website: 'https://my-app.example', twitter: '', discord: '', telegram: '',
}, 0n, 'alice')).wait();
const details = await social.profileDetails(account);
const completion = await social.profileCompletion(account);
const required = PROFILE_FIELDS.name | PROFILE_FIELDS.avatar;
const complete = (completion.fields & required) === required;

The Go equivalent is ProfileDetails / SetProfileDetails / ProfileCompletion. Bitmap values are name=1, avatar=2, bio=4, website=8, twitter=16, discord=32 and telegram=64. firstCompletedAt records the first completion time and is never cleared. Check fields to determine current completeness; the historical timestamp alone is insufficient. revision increases on every edit.

ProfileDetailsUpdated includes the current fields, changedFields for this edit, firstCompletion and the first completion time. firstCompletion is true only for the transaction that first completes the profile. The backend processes rewards using confirmed events and state at the corresponding historical block; applications handle deduplication and reorg rollback. This Hook consists of events and state queries, not arbitrary third-party callbacks during profile saving.

The legacy setProfile / setProfileWithUsername writes an opaque URI and clears current structured-field status while retaining the historical first completion time. The profile must be saved again through setProfileDetails to satisfy current completeness requirements. External links and social fields are entered by the wallet holder; they do not prove OAuth ownership, unique personhood or that a URI is reachable.

On My profile, select Edit profile to open a drawer from the right immediately on desktop and mobile. On phones it fills the screen, so there is no need to scroll down the page to find the editor. Scroll inside the drawer to edit fields, then use Save on-chain at the bottom. Wallet progress and errors appear inside the drawer. Close it with the close button or Escape; closing is disabled during a transaction.

The official avatar editor accepts image uploads and does not offer a manual IPFS or image-address field. Review the preview before saving; selecting a file alone does not save it on chain. Developers using the metadata APIs above may still integrate their own resource services through supported URI formats.

Profile tasks and the legacy mining power interface#

ts
const hub = await game.extensionHub();
const eligibleEntry = await game.hasPaidEntry(account);
const claimed = await hub.profileRewardClaimed(account);
// 确认当前资料完整、已付费加入本游戏且尚未领取后,由本人发起。
await (await hub.claimProfileReward()).wait();

The game's extension hub is permanently bound to the factory's social protocol and awards 10 mining power in that game when eligible. Normal paid admission and paid takeovers qualify; eligibility remains after retirement or replacement. Initialization-only seed wallets do not count as paid participants. The reward is once per wallet per game for its lifetime; new rounds do not reset it. Saving and claiming are separate transactions, so declining a claim does not prevent profile saving.

The reward follows the original mining power-earning path, increasing cumulative power, current-round available mining power and current country contribution without changing frozen rounds. Task hall profile tasks can award signed mining power claims after acceptance; their rules differ from this 10-mining power reward. See Task hall. Additional profile rewards may use generic extensions with creator-approved budgets and the player participating through play; legacy out-of-session extensions retain personal approval requirements.

Task A02 awards up to 30 mining power after manual acceptance of an avatar, nickname and biography. Paid participation and independent manual acceptance are still required. This and the once-per-game 10-mining power contract profile reward are distinct events credited to the same balance; only the contract profile reward increases power.