Web3 On-chain Red Packet DApp

This is a 100% decentralized blockchain red packet application. Users can connect their wallets, set an amount and quantity to send red packets, and then share a link for others to claim. All data and operations are based on the blockchain, completely eliminating the need for centralized servers, making the entire process secure, transparent, and traceable. If you’re interested, you can check out my code on GitHub: redpacket‑dapp Feature Highlights 🧧 Send Red Packet: Connect your wallet, set the amount and quantity, and send a red packet to the blockchain. 🎁 Claim Red Packet: Through a shared link, others can connect their wallets and claim the red packet directly from the blockchain. 🔗 Smart Contract: Secure smart contracts written in Solidity handle all logic. 🌐 Multi-chain Support: Supports local testnet and BSC testnet. 💼 Web3 Integration: Uses MetaMask wallet connection. 🚀 Fully Decentralized: No backend server, all data stored on the blockchain. Tech Stack Frontend: React 19, React Router 6, TypeScript, Vite, Ethers v6 Contract Layer: Hardhat, Solidity 0.8.x Tools: ESLint, Prettier No Backend Required: Zero server dependencies ❌ Quick Start # 1. Install project dependencies npm install cd react-dapp && npm install && cd .. # 2. Start local blockchain node npm run node # 3. Compile smart contracts npx hardhat compile # 4. Deploy smart contracts npm run deploy # 5. Start frontend npm run frontend Directory Structure redpacket-web3/ ├─ contracts/ # Solidity smart contracts │ └─ RedPacket.sol ├─ react-dapp/ # React + Vite frontend │ ├─ src/ │ │ ├─ components/ # Common components (wallet button, create form, etc.) │ │ ├─ config/ # ABI, contract address configuration │ │ ├─ hooks/ # Custom hooks (useWallet) │ │ ├─ pages/ # Pages (Home, ClaimPacket) │ │ ├─ styles/ # Global styles │ │ ├─ utils/ # Web3 utility functions │ │ └─ App.tsx # Routing and layout │ ├─ .env.example # Frontend environment variable instructions │ └─ package.json ├─ scripts/ │ └─ deploy.js # Hardhat deployment script (automatically writes to frontend config) ├─ hardhat.config.js └─ package.json # Root scripts (Hardhat + frontend one-click start) Usage Guide Create a Red Packet Open the frontend and click “Connect Wallet” in the top right corner. Fill in the total red packet amount and number of shares; the application will randomly split the amount on the frontend. Submit and confirm the transaction in MetaMask, then wait for block confirmation. Upon success, copy the system-generated claim link and share it with friends. Claim a Red Packet Open the shared link (URL contains /claim/{packetId}). Connect your wallet first, then click “Claim”. After signing and confirming, wait for the block to be mined. The page will display the result and remaining shares. Environment Variables dapp/.env (automatically ignored in development, please refer to .env.example) VITE_RPC_URL: Frontend direct RPC node, defaults to http://127.0.0.1:8545 VITE_CONTRACT_ADDRESS: Can override the address written by the deployment script VITE_CHAIN_ID: Chain ID (hexadecimal) prompted for use by the frontend root/.env: If you need to reference private keys or BSC RPC in Hardhat, you can continue to use the original syntax. Smart Contract (RedPacket.sol) Core methods: ...

January 10, 2026 · 4 min · MoeJue

What have we been up to in the blog this year?

Before I knew it, 2025 has already passed. Looking back at the blog’s timeline, I realized—I actually wrote quite a lot this year. Although many times I just wrote whatever came to mind, looking back, each post genuinely recorded the state of this year. Consider this a year-end summary for myself, and for those of you who frequently visit the blog. What did the blog cover this year? If I were to summarize the blog content of 2025 with a few keywords, it would probably be: ...

January 1, 2026 · 3 min · MoeJue

Wolf and Spice

