hackquest logo

AutoTax: On-Chain Tax Logger

AutoTax is a secure, automated, on-chain accounting and tax logging system that tracks all taxable events for crypto users and DAOs. Using MetaMask Smart Accounts, Envio, and the Monad testnet,

Video

Sự miêu tả

🧾 AutoTax: On-Chain Tax Logger

Your delegated accountant on-chain.


🚀 Overview

AutoTax is a secure, automated, on-chain accounting and tax logging system that tracks all taxable events for crypto users and DAOs. Using MetaMask Smart Accounts, Envio, and the Monad testnet, it automatically indexes, categorizes, and exports all wallet activity — including swaps, staking rewards, income, and transfers — into audit-ready reports.

It allows users to delegate a smart agent to act on their behalf, eliminating the need to manually track taxable events while maintaining full security and control of funds.


🧠 Problem

  • Cryptocurrency taxation is complex and often manual. Users must:

    • Track trades, staking rewards, and income across multiple wallets and chains.

    • Calculate gains/losses per token for accurate filing.

    • Export reports to centralized software (or manually compute).

  • Manual tracking is error-prone, especially for high-frequency traders or users with multiple chains.

  • Existing solutions require sharing private keys or trusting centralized services, introducing security risks.

  • There is no fully decentralized, delegated, automated on-chain tax tracker currently.


💡 Solution

AutoTax solves this by providing:

  1. Delegated Smart Agent – Users grant a MetaMask Smart Account delegation to a smart agent that can track transactions, classify them, and generate reports without accessing private keys.

  2. Event-Driven Indexing with Envio – Monitors wallet activity on-chain, including swaps, staking rewards, and income events. Emits triggers to the agent in real time.

  3. Execution on Monad Testnet – The delegated agent operates securely through Monad, logging events and storing reports on-chain or exporting to IPFS/Google Sheets.

  4. Auto-Categorization & Reporting – Classifies events into categories (income, capital gains, staking rewards, transfers) and automatically generates CSV/JSON reports ready for filing or accounting.


🔑 Key Features

Feature

Description

Delegated Agent

Securely tracks wallet activity using scoped permissions via MetaMask Smart Accounts.

Event Indexing

Envio monitors on-chain events like swaps, staking rewards, and transfers.

Automated Categorization

Classifies transactions into taxable categories automatically.

Cross-Chain Ready

Can monitor multiple chains if delegation allows.

Report Export

CSV export to IPFS, Google Sheets, or backend for audit.

Security

Users maintain full control; agent only reads and logs transactions, cannot spend funds.


🧩 Use Cases

1. High-Frequency Trader

Automatically logs every trade and swap on Monad testnet, categorizes capital gains/losses, and exports a CSV ready for filing.

2. Staking Rewards Tracker

Logs staking rewards received on multiple protocols and calculates taxable income automatically.

3. DAO Treasurer / Payroll Auditor

Tracks payouts, payroll, and treasury transfers automatically and generates compliance-ready reports.


🏗 Architecture

[User Dashboard / UI]
        │
        ├── (1) Create MetaMask Smart Account
        │
        ├── (2) Grant delegation to AutoTax Agent (read-only for tax events)
        │
        ▼
[MetaMask Smart Account + Delegation]
        │
        └── Stores delegation policy → authorizes Agent to track events
                         │
[Envio Indexer] ← Monitors on-chain events
                         │
                         ├── Transaction events: swap, reward, transfer
                         │
                         └── Pushes triggers / proofs → AutoTax Agent
                                     │
                                     ├── Validates delegation & event proof
                                     │
                                     ├── Categorizes transaction: income, capital gain, reward
                                     │
                                     └── Stores in Monad smart contract OR exports CSV to IPFS/Google Sheets

🔧 Components

🧍 User & MetaMask Smart Account

  • MSA is used as a secure wallet abstraction.

  • Delegates read-only permission to AutoTax Agent for tracking wallet activity.

  • Delegation is scoped, revocable, and time-limited.

Example Delegation JSON:

{
  "delegate": "0xAgentAddress",
  "allowed_actions": ["readTransactions", "logEvents", "exportReports"],
  "chains": ["MonadTestnet"],
  "expires_at": 1750000000,
  "require_envio_proof": true
}

🤖 AutoTax Agent

  • Receives Envio events.

  • Validates event proofs and delegation policies.

  • Categorizes events automatically into:

    • Swaps → capital gains/losses

    • Staking rewards → income

    • Transfers → non-taxable or internal

  • Generates CSV/JSON reports.

  • Optionally uploads reports to IPFS or pushes to Google Sheets API.


