FlyToEarn reimagines traditional airline miles as on-chain digital assets managed in your FireFly custody wallet.
The project implements a Web2 check-in process where travelers receive:
• A FLYP NFT (Proof of Travel) minted on each trip, serving as verifiable proof of travel — which can be used to unlock exclusive offers on hotels, car rentals, and more.
• A FLYM fungible token (digital miles) credited to the user’s FireFly custody wallet.
FlyToEarn also integrates a complete DeFi layer:
• Users can borrow USDT using their FLYM tokens as collateral via the kLender smart contract.
• The borrowed USDT can be invested to earn yield through the KInvest smart contract, completing a full on-chain financial journey.
- Install the FireFly CLI here
- Create a FireFly stack by running:
ff init devchallenge --block-period 2 # on MacOS --firefly-base-port 5001 - Start the FireFly stack by running:
ff start devchallenge
- FLYP Token - ERC721 - NFT
ff deploy ethereum my_supernode solidity/deploy_files/flyp/combined.json- FLYM Token - ERC20 - Miles - Copy this address!
ff deploy ethereum my_supernode solidity/deploy_files/flym/combined.json- USDT Token - ERC20 - Stable coint - Copy this address!
ff deploy ethereum my_supernode solidity/deploy_files/usdt/combined.json- KLender - Lender smart contract
ff deploy ethereum my_supernode solidity/deploy_files/klender/combined.json "USDT_TOKEN_ADDRESS" "FLYM_TOTAL_ADDRESS" "SIGNING_KEY"- KInvest - Stake smart contract
ff deploy ethereum devchallenge solidity/deploy_files/kinvest/combined.json "USDT_TOKEN_ADDRESS"ff accounts create my_supernode Note:
Make sure to update all contract addresses in the backend/config.json file.
The backend automatically fetches the contract address. Used for approveTransfer operations required by the Lend and Stake functions.
- Create fungible token pools for FLYM (FlightMiles) and USDT (stablecoin).
- Transfer 1000 USDT to the KLender contract address.
- Transfer 1000 USDT to the KInvest contract address — this balance will be used to pay out yield to users.
- Create a nonfungible token pool for FLYP
Use the ABI files located in solidity/abis/*.json to create contract interfaces:
| ABI File | FireFly API Name |
|---|---|
| flyp_erc721uri_abi | FlypAPI |
| klender_abi.json | KLenderAPI |
| kinvest_abi.json | KInvestAPI |
If you change any of the API names, make sure to update them in the file backend/config.json accordingly.
-
Customer Wallet Addresse Replace the CUSTOMER field with the public key generated when creating your FireFly account:
"CUSTOMER": "0x.", -
Signing Key Set the SIGNING_KEY to your FireFly node’s Ethereum address. You can find it in the FireFly UI under: Network → Organization → Your Org → Ethereum Address (at the bottom of the page)
"SIGNING_KEY": "0x...",
cd backend
npm install
npm startThis will install all backend dependencies and start the Express server on http://localhost:3000.
cd frontend
npm install
npm startThis will launch the React-based UI on http://localhost:4000.
Follow the steps below to experience the full FlyToEarn journey:
-
Start the App
Open http://localhost:4000 in your browser.The system assumes you’ve already purchased a ticket, completed KYC, and your wallet key is registered on FireFly.
-
Simulate a Flight
Navigate toKAirline / Check-inand submit your travel details.The backend will mint a FLYP NFT (Proof of Travel) and FLYM miles tokens, transferring both to your FireFly custody wallet.
-
View Your Travel NFTs
Go toKAirline / Proof of Travelto see a visual gallery of all your FLYP NFTs.Metadata is fetched from the NFT URI and rendered as cards.
-
Check Miles Balance
VisitKAirline / Miles Balanceto see your FLYM balance and the last updated timestamp. -
Borrow USDT Using Your Miles
Head toKBank / Lendto borrow USDT using your FLYM as collateral.Loans are 100% collateralized and accrue 5% interest/year.
-
Stake Your USDT for Yield
With USDT in hand, go toKBank / Investto stake and earn 7% interest/year. -
Withdraw Investment
After staking, return toKBank / Investto unstake and withdraw your principal + accumulated interest. -
Repay Your Loan
Use the recovered USDT to go back toKBank / Lendand repay your loan, reclaiming your FLYM collateral.
Note:
If you encounter balance-related errors, make sure you’ve completed the steps in the Token Pools and Minting section to initialize the system properly.
-
Customer Identity Management
The project assumes that customer registration, KYC, key generation, and authentication are handled externally before reaching this frontend. These components are not included in the current implementation.
-
Miles Expiration
A manual interface is provided to simulate miles expiration. In a production environment, this should be managed by a backend service and triggered via scheduled jobs or external integrations.
-
Lend & Stake Smart Contracts
While the smart contracts implement basic security measures (e.g., Ownable, nonReentrant), they are prototypes. Improvements are needed to support multiple loans, fetch real-time mile prices from an oracle, and enhance collateral management logic.
-
NFT Metadata (URI) & Images
The current implementation uses a simulated static JSON URI for NFT metadata. In a production setting, metadata should be stored on IPFS or served from a reliable CDN to ensure permanence and verifiability.
-
Create a DNS entry or local alias
10.0.0.3 flytoearn.dev -
Configure Nginx for the custom domain Create a /etc/nginx/sites-available/flytoearn.dev file and link it on sites-enabled
server {
server_name fly_to_earn.dev;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# React Frontend
location / {
proxy_pass http://127.0.0.1:4000;
}
# Next backend
location /api {
proxy_pass http://127.0.0.1:3000;
}
}Adjust
frontend/vite.config.tsandbackend/config.ts
After setting this up, restart Nginx:
sudo systemctl restart nginx
If you want an Enterprise Super Node, try kaleido.io