This is the canonical guide for engineers integrating YouthChain into a mobile app. It covers the full happy path: wallet creation, faucet, on-chain identity, engagement actions, rewards claim, AMM swap, and validator attestations. By the end you’ll have:
  • A wallet for the user
  • The user appearing on-chain
  • Each social action minting verifiable YCR
  • The user able to swap YCR ↔ YCE via AMM
  • The user’s phone signing blocks (counted on the dashboard)

Network basics

To add the network programmatically (MetaMask Mobile, WalletConnect, etc.):

Step 1 — wallet

Two options: A. Bring your own (MetaMask, WalletConnect, etc.) — standard Ethereum wallets work. Sign with secp256k1, EIP-155 transactions are required (ethers v6 default). B. Build the wallet into your app — BIP-39 phrase, BIP-44 path m/44'/60'/0'/0/0, phrase in the platform secure store, key re-derived per signature.
createRandom() is fine for a throwaway test address and wrong for a product: it produces a key with no recovery path and no derivation standard, so the user can never restore the account anywhere else. For anything a user will hold value in, follow Wallet Integration — derivation, secure storage, EIP-155 signing and the backup flow, with the shipped reference implementation.

Step 2 — faucet

Fund the wallet before any other call. Faucet drops 0.1 native YCE + 11K YCE token + 1K YCR in a single request.
The call answers with 202 Accepted in under a second — the transfers are submitted, not yet settled. Balances appear ~15 s later (three blocks). Poll the pollUrl in the response, or eth_getBalance, every 5 s; do not treat the first empty balance as a failure. See Events & confirmations. Full faucet docs → If your app shows a user profile, register the device so the indexer tracks it:

Step 4 — engagement actions

Every social action in the app — Post, Like, Share, Comment, Watch, NftCreate, Tip — should call the engagement endpoint to mint YCR for the user. No private key required — the indexer signs via the oracle wallet and attributes the action to the user inside the calldata.
This calls EngagementOracle.recordAction(user, actionType, weight, targetId) on-chain and accumulates pending YCR for the user. The mint rate per action is governed by setYCRMintRate(ActionType, rate), set by the foundation.

Step 5 — display rewards

Show the user how much YCR they’ve earned:
Or read directly from the contract:

Step 6 — claim YCR

When the user wants to convert pending YCR into actual ERC-20 balance:
After claim, the YCR is real ERC-20 balance — the user can transfer, swap, etc.

Step 7 — AMM swap

YCR → YCE conversion through the on-chain pool. Swap rate floats with reserves; 2% of input is burned.
Full AMM docs →

Step 8 — register in the ValidatorRegistry (optional)

Bonding 10K YCE registers the address in ValidatorRegistry. register takes four arguments and is not payable — the stake is pulled with transferFrom, so approve first. Registering also requires a 48-byte BLS public key and a 32-byte ed25519 public key, which is why this step only makes sense for someone who is actually running a candidate node.
Full registry docs →

Step 9 — block endorsements (off-chain participation signal)

The app can sign each new block hash and submit it. Be precise about what this is: the signature is verified by the indexer and stored in an off-chain table, over a block that was already finalised. It is not recorded on-chain, it is not checked against the bond, and it carries no consensus weight.
Full endorsement docs →

Voting in the DAO

The DAO is the new contract at 0xa5851461a5cff6f8277917f2a691d3c6ef5bef9e with a 5-minute voting period (testnet only — mainnet is 7 days).

Address book

Source of truth lives at contracts/script/deployed.json in the repo. Read it at build time if your app needs to survive testnet wipes without a code change.

Signing model — important for the wallet team

YouthChain has two transaction-signing surfaces. Pick the right one per use case.

1. eth_sendRawTransaction — for user-signed txs (production path)

Standard Ethereum: the user’s secp256k1 key signs a serialized RLP tx (EIP-155 / EIP-1559 / legacy), the node ecrecovers the sender. Works with MetaMask, WalletConnect, ethers, viem, hardware wallets — anything that speaks the Ethereum spec. Use this for: swap, stake, vote, claim-by-self, transfer, register validator, mint NFT, register .yc handle. Anything the user initiates.

2. /api/mobile/engagement-onbehalf + /api/mobile/claim — for relayed txs (no user gas)

The indexer signs on behalf of the user using the authorized oracle wallet. The user’s address is carried inside the calldata, attribution stays correct, but the user does not pay gas and does not need to sign. This is testnet UX scaffolding. Use this for: engagement actions (HOT path — would be terrible UX to ask MetaMask on every like), gasless claim fallback.
There is also a low-level RPC yc_sendTransaction({ from, to, privateKey, ... }) used internally by the indexer and dev scripts. Do not call this from a mobile app. It takes a private key in plaintext and is a testnet convenience only — there is no signature-vs-from validation. Production wallets use eth_sendRawTransaction.

Common gotchas

  1. Always pass type: 0 to ethers transaction options for now. The chain accepts EIP-1559 (type: 2) but legacy is most reliable across mobile wallets.
  2. Use batchMaxCount: 1 on JsonRpcProvider. Older builds did not support JSON-RPC batching; explicit override avoids surprises.
  3. Don’t skip the faucet for new wallets — without 0.1 native YCE, the wallet can’t pay gas for any user-signed tx.
  4. EngagementOracle is onlyOracle — clients cannot call recordAction directly. Always go through /api/mobile/engagement-onbehalf.
  5. YCRRewards.claim(uint8) costs gas — show a “claim now” button, don’t auto-claim. Fall back to /api/mobile/claim if the user has no gas.
  6. MetaMask AccountTracker quirk: after adding YouthChain Testnet, open the MetaMask popup once on the new network so its balance cache populates. Without this, eth_getBalance returns 0x0 and writes show “insufficient funds” even when the chain has the balance.

Help

  • Issues with the testnet, RPC, or this guide → contact the YouthChain dev team
  • Test wallet pre-funded with everything: see Test Accounts
  • Live troubleshooting steps: Troubleshooting