Build on Nih.
Tip, borrow, stream, and unlock content using MUSD on Mezo matsnet. Everything below is the production wire — same surface the dashboard + extension hit. No SDK required; standard wagmi / viem / ethers calls.
1. Network
| chainId | 31611 |
| network | Mezo matsnet |
| RPC (public) | https://rpc.test.mezo.org |
| Explorer | https://explorer.test.mezo.org |
| BTC faucet | https://faucet.test.mezo.org |
| Native gas token | BTC (18 decimals) |
2. Nih contracts (matsnet)
| MUSD | 0xf9BBcCC0F1b68EA07c86de6F88C76b3d8E2dD0af |
| MEZO | 0xf47D21Afd23639870c5185462B2F418eF59d6F67 |
| NihRegistry | 0xe349707D8BAfA05BC7dd2A2dE16638CBE4673043 |
| NihVault | 0xe884953A76AB6eAb45a9F3A58834FFFF8c133AAc |
| NihRouter | 0x67Fb6f01C35D4793b952C9BFE606c0B7Cb1F7c15 |
| NihCredit | 0x256f577DAf3354156f39a77606B6e4eDc8Fd762c |
| NihStream | 0x28364eF04EF75e77B28553Df47845cf7dB6fD32d |
| NihEarn | 0x9374377F59be566f10F47d575C533f24A8D6B961 |
| NihTrove | 0xEe32066B1F61D8f06103f882AA537aCFe01468f4 |
All Nih contracts wire MUSD to Mezo's real MUSD primitive (0xf9BB…0af). Open a Mezo trove (via the deposit BTC → mint MUSD flow at app.test.mezo.org) to obtain MUSD for tipping.
3. Underlying Mezo primitives
| Mezo MUSD (real) | 0xf9BBcCC0F1b68EA07c86de6F88C76b3d8E2dD0af |
| BorrowerOperations | 0xa14cbA6DD12D537A8decc7dd3c4aC413B8711eba |
| TroveManager | 0x7FE0A5a7EeBD88530c58824475edEae33424671F |
| StabilityPool | 0xCfdb903cD2Dc14E24e78130A63b20Ba65107262A |
| PriceFeed | 0xf28B0d5165b4ad9D5C04CdE1E37B400f8ca5A8cb |
4. Sending a tip
Approve MUSD to the router, then call tip(...).
ts
// viem
import { createWalletClient, http, parseEther, keccak256, toBytes } from "viem";
import { matsnet } from "./chain"; // chainId 31611
const ROUTER = "0x67Fb6f01C35D4793b952C9BFE606c0B7Cb1F7c15";
const MUSD = "0xf9BBcCC0F1b68EA07c86de6F88C76b3d8E2dD0af";
await wallet.writeContract({
address: MUSD,
abi: erc20,
functionName: "approve",
args: [ROUTER, parseEther("10")],
});
await wallet.writeContract({
address: ROUTER,
abi: routerAbi,
functionName: "tip",
args: [
"twitter", // platform
"hajislamet", // username
parseEther("10"), // 10 MUSD
false, // payFeeInMezo
keccak256(toBytes("anything you want here")), // bytes32 context
],
});| Function | tip(string,string,uint256,bool,bytes32) |
| Fee | 0.5% in MUSD, or 0.25% in MEZO if payFeeInMezo=true |
| Min tip | 0.5 MUSD |
| Unregistered tier cap | 10 MUSD lifetime (parks in vault) |
| Event | Tipped(sender, handleId, recipient, amount, fee, paidInMezo, context) |
5. Borrow / repay / monitor a credit line
NihCredit lets a wallet borrow up to 60% of its tip income as a 1% APR loan, with their tip balance as collateral. One open loan per wallet.
ts
// Open (mint MUSD against tip collateral)
await wallet.writeContract({
address: "0x256f577DAf3354156f39a77606B6e4eDc8Fd762c",
abi: creditAbi,
functionName: "open",
args: [parseEther("100")], // collateral in MUSD (gets 60 MUSD minted)
});
// Inspect the loan
const [principal, collateral, openedAt] = await client.readContract({
address: "0x256f577DAf3354156f39a77606B6e4eDc8Fd762c",
abi: creditAbi,
functionName: "loans",
args: [walletAddress],
});
const owed = await client.readContract({
address: "0x256f577DAf3354156f39a77606B6e4eDc8Fd762c",
abi: creditAbi,
functionName: "owedAmount",
args: [walletAddress],
});
// Repay in full (no partial repay; close + reopen smaller if needed)
await wallet.writeContract({
address: "0x256f577DAf3354156f39a77606B6e4eDc8Fd762c",
abi: creditAbi,
functionName: "repay",
});| loans(borrower) | returns (uint128 principal, uint128 collateral, uint64 openedAt) |
| owedAmount(borrower) | returns principal + accrued interest (1% APR) |
| LTV liquidation | 80% (LTV = owed / collateral) |
| Partial repay | not supported — close + reopen |
6. Streaming MUSD (subscriptions / payroll)
ts
// Start a 1-month, 5 MUSD subscription
await wallet.writeContract({
address: MUSD,
abi: erc20,
functionName: "approve",
args: ["0x28364eF04EF75e77B28553Df47845cf7dB6fD32d", parseEther("5")],
});
await wallet.writeContract({
address: "0x28364eF04EF75e77B28553Df47845cf7dB6fD32d",
abi: streamAbi,
functionName: "create",
args: [recipientAddress, parseEther("5"), 30n * 86400n], // 30 days
});
// Recipient withdraws accrued amount
await wallet.writeContract({
address: "0x28364eF04EF75e77B28553Df47845cf7dB6fD32d",
abi: streamAbi,
functionName: "withdraw",
args: [streamId],
});
// Either party cancels — unaccrued refunds to sender
await wallet.writeContract({
address: "0x28364eF04EF75e77B28553Df47845cf7dB6fD32d",
abi: streamAbi,
functionName: "cancel",
args: [streamId],
});7. Claim a parked handle
Tips routed to an unregistered handle park in NihVault. Verify ownership via the attestation endpoint then redeem on-chain.
bash
# 1. Get a Tier-1 attestation (verifier reads your public profile for the challenge)
curl -X POST https://nih-seven.vercel.app/api/verify \
-H "content-type: application/json" \
-d '{
"platform": "twitter",
"username": "your_handle",
"wallet": "0xYourWallet",
"deadline": 1779999999
}'
# 2. Submit attestation to NihRegistry
# 3. Call NihVault.claim(handleId)8. Goldsky subgraph (nih/v4)
Indexes Tipped, LoanOpened/Repaid, StreamCreated/Withdrawn/Cancelled events. GraphQL endpoint:
text
https://api.goldsky.com/api/public/project_cmo5pukv64upu01y48tefank9/subgraphs/nih/v4/gngraphql
{
tips(first: 10, orderBy: timestamp, orderDirection: desc) {
id amount handleId timestamp
sender { address }
recipient { address }
}
handleStats(first: 5, orderBy: totalReceived, orderDirection: desc) {
handleId totalReceived tipCount
}
loans(first: 5) {
borrower { address }
principal collateral openedAt closedAt
}
streamRecords(first: 5, orderBy: startTime, orderDirection: desc) {
streamId sender recipient deposit startTime stopTime cancelled
}
}9. Hosted REST routes
| GET /api/health | Network + contract address dump (env mirror) |
| POST /api/verify | Verifier-signed Tier-1 attestation |
| POST /api/suggest | Tippy — AI tip-amount recommender (Claude via OpenRouter + Boar RPC) |
| GET /api/spectrum-stats | Spectrum Nodes blockchainapi read-through |
| GET /api/og | OpenGraph card renderer for /c/[platform]/[username] |
10. Partner integrations
- Goldsky — subgraph indexing all Nih events (
nih/v4). - Spectrum Nodes — blockchain GraphQL data reads via
/api/spectrum-stats. - Boar Network — Mezo mainnet RPC read inside the AI agent context loader at
/api/suggest. - OpenRouter — LLM aggregator powering Tippy, our tip-amount recommender (model:
anthropic/claude-3.5-haiku). - Tenderly — every tx-toast carries a Tenderly simulator deep-link for replay.
- Validation Cloud — mainnet RPC documented in the chain config for the post-hackathon launch.