How suxutao/noteevidence works
Project type and purpose
• This is a decentralized application (DApp) for “Note Verification on Ethereum.”
• It consists of on-chain components (Solidity smart contracts deployed via Hardhat) and an off-chain React frontend interacting through MetaMask/ethers.js.
File structure
• Top-level folders:
• contracts/ → Solidity sources (NoteVerifier.sol, Counter.sol)
• frontend/ → React app (JSX components, contractABI.js, CSS, HTML)
• scripts/ → deployment & operational scripts (deploy.js, send-op-tx.ts)
• test/ → Mocha/Chai + Hardhat tests for contracts
• hardhat.config.ts & tsconfig.json → build/deploy configuration
• Key patterns:
• DApp layered architecture (UI ↔ Web3 provider ↔ Blockchain network)
• Hardhat development network vs. public testnet (Sepolia)
• LocalStorage for offline note content
README for additional insights
• Core features: note-hash storage, retrieval, verification, listing
• Workflows:
• LocalHardhat node ⟷ deploy scripts ⟷ smart contracts
• React UI ⟷ MetaMask/ethers.js ⟷ Ethereum network
• Security: only hashes on-chain; note texts in browser localStorage
1) User Browser Environment
– React SPA (NoteEditor, NoteList, VerifyNote)
– LocalStorage for raw notes
– MetaMask Web3 provider
2) Blockchain Layer
– Ethereum Network (Hardhat local node / Sepolia RPC)
– Smart Contracts (NoteVerifier, Counter)
3) Development & Deployment
– Hardhat CLI & config
– scripts/deploy.js, scripts/send-op-tx.ts
– Mocha/Chai tests under test/
– User → React UI: create/edit note
– UI → Hashing module → compute SHA256
– UI → MetaMask/ethers.js → sendTransaction(hash) → Ethereum node
– Ethereum node → Smart Contract storage → block data
– UI ← ethers.js.call → contract view functions (getNotes, verifyHash)
– UI ↔ localStorage for raw note persistence
– Developer → Hardhat CLI → deploy/test scripts → local/testnet
c. Architectural patterns & design principles
– Separation of concerns:
• Presentation (React)
• Blockchain logic (Solidity contracts)
• Infrastructure/config (Hardhat, scripts)
– Stateless frontend with on-chain state
– Secure by design: only hashes on-chain
d. Key technologies & libraries
– Hardhat 3 Beta (Ethereum dev framework)
– Solidity (smart contracts)
– ethers.js (Web3 SDK)
– React (frontend)
– Mocha & Chai (tests)
– MetaMask (user’s Web3 wallet)