This project is a comprehensive blockchain-based system that combines a banking contract with an NFT shop contract, built on the Arc testnet. It features a full-stack implementation with smart contracts, backend API server, and frontend interface.
try it out here (make sure your metamask or compatible wallet extension installed)
The Monster project is a decentralized application (dApp) that combines:
- A Bank contract for managing USDC deposits and withdrawals
- An NFT Shop contract for minting and managing ERC721 NFTs
- A backend API server that connects to the blockchain
- A frontend interface for user interaction
This system demonstrates how blockchain technology can be used for both financial services and digital asset management in a unified platform.
monster/
├── backend/
│ ├── contracts/
│ │ ├── Bank.sol # Bank smart contract
│ │ └── Shop.sol # NFT shop smart contract
│ ├── scripts/
│ │ └── deploy.js # Deployment script
│ ├── server.js # Backend API server
│ ├── hardhat.config.js # Hardhat configuration
│ ├── package.json # Backend dependencies
│ └── README.md # Backend documentation
│
├── frontend/
│ ├── index.html # Main HTML file
│ ├── package.json # Frontend dependencies
│ ├── src/
│ │ ├── App.tsx # Main React component
│ │ ├── main.tsx # Entry point
│ │ └── index.css # Styles
│ ├── vite.config.ts # Vite configuration
│ ├── tailwind.config.js # Tailwind CSS configuration
│ └── postcss.config.js # PostCSS configuration
│
├── bank.sol # Bank contract source
├── shop.sol # Shop contract source
├── package.json # Root dependencies
├── README.md # This file
└── demo.gif # Project demonstration
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend API │ │ Blockchain │
│ (React) │ │ (Node.js) │ │ (Arc Testnet) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ 1. User actions │ │
│ ────────────────────▶│ │
│ │ │
│ │ 2. Contract calls │
│ │ ────────────────────▶│
│ │ │
│ │ 3. Transaction │
│ │ broadcast │
│ │ ────────────────────▶│
│ │ │
│ │ 4. Transaction │
│ │ confirmation │
│ │ ◀─────────────────── │
│ │ │
│ 5. Response │ │
│ ◀─────────────────── │ │
│ │ │
│ 6. UI update │ │
│ ◀─────────────────── │ │
│ │ │
A simple bank contract that allows users to deposit and withdraw USDC (under Arc testnet).
Key Features:
deposit()- Accepts USDC deposits from userswithdraw(address to, uint amount)- Withdraws USDC to a specified addressbalances- Mapping to track user balances- Secure transaction handling with proper error management
An ERC721 NFT shop contract that allows users to mint and manage NFTs.
Key Features:
mint(string memory _name, string memory _image)- Mint new NFTsmodifyPig(uint _id, string memory _name, string memory _image)- Modify existing NFTstokenURI(uint _id)- Returns metadata for NFTsgetPig(uint _id)- Retrieve NFT informationgetBalance()- Check contract balance- Owner-only functions for shop management:
changeOwner(address newOwner)setPigFee(uint _cost)redeem(address _to, uint _amount)closeShop(bool _close)
Dependencies:
- Uses OpenZeppelin's ERC721 implementation
- Uses OpenZeppelin's Base64 library for metadata encoding
The backend server provides RESTful API endpoints to interact with the smart contracts:
Bank Endpoints:
POST /bank/deposit- Deposit funds into the bank contractPOST /bank/withdraw- Withdraw funds from the bank contractGET /bank/balance/:address- Get user balance
Shop Endpoints:
POST /shop/mint- Mint new NFTsGET /shop/get-pig/:id- Get NFT informationGET /shop/balance- Get shop contract balance
- Express.js based API server
- Contract interaction using Hardhat
- JSON response handling
- Error management
- Environment configuration support
The frontend is a React-based interface that allows users to interact with the system:
- User-friendly interface for banking operations
- NFT minting and viewing capabilities
- Real-time balance updates
- Responsive design using Tailwind CSS
- Install Node.js and npm
- Create a
.envfile in the backend directory with your private key:PRIVATE_KEY=your_private_key_here
To deploy contracts to the local Hardhat network:
cd backend
npx hardhat run scripts/deploy.js --network hardhatTo deploy to the Arc testnet:
cd backend
npx hardhat run scripts/deploy.js --network arc- Start the backend server:
cd backend node server.js - Start the frontend development server:
cd frontend npm run dev
- Bank contract: 0xEDeBb64Fa2D6DA4DD005B69f10Ec218b45E64fc9
- Shop contract: 0xB95BE2Acdf69E9A5357606f7031933c598259772
This project is under MIT License
- Welcome to all contributors
- For agentic-commerce-on-arc submission recently
- Please follow the code style and testing guidelines
- Submit pull requests for review
- Add more comprehensive frontend features
- Implement user authentication
- Add advanced contract management
- Include more detailed analytics
- Expand NFT functionality
