A high-conversion landing page focused on electronics, featuring full Blockchain integration (Ethereum/Sepolia) for payments via Smart Contracts (ERC-20).
This project simulates a Native-Web3 e-commerce store. Unlike conventional stores that use payment gateways (Stripe, PayPal), Crypto Store interacts directly with the blockchain through the user's wallet (MetaMask).
The goal was to create a fluid User Experience (UX), where Web3 complexities (network switching, approvals, decimal conversion) are abstracted into a friendly and modern interface.
- Responsive & Modern Design: Mobile-First layout, Scroll Reveal animations, and "Glassmorphism" aesthetic (Dark Mode).
- Wallet Connection: Login via MetaMask (Web3 Injection).
- Network Enforcer: Automatically detects and forces a switch to the Sepolia Testnet.
- ERC-20 Payments: Full logic to accept Tokens (e.g., USDT) by interacting directly with the Token Contract ABI.
- Visual Feedback: Toast notification system for transaction status (Pending, Success, Error).
- Error Handling: Manages signature rejections and RPC failures gracefully.
- HTML5 Semantic: Accessible structure optimized for SEO.
- CSS3 (Modern): CSS Variables, Flexbox, Grid Layout, and Media Queries.
- JavaScript (ES6+): Async logic (
async/await) and DOM manipulation. - Ethers.js v6: Library for interacting with the Ethereum Blockchain.
- Toastify JS: Non-intrusive notifications for better UX.
Since this project uses Vanilla JS and CDN libraries, no heavy Node.js dependencies are required to run it locally.
- Browser with MetaMask extension installed.
- Live Server extension (VS Code) or any simple local server.
- Clone the repository:
git clone [https://github.com/YOUR-USERNAME/crypto-store.git](https://github.com/YOUR-USERNAME/crypto-store.git)
- Open the folder in VS Code.
- Wallet Setup:
- Open
script.js. - Locate the line
const MERCHANT_ADDRESS. - Replace it with YOUR public wallet address (where you want to receive the test payments).
- Open
- Open
index.htmlwith Live Server. - Access
http://127.0.0.1:5500in your browser.
This project is configured to run on the Sepolia Testnet (fake money) for safety.
- Get Test ETH: Go to a Sepolia Faucet and request free ETH to pay for gas fees.
- Get Test USDT:
- In MetaMask (Sepolia Network), click "Import Token".
- Add the contract address used in the code:
0x7169D38820dfd117C3FA1f22a697dBA58d90BA06. - Use an ERC-20 Faucet to mint some balance of this token.
- On the Website:
- Click Connect Wallet.
- Choose a product and click Buy with Crypto.
- Approve and Confirm the transaction in MetaMask.
crypto-store/ │ ├── index.html # Structure and Content ├── style.css # Styling (Dark Theme & Responsive) ├── script.js # Web3 Logic (Ethers.js) & UI └── README.md # Documentation
Below is an example of how the Frontend calculates precise values for the Smart Contract, avoiding common floating-point errors in blockchain development:
// Ethers.js v6 interaction example
const tokenContract = new ethers.Contract(USDT_ADDRESS, ABI, signer);
const decimals = await tokenContract.decimals(); // Returns 6 for USDT
// Converts visual price (450.00) to BigInt (450000000) safely
const amountToPay = ethers.parseUnits(price.toString(), decimals);
// Executes the transfer on the Blockchain
await tokenContract.transfer(MERCHANT_ADDRESS, amountToPay);
🔮 Future Improvements (Roadmap)
[ ] Create a custom Store Smart Contract (Solidity) for on-chain stock management.
[ ] Add multi-chain support (Polygon, BSC, Arbitrum).
[ ] User purchase history reading events from the Blockchain.
📄 License
This project is licensed under the MIT License. Feel free to use it for study and portfolio purposes.
Developed by Davi Mota 🚀