Skip to content
Mohamed Anwar
All work

Sportzchain

Rebuilt a sports fan engagement platform with ~100K users: React web apps, Node.js services and Solidity contracts behind polls, contests and games.

Industry
Sports, Web3 fan engagement
Company
Crayond Digital
My role
Senior Software Engineer, technical lead, full-stack
Platforms
Responsive web + PWA, Admin web
Team
3 developers

Was in production

total users
~100K
daily active users
~15K
developers led
3
token price sync
Hourly
Fan appSportzchainPollContestBattlevsEarn SPN tokensKey feature I architectedSmart contract factoryEvery activity needs its own contractPollfactory contractA new pollits question and answersContestfactory contractA new contestits questions and optionsBattlegroundfactory contractA new battlegroundcreated on demandEach activity gets its own contract, created automatically

Overview

In short

  • Architected the responsive fan web app (with PWA support) and the admin platform as part of a platform rebuild.
  • Wrote Solidity contract factories for polls, contests and battlegrounds.
  • Designed the flow that sends rewards from the platform wallet to winners' custodial wallets.
  • Kept the SPN token price in sync from multiple trading platforms every hour.
  • Protected production against heavy bot traffic.

Sportzchain let sports fans play polls, contests, prediction games and quick battles to earn SPN tokens, join fan groups and climb leaderboards. The blockchain had to stay out of sight: fans should never need to understand wallets or gas fees.

The product already existed. I joined for a full rebuild and worked across the frontend, Node.js backend, AWS and smart contracts.

What I owned

  • Architecture of the fan web app and admin platform
  • Solidity contracts and contract factories
  • Reward transfer flow from platform wallet to user wallets
  • Hourly SPN price synchronisation
  • Backend features on Node.js, PostgreSQL and AWS
  • Production hardening against bots
  • Leading three developers and working with the product team

Built by others

The HD custodial wallet system was a team effort.

The product requirements and parts of the existing platform came before the rebuild.

1. A contract per activity, automatically

Problem

Every poll, contest and battleground needed its own on-chain contract. Writing and deploying one by hand for each activity wouldn't scale.

Decision

Use the factory pattern: one factory contract per activity type creates new instances on demand.

How
  • An admin creates an activity in the admin platform.
  • The Node.js backend calls the matching factory.
  • The factory deploys a new poll, contest or battleground contract.
Result

Admins launch new on-chain activities without a developer.

2. Rewards into custodial wallets

What I did
  • Each fan has an HD (hierarchical deterministic) custodial wallet, so they never handle keys. Wallet keys were protected with AWS KMS.
  • I designed the transfer from the platform's admin wallet to the winner's wallet for polls, contests and battlegrounds.

3. Keeping the token price honest

Problem

SPN's market price moves, but in-app spending needs a reference value that is current.

How
  • Pulled prices from several external trading platform APIs.
  • Calculated a local reference price and refreshed it every hour for in-app spending.

4. Holding up under bot traffic

Problem

At its scale the platform drew a lot of automated, abusive traffic.

How
  • Firewall rules to control traffic.
  • IP tracking and geographic restrictions for the worst regions.
  • Blocked disposable and dummy email addresses at signup.
  • Also turned off public production source maps as general hardening.

5. Learning blockchain on the job

Context

I started this project with little blockchain experience. I learned Solidity, wallet models and transaction flows while shipping a live product, and later used the same knowledge on Yiksi, a crypto wallet app.

Next case study

Metanas POS

Read it