2025-12-16 Evening I just finished watching the 2024 remake of “Spice and Wolf.” I heard the ending wasn’t ideal, and I originally thought it would be equivalent to three seasons’ worth. I was thinking that by the end of the first season, they had already embarked on the journey to find her homeland, and there was another season waiting for me to watch, so the ending couldn’t be too bad, right? But I was wrong. It turns out what I watched was a remake combining seasons 1 and 2. ...

December 17, 2025 · 5 min · MoeJue

Entropy increase, death, and life

A few days ago, while scrolling through videos, I first encountered that unfamiliar yet somewhat unsettling term—entropy increase. Entropy increase is a concept in physics, meaning the degree of disorder in a system continuously increases. In plain language: No matter how hard you try, the world is constantly moving towards disorder, dispersion, and decay. The video gave an example: “Why does a house quickly fall into disrepair if no one lives in it?” This introduced the concept of entropy increase. ...

December 11, 2025 · 4 min · MoeJue

A Jue's Blog The Path to Internationalization

Recently, I’ve made a “big move” to my personal blog - I’ve upgraded it I upgraded my blog from a monolingual version to a multilingual site (Simplified Chinese, Traditional Chinese, English, Japanese). And the whole process is automated. 💪 Mainly includes: Automatic synchronization of master articles Automatic AI translation of content Automatically build and deploy multilingual sites Why Hugo? Because of its confident slogan: “The world’s fastest framework for building websites.” ...

November 2, 2025 · 3 min · MoeJue

May all your bugs be reproducible, and your code never crash.

Today is 1024 Programmer’s Day. On this day belonging to code and coffee, bugs and hotfixes, let’s pay tribute to all engineers still struggling with code. 💻 Daily Work Life Wishing everyone a new year where— All bugs are reproducible, The test environment never equals production. Requirements are changed again and again, Product managers are always “thinking it over again”. Every deployment is like a gamble, Every rollback is like fighting a fire. ...

October 24, 2025 · 2 min · MoeJue

The third generation of random 2D API is here!

Do you still remember that random graph interface that you guys ruined? It was updated today! In the past few years, Random Graph API has been a “little toy” and “common tool” for many front-end developers, 2D webmasters, and even desktop plug-in enthusiasts. 🥇 Generation 1: Simple but clunky starting point To be honest, the random graph API at that time was just a small PHP script + a cloud host. The goal at that time was simple: provide an interface that can return random pictures. ...

October 15, 2025 · 3 min · MoeJue

Orange Hope & Orange Light, the vitality rhythm of Gemini

🎀Character introduction Kitsuho Nozomi and Kitsuho Hikari are twin police detectives from SRT Special Academy in “Granblue Files”. The two are petite and cute, like small dolls, and their movements are agile and playful. Hope has a lively and mischievous personality, always with a bit of a bad smile; Hikari is a bit sweet, but occasionally shows her naughty side under the guidance of her sister. Their iconic long green hair, blue police uniforms and small hats make people want to “protect” them at first glance. ...

September 7, 2025 · 3 min · MoeJue

I don’t know AE, but I can code

✨ Oyama まひろの小屋 ✨ 🌸 Welcome to Oyama まひろの小屋 🌸 Wow! You discovered my secret base! (*≧ω≦) This is Oyama Misaki’s personal website, full of cute animations and interesting content! I will share my favorite animations, comics, games and some small blessings in daily life here~ 💕 About Me 💕 My name is Oyama Ouyuki, and I love you and I love you. I like anime, comics, light novels and all kinds of cute things! Favorite colors are pink and light blue! ...

August 23, 2025 · 2 min · MoeJue

"Lonely Rock" - Me like Pochi-chan

When I was studying, I hated writing short essays such as thoughts after watching and reading. Now I will summarize the anime I have watched, maybe because it can touch my heart more and write with real feelings. After watching “Lonely Rock”, I looked back and suddenly saw the shadow of my past. It is not like the leisurely and cheerful daily life of “Lonely Music Girl”, nor the inspirational hard work of “Live Love”. It is a more real reality, which allows me to see the past and present myself ...

August 9, 2025 · 4 min · MoeJue