AccessAudit - On-Chain Access Approval & Audit System
Sepolia Deployment & Etherscan Verification + Dune Event Analytics Dashboard

Project Resources
View the open-source smart contract code on GitHub, check the verified contract on Etherscan, or explore the Dune Analytics dashboard.
Background & Motivation
While preparing a Web3-related project for graduate school applications, I realized that my interest in Web3/decentralized systems—particularly their trustable execution, auditability, and open data interfaces—needed to go beyond conceptual understanding. I needed to validate my depth of comprehension and engineering capabilities through hands-on projects.
Therefore, starting in early December, I deliberately chose a minimal topic that would showcase a complete Web3 capability loop: on-chain access approval and audit logs (Access Approval & Audit Logs), with the goal of producing verifiable outputs "from zero to deployment."
I chose this topic because it simultaneously covers the three most essential aspects of decentralized applications:
Role-Based Access Control
How real-world access approval, data authorization, and role management are expressed on-chain.
Auditable Event Logs
On-chain data's "verifiable interface" and how to construct audit trails using events.
On-Chain Data Analytics
Transforming event logs into metrics, charts, and dashboards to provide presentable analytical evidence.
Technology Stack
This project utilizes a modern Web3 development toolchain, forming a complete technical loop from smart contract development to on-chain deployment and data analytics.
Blockchain Platform
Development Tools
Infrastructure
Data Analytics
Learning Path & Resources
To avoid "concept-only learning without engineering execution," I adopted a "toolchain + minimal project-driven" approach, primarily referencing public videos and tutorial sites to complete onboarding and hands-on practice:
My strategy was not "complete all courses" but rather "learn while doing": every time I mastered a key concept (contracts/transactions/events/topics/RPC/testing), I immediately implemented it in the AccessAudit project and verified its functionality, ensuring I could produce externally verifiable outputs.
Tutorial Videos (Bilibili)
Tutorial Sites
Official Docs
Community Resources
Contract Design & Implementation
Contract Goal: On-Chain Access Approval & Audit (Minimal but Extensible)
The AccessAudit contract I implemented is a minimalist "access request—approval decision—audit trail" system with the following core design:
Roles
Using OpenZeppelin's AccessControl, I defined APPROVER_ROLE as the approver role; the deployer/admin is responsible for granting roles.
Requests
Users submit access requests via requestAccess(payloadHash). I use payloadHash to represent a digest (hash) of the "accessed resource/dataset/permission scope," avoiding uploading sensitive information directly on-chain.
Decisions
Approvers approve or reject a request via decide(id, approved).
Events
Key state changes are written to on-chain logs via events, such as AccessRequested and AccessDecided. Events are the "factual records" of on-chain audits and the foundation for subsequent data analysis.
AccessAudit Smart Contract
Although simple, this design covers typical organizational access control logic at the system level: who can initiate, who can approve, how approval results are traceable, and how to standardize "audit evidence" written on-chain.
AccessAudit Smart Contract
Toolchain & Engineering (Foundry + WSL)
I completed the full engineering workflow using the Foundry toolchain in a WSL Ubuntu environment:
forge
Compile contracts, run unit tests, execute deployment scripts (supporting dry-run and broadcast)
cast
Interact with contracts via command line, send transactions, query on-chain data (call/logs/receipt, etc.)
anvil
Local chain for rapid iteration validation (later migrated to Sepolia)
Unit Testing: Ensuring Trustworthiness via "Verifiable Failure/Success"
I wrote at least three types of unit tests for the contract, covering key security and logic branches:
Request Creation Correctness
ID auto-increment, request storage correctness, event emission
Permission Control Correctness
Only accounts with APPROVER_ROLE can call decide (includes revert tests)
State Non-Replay
Already-decided requests cannot be decided again (includes revert tests)
Deployment to Sepolia & Verification
To ensure external credibility, I deployed the contract to the Ethereum Sepolia testnet and completed a full verifiable evidence chain:
Starting from zero understanding of "what is a wallet/address/private key/test token," I completed testnet account setup and minimal fund management (only for gas), understood the role of RPC (the "entry point" for on-chain read/write), and obtained a usable Sepolia RPC via Alchemy. Finally, I completed Etherscan source code verification (Verified), making the source code, ABI, and method signatures publicly queryable.
Contract Information
Verified Contract on Etherscan
Verified Contract on EtherscanKey Transactions
① Deploy Contract
Tx Hash: 0xfc08...91ef
Deployed AccessAudit contract and granted DEFAULT_ADMIN_ROLE to the deployer address.
② Grant APPROVER_ROLE
Tx Hash: 0xb39f...d53d
Granted APPROVER_ROLE to a designated approver address to enable access request approvals.
③ Request & Approve Access
Request Tx: 0x582f...f622
Decide Tx: 0x7ec6...19b5
User requested access with a hashed payload, and approver approved the request, emitting corresponding events.
Contract Deployment Transaction
Contract Deployment Transaction
Access Request Transaction (Event Log)
Access Decision Transaction (Event Log)Dune Event Analytics & Visualization Dashboard
After completing on-chain deployment and interaction, I further used Dune to transform on-chain events into readable statistical results and visualization dashboards. My approach was to directly analyze using Dune's sepolia.logs raw log table rather than relying on "pre-parsed project tables," demonstrating my understanding of EVM event structure:
I filtered logs by contract_address for this contract; used topic0 (event signature hash) to distinguish different events: AccessRequested / AccessDecided; and used topic1 (indexed parameter) to correlate the same request's id, thereby joining requests and approval decisions.
Dune Analytics Dashboard Overview
Dune Analytics Dashboard OverviewCore SQL Queries
Daily Access Requests
Count the number of AccessRequested events per day by filtering logs with the contract address and event signature (topic0).
Daily Access Requests
Daily Request Volume ChartDaily Approval Rate
Join AccessRequested and AccessDecided events on request_id (topic1) to compute the approval rate per day.
Daily Approval Rate
Daily Approval Rate ChartProject Summary
Through this project, I completed a full engineering practice from smart contract development, testnet deployment, source code verification, to on-chain data analytics:
Core Takeaways: Systematic Understanding From 0 to 1
Complete Engineering Loop
Understood and practiced: contracts, accounts, transactions, gas, RPC, testnet, deployment, interaction, receipts, event logs
Technical Carrier of On-Chain "Auditability"
Understood the technical carrier of on-chain "auditability": event logs (topics/data)
On-Chain Data Analysis Capability
Able to directly use on-chain raw logs for analysis (Dune SQL) and output visualization dashboards
Web3 Security & Best Practices
More concrete understanding of "access control is a security baseline": role models, permission validation, state non-replay, etc.
If I continue to deepen this work, I plan to extend more realistic audit metrics, such as approval latency (request_time to decide_time), rejection rate, active requesters, and role change audit statistics, gradually migrating from testnet to a more realistic on-chain environment.