From 0 to On-Chain: My First Web3 dApp for Tracking In-Game Taxes


🧩 Introduction: My First Web3 Hackathon
Until a few weeks ago, I had only scratched the surface of blockchain, the usual stuff: watched a few videos, tried out MetaMask, maybe deployed a test token once. But during the recent Polkadot × EasyA Hackathon, I built and deployed a full-stack Web3 application for the first time, and it completely changed how I think about smart contracts, dApps, and what’s actually possible on-chain.
Our project was called HODL My Taxes, a decentralized assistant that helps players automatically track and categorize their in-game transactions (like NFT purchases, loot boxes, or token trades) for tax reporting.
The idea might sound a little dry, but building it was anything but.
👨💻 This was my first time:
- Writing a Solidity smart contract for something “real”
- Using Polkadot’s Asset Hub to deploy on an EVM-compatible parachain
- Connecting a frontend using
viem
(a toolkit I now really love) - Generating IRS-style CSV tax reports on the fly from on-chain data
In this blog, I want to walk through:
- 🧠 What we built and why it matters
- 🔍 How it works under the hood (both smart contract + frontend)
- 🚀 What tools we used and how they helped
- 📚 And most importantly, what I learned from the whole experience
If you’re a student like me getting into Web3 or smart contracts for the first time, I hope this gives you a helpful and honest starting point. Let’s dive in!
💸 The Problem: Taxes in Web3 Gaming
If you've ever bought a loot box, sold an in-game NFT, or flipped a token for some quick gains, technically, you owe taxes on that.
And if you're anything like most players (or developers), you're probably not tracking those transactions manually.
That’s the core problem we tried to solve at the hackathon: making tax reporting for online games and gambling platforms less painful, more transparent, and fully on-chain.
❗ The pain points we identified:
- Players rarely track or report their in-game profits (especially micro-wins)
- Operators (like fantasy apps or betting platforms) handle taxes manually, if at all
- Governments lose revenue because of underreported winnings and lack of visibility
Right now, most platforms rely on:
- Manual reconciliation
- Paper-based tax forms
- Trust-based self-reporting (which almost never works at scale)
We thought:
Why not use smart contracts to automatically record, categorize, and escrow these transactions, so that filing taxes becomes just a few clicks?
💡 So we designed a system where:
- Players log every in-game buy/sell on-chain using a smart contract
- Each transaction is tagged as Income, Expense, or Capital Gain
- Users can generate a CSV report of their transactions directly from the blockchain
- And optionally mint a "Proof-of-Filing NFT" to checkpoint their ledger
All verifiable. All transparent. All auditable.
Built on Polkadot’s EVM-compatible Asset Hub.
🛠 What We Built: HODL My Taxes
Our project was called HODL My Taxes, a decentralized application (dApp) that helps players and platforms record, categorize, and export in-game transactions for tax purposes.
The idea was to keep it simple:
📦 Record → 🧾 Categorize → 📤 Export → 🧠 Peace of mind during tax season.
Here’s what the dApp does, step by step:
🎮 1. Record Transactions On-Chain
Players can log every in-game transaction (like loot box purchases, NFT flips, or token rewards) by interacting with our smart contract.
Each transaction is tagged as one of:
- Income – e.g., reward received, token won
- Expense – e.g., buying an item, entry fees
- Capital Gain – e.g., selling a rare NFT for profit
📁 2. Categorize and Store
Each transaction is stored on-chain with metadata like:
itemId
price
timestamp
category
This makes every entry tamper-proof, queryable, and audit-ready, all while staying gas-efficient.
📄 3. Generate CSV Tax Reports
Using our frontend (built in Next.js + Viem), users can:
- Connect their wallet
- View their transaction history
- Click one button to download an IRS-style CSV report
We format everything client-side using csv-writer
, so it’s easy to import into spreadsheets, tax software, or government forms.
🪪 4. Mint a Proof-of-Filing NFT (Optional)
After exporting their report, users can optionally mint a “Tax NFT” that acts as a proof-of-filing checkpoint.
This NFT isn’t about bragging rights, it’s about verifiability. It proves that a snapshot of their tax history was filed at a specific time.
💡 Why this mattered to us:
We wanted to explore how blockchain can go beyond just tokens and DeFi, and actually help solve real-world, regulatory problems.
Tax compliance isn't sexy, but it's a huge space that Web3 can help simplify. This project was our first step into that idea.
⚙️ How It Works: Smart Contracts + Frontend Integration
One of the most fun (and confusing) parts of this hackathon was wiring together the smart contract and frontend, especially as first-timers in Web3. We wanted to build something that actually works on-chain, and not just fake it in local state.
Here's how we made it all work, end to end:
🔐 Smart Contract (Solidity on Asset Hub)
We wrote a Solidity smart contract that stores a player's transaction history directly on the blockchain.
Each transaction is saved as a struct containing:
Category
(enum: Income, Expense, CapitalGain)itemId
(uint256)price
(uint256)timestamp
(block.timestamp at call time)
We also added:
- A
getTransactionCount(address)
function - A
getTransaction(address, index)
function - And a
mintTaxNFT()
function to mint an optional proof NFT
The contract was deployed to Polkadot’s Westend Asset Hub, which supports EVM smart contracts natively, so we didn’t need any bridges or custom runtimes. We used Remix IDE for deploying, which turned out to be super beginner-friendly.
🌐 Frontend (Next.js + Viem)
We used Next.js for the frontend and Viem for connecting to the blockchain.
At first, we tried using ethers.js
, but switched to Viem because:
- It integrates really well with wagmi & wallet clients
- It uses TypeScript by default (which helped us avoid type bugs)
- It lets you simulate contract calls before sending them (super useful for testing gas usage)
👛 How we connected the wallet
We used Viem’s wallet client and a minimal getWalletClient()
helper to:
- Detect if the user had MetaMask installed
- Let them approve the connection
- Use their address for signing and sending transactions
Once connected, users could:
- Call
recordTransaction(...)
to log data - Read their full on-chain history using
readContract()
- Export everything into a downloadable CSV
🧾 CSV Export
This part was surprisingly satisfying.
We looped through the on-chain transaction data (using the read functions), parsed it in the frontend, and used the csv-writer
package to generate a file with headers like:
Date, Category, Item ID, Price
One click = fully formatted, audit-friendly report for tax filing or bookkeeping.
🪪 NFT Minting
Finally, users could call mintTaxNFT()
to mint a basic ERC-721 NFT that acts as their proof-of-filing.
It doesn’t store the full report (that would be expensive), but it gives them a timestamped token ID they can point to as a reference.
All in all, it was a lot of moving parts, but once we got one read/write interaction working, the rest clicked into place.
📚 What I Learned (and What I’d Do Differently)
This project was a crash course in Web3. I went from knowing just the basics to actually deploying a smart contract and wiring up a real dApp in less than 48 hours. And honestly? That felt amazing.
But here’s what I really took away, both technically and personally:
🔍 Web3 ≠ Just Tokens
Before this hackathon, most of what I’d seen in blockchain revolved around tokens, wallets, and NFTs.
Now I realize Web3 can be used to solve boring but real problems, like tax compliance, recordkeeping, and transparent reporting.
It’s not just about trading stuff, it’s about replacing trust with math + code.
💡 Smart Contract Design Is All About Simplicity
We spent more time tweaking function parameters and struct layouts than anything else.
Gas costs, types, public vs. private, storage vs. memory, even small changes can have big effects on cost and usability.
What I'd do differently:
- Define clear use cases first, then write contract logic around them
- Use enums and mappings carefully, they save gas, but limit flexibility
- Include more event logging (we forgot this initially!)
⚙️ viem > ethers (for beginners, surprisingly)
I originally thought ethers.js
was the go-to, but viem
made a huge difference:
- Type-safe function calls (with auto-complete!)
- Easy wallet integration
- No need to manage ABI decoding manually
Also, simulating a contract call before sending it saved us from a few transaction failures.
💥 Stuff Breaks. That’s Normal.
At one point, our whole app broke because we used the wrong RPC URL (we pointed to a non-contract-compatible node).
Another time, we were passing the wrong types to a contract call and didn’t catch it because we weren’t simulating first.
But that’s the best part, Web3 gives you instant feedback when you do something wrong. You just have to be willing to read the logs and try again.
🧠 Final takeaway?
The best way to learn Web3 is to build something weird that solves a real problem.
Even if it’s not “flashy.” Even if it’s just tax reports for gamers.
This was my first hackathon in blockchain, and now I genuinely can’t wait to build more.
🔗 Links, Demo, and What’s Next
If you’ve made it this far, thank you! 🙌
Here are all the links if you’d like to try the app, read the code, or check out how we pulled it off:
🧠 GitHub Repository
See the full code (smart contract + frontend):
🔗 github.com/anandms101/hodl-my-taxes
🔎 Block Explorer
We deployed the contract to Polkadot’s Westend Asset Hub (EVM-compatible):
🔍 View on Subscan
🚀 What’s Next
We built this in under 48 hours, but there’s so much more we want to add:
- On-page transaction tables and summaries (not just CSV export)
- Role-based access for tax authorities (IRS-like dashboard)
- Proof-of-filing metadata baked into NFTs
- Possibly integrating zero-knowledge proofs for privacy
This was just our first step into building real-world dApps with Web3 tech, and it definitely won’t be the last.
Thanks again to Polkadot, EasyA, and the community mentors who helped us get unstuck (multiple times 😅).
If you’re a student like me exploring Web3, smart contracts, or use cases beyond DeFi, feel free to reach out or fork the repo. I’d love to see where you take it next.
Subscribe to my newsletter
Read articles from Anand directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Anand
Anand
I am a MERN stack developer, trying to share my knowledge on DSA and full stack development here :)