MandiPraman
Empowering Indian Farmers
The problem MandiPraman solves
A farmer deciding where to sell a load of onions today usually hears "today's price" from the buyer or a commission agent, who may gain from quoting low. Official price sources exist, but they are slow and hard to use on a phone, in a regional language, at the moment of decision. And any price list kept in one party's database can be edited or deleted without anyone noticing.
Mandi Praman (प्रमाण = proof) is a crowd-sourced crop price board for Indian mandis:
- Anyone can post a price for a crop at a mandi. No account and no crypto wallet.
- Others confirm or dispute it. A report is left out only when it is clearly rejected (at least two disputes, and more disputes than confirmations).
- The board shows the median of recent trusted reports, so one wrong number cannot move it, and highlights the best mandi and how much more it pays than the lowest.
- Old prices vanish on their own (reports expire after 7 days in this deployment), so the board shows what is current.
- Interface is in English, Hindi and Marathi.
- Every post and vote links to the transaction on the Arkiv explorer.
A farmer gets a second opinion on a quote, in their language, from a record nobody can quietly rewrite. Prices in the demo are synthetic test data, and the app says so.
Challenges I ran into
-
The board hung on "Loading prices…" for minutes. Each page refresh sent the same list query to the rate-limited public RPC four times (
/reportsand/priceseach queried reports and votes), with no timeout and no sharing of in-flight calls, so slow calls piled up. Fix: one shared cached listing for both endpoints, identical in-flight reads share a single request, a slightly stale value is served while a fresh one loads, the last good value is kept if a refresh fails, and the RPC transport has a 15 s timeout with 2 retries. -
Anyone could fake a "price report". My first queries filtered only on my own
projecttag, but anyone can copy that tag onto their own entity. Fix: every query now also uses.createdBy(relayer)and voting checks the report's$creator. The creator field cannot be forged. -
Entities were not actually frozen. I assumed posted prices could not be edited, but as owner the relayer could have patched them. Fix: create every report and vote with
flags: { readonly: true }, and I wrotenpm run prove-readonlyto show the owner's edit being rejected. A delete is still possible, so the README says so honestly. -
A confirmed transaction looked "not found". Right after a vote, the explorer said the transaction was not found in storage; a few minutes later it showed Success. It was explorer indexing lag, not a failed write.
-
Silent zero rows. A query with the wrong attribute type (
u64against a storedi32) returns nothing and no error, which looks like "no data". I usednpm run probeto map this out and stored prices asdecand times asu64consistently.
I also learned the public RPC is heavily rate limited, and the explorer and docs examples did not always match the SDK. See arkiv/friction.md.
Tracks Applied (3)