🛰 Envio Indexer

  • Monitors:

    • Token swaps (DEX, AMM)

    • Staking reward distributions

    • Incoming/outgoing transfers

  • Sends signed event proofs to AutoTax Agent for validation.

Example Event Payload:

{
  "type": "SWAP",
  "wallet": "0xUserWallet",
  "from_token": "ETH",
  "to_token": "USDC",
  "amount": "1.5",
  "price_usd": "3000",
  "chain": "Monad",
  "timestamp": 1750001234,
  "proof": "0xEnvioSignedProof"
}

⚙ Monad Testnet Smart Contracts

  • TransactionLog.sol – logs all categorized taxable events on-chain.

  • ReportExport.sol – optional contract storing CSV hashes for audit or IPFS link storage.

Example Solidity logging function:

function logTransaction(
    address user,
    string calldata category,
    string calldata txHash,
    uint256 amountUSD
) external onlyDelegatedAgent {
    transactions[user].push(TxRecord(category, txHash, amountUSD));
    emit TransactionLogged(user, category, txHash, amountUSD);
}

🔁 Event Flow Example

Scenario: User wants AutoTax to track swaps and staking rewards.

  1. Delegation: User grants AutoTax Agent permission to read transactions from MSA.

  2. Envio: Indexer detects swap of 2 ETH → USDC.

  3. Envio pushes event proof to AutoTax Agent.

  4. Agent validates proof and delegation policy.

  5. Categorization: Agent classifies as "Capital Gain."

  6. Log & Export: Stored on-chain on Monad + exported to CSV on IPFS.

  7. Repeat: Agent continuously tracks and categorizes all events automatically.


🔑 Advantages

  • Fully delegated and secure – no private key exposure.

  • Automated and continuous – no manual tracking needed.

  • Audit-ready reporting – logs stored on-chain and IPFS for proof of accuracy.

  • Cross-chain ready – can extend to Polygon, Arbitrum, or Ethereum Mainnet with Envio indexing.

  • User-friendly dashboard – easy CSV export, Google Sheets sync, or PDF reporting.


🧪 Minimum Viable Product (MVP)

  1. Frontend: Next.js dashboard to create MSA, grant delegation, and view categorized events.

  2. Envio Integration: Subscribes to wallet activity for swaps, rewards, and transfers.

  3. AutoTax Agent: Receives events, validates delegation, categorizes transactions.

  4. Logging: Logs categorized events to Monad smart contract or local DB/IPFS.

  5. Export: Generates CSV/JSON report for user download.


⚙ Deployment Steps

# Clone repo
git clone https://github.com/yourusername/autotax
cd autotax
npm install

# Deploy contracts to Monad Testnet
npx hardhat run scripts/deploy.js --network monadTestnet

# Start AutoTax Agent
npm run agent

# Run Frontend Dashboard
npm run dev

📺 Demo Flow (Hackathon Video)

  1. Create MetaMask Smart Account and grant delegation.

  2. Trigger test swap on Monad.

  3. Envio detects event and pushes proof to AutoTax Agent.

  4. Agent categorizes transaction and logs on-chain.

  5. Export CSV/JSON and show audit-ready report.

  6. Optional: show staking reward event being tracked automatically.


🛡 Security Model

  • Delegation: Scoped, time-limited, read-only permissions.

  • Event Validation: Only Envio-signed events are acted upon.

  • Immutable Logs: On-chain transaction logs provide tamper-proof audit trail.

  • Emergency Revocation: User can revoke delegation at any time.


📦 Tech Stack

Layer

Technology

Smart Wallet & Delegation

MetaMask Smart Accounts

Event Indexing

Envio

Execution Layer

Monad Testnet

Backend / Agent

Node.js / Express / Serverless Functions

Smart Contracts

Solidity + Hardhat

Frontend

Next.js + React + Tailwind

Data Storage

IPFS / Google Sheets / MongoDB (optional)


🏆 Why Judges Will Love It

  • Solves a real-world crypto problem: Tax tracking and reporting automation.

  • Secure and delegated: No private keys shared.

  • End-to-end automated pipeline: Event indexing → delegation → classification → report export.

  • Cross-chain potential: Can track assets across multiple chains for full automation.


📜 License

MIT License © 2025 AutoTax: On-Chain Tax Logger

Tiến độ hackathon

na

Công nghệ sử dụng

Web3
Next
Solidity
Ethers

Trạng thái huy động vốn

na

Trưởng nhóm
AARPIT SINGH
Mã nguồn mở
Ngành
DeFiInfra