Welcome to the Loyalty Points System frontend, a decentralized application built on the Aptos Blockchain. This platform empowers businesses to issue loyalty points to customers, allowing customers to redeem points, transfer them to others, and manage their balances with secure blockchain transactions.
- Live Demo: Loyalty Points System
- Smart Contract Explorer: Aptos Explorer
- View Points Balance: Users can check their loyalty points balance and transaction history.
- Issue Points: Businesses can issue loyalty points to customers securely on the blockchain.
- Redeem Points: Customers can redeem loyalty points for predefined rewards or services.
- Transfer Points: Users can transfer points to others using their Aptos wallets.
- Blockchain Transactions: All operations are managed securely through smart contracts deployed on the Aptos blockchain.
Ensure the following tools are installed:
- Node.js (v16 or higher)
- npm or yarn
- Aptos Wallet (e.g., Petra Wallet) for blockchain interactions
First, clone the project repository and move into the project directory:
cd loyalty-points-system
Run the following command to install all required dependencies:
npm install
Create a .env
file in the root of the project and add the following variables:
PROJECT_NAME=LoyaltyPointsSystem
VITE_APP_NETWORK=testnet
VITE_MODULE_ADDRESS=0x44e4bfdbe756654c954112a24d3eab079f9acf2f6ec8c64b2a8bfd7c99ec70ed
Update the VITE_MODULE_ADDRESS with the deployed smart contract address.
To start the development server:
npm run dev
The application will be available at http://localhost:5173
.
To deploy the smart contract:
-
Install Aptos CLI.
-
Update the Move.toml file with your wallet address:
- Add you Wallet Address from Petra here
sys_addrx = "0xca10b0176c34f9a8315589ff977645e04497814e9753d21f7d7e7c3d83aa7b57"
-
Create your new Address for Deployment
aptos init
- Add your Account addr here for Deployment
my_addrx = "44e4bfdbe756654c954112a24d3eab079f9acf2f6ec8c64b2a8bfd7c99ec70ed"
-
Compile and publish the contract:
aptos move compile aptos move publish
Connect your Aptos Wallet (e.g., Petra Wallet) to interact with the blockchain. This enables you to issue, transfer, and redeem points seamlessly.
Navigate to the Points Balance section to view your total points and transaction history.
Businesses can issue points to customers:
- Go to the Issue Points section.
- Enter the customerβs address and the amount of points.
- Submit the transaction to record it on the blockchain.
To redeem loyalty points:
- Navigate to the Redeem Points section.
- Enter the amount to redeem and confirm.
- The redemption will trigger any predefined rewards or services.
Users can transfer points to other customers:
- Go to the Transfer Points section.
- Enter the recipientβs address and the number of points.
- Confirm the transfer through your wallet.
npm run dev
: Start the development server.npm run build
: Build the project for production.npm test
: Run unit tests.
- React: Library for building user interfaces.
- TypeScript: Superset of JavaScript for type-safe coding.
- Aptos SDK: JS/TS SDK for blockchain interaction.
- Ant Design / Tailwind CSS: For responsive UI and layout.
- Petra Wallet Adapter: Connect and interact with Aptos wallets.
- View Points Balance: Displays the current balance and transaction history.
- View Points Issued by Business: Shows all points issued by a specific business.
- View Transfers by User: Lists points transferred by or to a specific user.
- Smart Contracts: All point-related operations are executed securely on-chain.
- No Intermediaries: Transactions are peer-to-peer and transparent.
- Real-Time Tracking: Users can view their balances and transactions in real-time.
- Wallet Connection Issues: Ensure the wallet extension is installed and connected.
- RPC Rate Limits: Use private RPC providers to avoid public network limits.
- Transaction Errors: Ensure sufficient balance and permissions for transactions.
If deploying on Vercel or similar platforms, consider:
- Using third-party RPC providers like Alchemy or QuickNode.
- Implementing request throttling to avoid overload.
- Utilizing WebSockets for real-time updates.
The Loyalty Points System offers businesses a decentralized way to manage loyalty programs. With secure smart contracts and transparent operations, customers can redeem and transfer points seamlessly. The platform ensures smooth, on-chain interactions between businesses and customers, making loyalty management efficient and rewarding.