Before you start, make sure you have Node.js 20+ installed and a code editor open.
No private keys to manage yet — we’ll generate test wallets in step 2.
What you’ll build
- A wallet for the user (generated locally or imported from MetaMask)
- The wallet funded with test tokens via the faucet
- Each
like/post/sharein the app firing an on-chain action that mints YCR - Real-time balance display
- An AMM swap (YCR → YCE) so the user converts rewards into the native token
Step 0 — Network basics
Bookmark these — you’ll use them in every call.Step 1 — Install ethers
yarn add ethers@^6 / pnpm add ethers@^6. Works the same in React Native (npm install ethers @ethersproject/shims react-native-get-random-values).
Step 2 — Create or import a wallet
Option A — generate a fresh test wallet (easiest for development)
Option B — connect MetaMask (web/mobile WebView)
Step 3 — Fund the wallet via faucet
The faucet drops 0.1 native YCE + 11,000 YCE token + 1,000 YCR token in a single call. 24h cooldown per address.Step 4 — Load contract ABIs
ABIs are served as static JSON, CORS-enabled. Your app fetches them at startup.Step 5 — Read user balances
Step 6 — Record an engagement action
Every social action in your app — post, like, share, comment, watch, NFT mint, tip — should call this endpoint. The indexer signs and submits an on-chain transaction toEngagementOracle.recordAction(), which accumulates pending YCR for the user.
Action weights (whitepaper §9)
Weights are governed on-chain via
setYCRMintRate(ActionType, rate) and may change.
Step 7 — Claim pending YCR
Pending YCR is per-user accumulator. The user converts pending → real ERC-20 balance with one transaction:Step 8 — AMM swap (YCR → YCE)
Convert reward tokens into the native staking token via the on-chain pool. 2% of input is burned (deflationary).Step 9 — Real-time updates
For live balance/leaderboard updates without polling, set up a 5-second poll on a single endpoint that returns everything you need:/api/mobile/profile/:address endpoint is the single source of truth for everything you’d display in the user’s profile screen.
Step 10 — (Optional) Become a validator
If you want to demo the “phone validating” pattern, the user can bond 10K YCE and have the app sign each block:Common gotchas
Full working example (single file)
node --experimental-fetch demo.mjs (Node 20+ has fetch native).
Expected output after ~10 seconds:
Next steps
- Mobile Integration Guide — full reference with all endpoints
- API Reference — Mobile REST — every endpoint documented individually
- ABIs — direct download links for all 8 contracts
- Test Accounts — pre-funded wallets for development
- Troubleshooting — common errors and fixes