SWAPPY : A Unified Decentralized Platform
for Token Swapping, Wallet Management &
RAG Chat Assistance
SUBMITTED BY : SUPERVISOR
Souptik Nag - 10271023033 Dr. Indrajit Bhattacharya
Ashesh Karmakar - 10271023007 Assistant Professor
Monajir Asraf – 10271023014 Department of Computer Application, KGEC
Introduction
Decentralized finance (DeFi) is a growing field in blockchain technology which lets
users to trade and manage digital assets without relying on banks or centralized
platforms. Our project uses the Automated Market Maker (AMM) model to allow
users to swap ERC-20 tokens and add them to liquidity. Built with simplicity and
education in mind, it supports our custom decentralized wallet alongside MetaMask,
and includes an AI-powered RAG chatbot to guide users. This full-stack application
offers a practical, compact, and expandable framework for understanding and
demonstrating the principles of DeFi and smart contract-based trading.
Motivation
The motivation behind this project is to simplify the decentralized finance (DeFi)
experience and make it more accessible for both users and developers. Most
existing platforms are complex, scattered, or rely heavily on third-party tools. Our
goal was to build a complete, easy-to-understand system that brings together
core DeFi features such as token swapping, liquidity pools, and wallet control,
into one platform. By adding an AI chatbot, we also aim to support learning and
guide users through blockchain concepts without needing external help.
Contribution
This project delivers a fully functional decentralized exchange with ERC-20 token
swaps and liquidity pooling using an on-chain AMM. It includes a custom
decentralized wallet, along with the support of other wallets also. A RAG-based AI
chatbot is integrated to guide users through DeFi concepts in real-time. The system
combines smart contracts, wallet management, token creation and AI into a single
Web3 platform. It serves both as a practical DeFi tool and as an educational
environment for blockchain learning.
What Differentiates Swappy
Some of the current most popular and related works are -
Uniswap: AMM-based token swapping on Ethereum but slowest.
PancakeSwap: Built on BNB Chain, lower fees, faster transactions.
SushiSwap: Fork of Uniswap with added incentives & governance.
These three platforms are foundational to the world of DEXs. Our project is inspired
by these platforms, but with some improved and unique features. Swappy has it’s
own AMM logic, lower transaction fees and faster transaction on Ethereum using
POW consensus and plan of future expansion to POS mechanism, which will make it
even faster. Our project stands out by combining a swapping platform, a built-in
decentralized wallet, and an AI-powered RAG chatbot that simplifies DeFi for
beginners while maintaining full on-chain functionality
SWAPPY : A DeFi token swapping platform
Swapping Platform:
A decentralized application (dApp)
for swapping ERC20 tokens directly
from user wallets
Users can:
• Connect MetaMask wallet
• Swap between supported tokens
• Add/remove liquidity to pools
No intermediaries — all operations
are executed via smart contracts
Inspired by core concepts from
Uniswap-style Automated Market
Makers (AMMs)
SWAPPY : A DeFi token swapping platform
Blockchain Networks Used: Testnets & Infrastructure
Sepolia Testnet:
This is Ethereum compatible test network, used for deploying and testing smart contracts
without real ETH.
Alchemy
Reliable infrastructure provider and used as the main RPC endpoint for Sepolia deployment
Infura
Ethereum node access via public/private RPC endpoints
Wallet Integration
Allows users to connect browser wallet, sign and send transactions to deployed smart contracts.
Why These Tools?
• Enables real-world interaction simulations
• Speeds up development and debugging
• Provides reliability and observability during deployment and testing
SWAPPY : A DeFi token swapping platform
Smart Contracts in Swapping
Token Exchange
Smart contract to create custom ERC20 This smart contract handles token
token contract used for testing, deploying transfers, approvals, tracks registered
and minting for swapping. token pairs and also facilitates token
Deployed tokens are AGN, FLR, MGN swaps using connected LiquidityPool.
LiquidityPool Deployment & Verification
This smart contract Manages reserves of The contracts are deployed using Hardhat
token pairs in a pool and executes swaps and verified on Sepolia Testnet. These
using constant product AMM formula. contracts are fully EVM-compatible and
interactable via frontend.
SWAPPY : A DeFi token swapping platform
Swapping Process
User selects token pair and input amount for swap.
Frontend calls swap function.
Checks if a Pool is available between the pairs.
The exchange contract transfers the input token to
its corresponding LiquidityPool.
Tokens are exchanged based on product formula.
Output tokens are sent back to the user instantly
SWAPPY : A DeFi token swapping platform
Liquidity Pool Functionality
While creating a Liquidity Pool two ERC20 tokens
(e.g., AGN & FLR) are paired Internally deploys a
LiquidityPool contract for the token pair.
Creating the pool makes eligible for Swapping.
Swap can only occur if a liquidity pool exists for the
selected token pair.
AMM Logic is used here to create and maintain the
Liquidity Pool which uses x × y = k formula.
Ensures price adjusts based on token supply and
demand.
Swappy Wallet : A Custom Browser-Based Crypto Wallet
Swappy Wallet is a self-developed browser extension designed for Ethereum-compatible
blockchain networks.
Unlike other wallets, it is fully tailored to our platform, offering seamless token swapping, wallet
creation, and asset management without external dependencies. It enables users to create,
restore, and manage crypto wallets.
Supports multiple Ethereum-based networks(Including Mainnet and Testnet):
✅ Ethereum Mainnet
✅ Sepolia Testnet
✅ Polygon Mainnet
✅ Amoy Testnet
Offers full non-custodial ownership - users manage their own private keys securely inside
the browser.
Swappy Wallet : Feature Set
Wallet Creation: Generates a new wallet using a secure 12-word BIP-39 mnemonic phrase,
stored locally and never sent to any server.
Wallet Recovery: Users can log in anytime from any device using their seed phrase ensuring
portability and continuity.
Multi-Network Support: Built-in network selector allows easy switching between testnets and
mainnets. Helpful for both testing and real transactions.
Token Transfer & Receipt: Users can send tokens (like ETH, MATIC) to any valid address and
receive tokens by sharing their public wallet address.
In-Browser Token Swapping: Users can directly interact with the integrated AMM-based DEX
to swap tokens without MetaMask or third-party wallets.
Custom Token Addition: Users can add any ERC-20 token by contract address to track
custom balances in real-time.
Technology Stack
React.js – Core UI framework used for building wallet screens,
forms, and state handling.
Tailwind CSS – For fast, responsive, and utility-based styling of the
wallet UI.
JavaScript + Ethers.js – Handles wallet logic, key generation,
signing, and interaction with blockchain networks via JSON-RPC.
BIP-39 – Used to generate secure, hierarchical deterministic
wallets from a 12-word seed.
WebExtension API (Manifest V3) – Powers the browser extension
framework, enabling background scripts and persistent wallet
access.
Moralis API Integration – Used to fetch token balances, NFT
metadata, and transaction history quickly and accurately.
Why We Built Swappy Wallet?
User Ownership & Security: Unlike cloud-based systems, our wallet is fully local and
non-custodial. Users own their keys, always.
Tight DEX Integration: No external wallet needed. Token swaps, contract interaction,
and balance updates happen inside one platform.
Custom Feature Flexibility: We control the wallet experience, allowing custom token
support, network configs.
Educational Value: Ideal for students, beginners, and developers to learn the core Web3
concepts like seed phrases, private/public keys, and network interaction.
Future-Ready: Designed to evolve as mobile app, dark mode, hardware wallet import,
and analytics support can be added later.
RAG Chatbot: A user assistant AI bot
Conversational Interaction
Engages users through a friendly chat interface
Maintains conversation history for contextual replies
Price Prediction Using LSTM
Predicts future price trends of major cryptocurrencies (e.g., Bitcoin, Ethereum)
Uses historical market data and LSTM neural networks for forecasts
Offers investment advice based on predicted price movements
Crypto Knowledge Retrieval (RAG)
Answers user questions using data retrieved from a vector database (Pinecone)
Uses LangChain and Mistral LLM to generate contextual responses
Token Recommendations
Suggests promising cryptocurrencies for short-term or long-term investment
Uses LLM reasoning and general market knowledge
Intelligent Query Handling
Detects user intent: prediction, recommendation, general chat
Responds accordingly using LSTM, Mistral, or RAG chain
Architecture
When a query is received, it is first categorized into
three intents:
Prediction (future price-related)
Recommendation (best token to invest)
Chat/Information (general crypto-related
questions)
For prediction, the backend uses an LSTM model
trained on 60 days of historical price data to
forecast the future price.
For recommendation, the LLM (Mistral) is prompted to suggest tokens based on current trends and context.
For chat/info, a Retrieval-Augmented Generation (RAG) system is used. Here’s how:
Public crypto data is split into chunks and embedded using HuggingFace embeddings. and then the vector
representations are stored in Pinecone.
On a new query, the top relevant chunks are retrieved via semantic search.
These are passed along with the query to Mistral LLM, which generates a context-aware response.
Conclusion
This project integrates a decentralized exchange, a custom wallet, and a RAG-based
chatbot into a single Web3 platform. Users can swap ERC-20 tokens, add liquidity, and
manage assets through on-chain smart contracts. The Swappy Wallet enables secure,
seed-based account control across multiple networks. The RAG chatbot uses Pinecone and
Mistral to retrieve and generate blockchain-related answers in real time. Together, these
components create a fully functional, modular system designed for both hands-on DeFi
interaction and practical blockchain learning.
Future Scope
Expand Swapping Functionality to Other Networks (BSC, Polygon etc.)
Enable users to perform cross-chain swaps directly through the wallet.
Add user-friendly dashboards to show swap history, token flow and transaction activity
Improve the UI/UX for better navigation and responsiveness across devices.
Integrate additional ERC-20 tokens, stablecoins and recognise stablecoins in chatbot.
Make chatbot smarter with context memory for guided, personalized support.
Allow users to view, send, and manage their NFTs alongside tokens in the wallet.
References
[1] A. Ho et al., “The Ecology of Automated Market Makers,” 2024.
[2] Z. Zhou, “Optimal Automated Market Makers,” 2024.
[3] J. Milionis et al., “A Myersonian Framework for Optimal Liquidity Provision in Automated
Market Makers,” 2023.
[4] OpenZeppelin, ERC-20 Token Standard Documentation, 2023. [Online]. Available:
https://docs.openzeppelin.com/contracts/4.x/erc20
[5] Uniswap Labs, Uniswap v2 Core Documentation, 2023. [Online]. Available:
https://docs.uniswap.org/
[6] Nomic Foundation, Hardhat: Ethereum Development Environment, 2023. [Online].
Available: https://hardhat.org/
Thank you