Automatic MYZ reward assignment and minting service for the MyZubster ecosystem.
- Accepts reward-assignment triggers (
pr_merged,bug_validated,referral_signed_up,qa_approved). - Looks up the MYZ amount from a declarative
REWARD_POLICY. - Mints/credits MYZ to the contributor wallet via the Gateway Tari release endpoint
(
POST /api/tari/release { fromAddress, toAddress, amount }). - Persists every reward event (userId, wallet, amount, reason, timestamp, txHash) to a JSON store.
- Exposes an HTTP API for the frontend to fetch a user's reward history.
cd services/reward-backend
npm install
TREASURY_ADDRESS=<funding-wallet> GATEWAY_URL=http://localhost:5002 npm start| Method | Route | Description |
|---|---|---|
| POST | /api/rewards/assign |
Trigger a reward assignment + mint |
| GET | /api/rewards/:userId |
Reward history for one user |
| GET | /api/rewards |
All reward events (admin) |
| GET | /health |
Service + policy health |
POST /api/rewards/assign
{
"trigger": "pr_merged",
"userId": "laurentketterle-hub",
"wallet": "12Nbmmm5g6AU3Uk9...Gib1U4",
"metadata": { "repo": "MyZubster-Ecosystem/myzubster", "pr": 281 }
}PORT(default 5003)GATEWAY_URL(default http://localhost:5002)TREASURY_ADDRESS— the funding wallet used asfromAddressJWT_SECRET(defaultmyzubster-secret)REWARD_STORE— JSON store path (default./reward-events.json)