Swapify empowers the trustless exchange of high-value, real-world assets on the blockchain, eliminating counterparty risk through secure, instant, and guaranteed atomic swaps.
Swapify is a decentralized application that enables trustless, peer-to-peer atomic swaps of NFTs on the Mantle Sepolia testnet. Built with security and simplicity in mind, it leverages Hash Time Locked Contracts (HTLC) to ensure that swaps are all-or-nothing, eliminating the need for trusted intermediaries.
Contract Address: https://sepolia.mantlescan.xyz/address/0x387291E20735bF1362D42b9e90bF8803165648CA
Demo Link: https://swapify-mantle.vercel.app/
Trustless & Atomic: Swaps are executed directly between users. The entire transaction either completes successfully for both parties or fails, returning the assets to their original owners.
Secure: Utilizes cryptographic secret hashes and a 24-hour timelock to protect users' assets from getting stuck indefinitely.
User-Friendly Dashboard: A clean interface to create new swaps, view incoming offers, and manage all your active and completed swaps in one place.
Real-Time Status: Track the progress of your swaps with clear status indicators (e.g., "Pending Initiator", "Awaiting Response", "Completed").
The atomic swap process is secured by a secret known only to the initiator (User A). The swap can only be completed when the responder (User B) provides this secret.
Create Swap: User A initiates a swap by specifying their NFT, the desired NFT from User B, and User B's wallet address. A secret is generated, and its hash is stored in the smart contract.
Share Secret: User A securely shares the secret with User B off-chain (e.g., via a secure messaging app).
Initiator Locks NFT: User A approves the Swapify contract to access their NFT and then locks it into the contract. The swap is now active and waiting for User B.
Responder Completes Swap: User B sees the pending swap, approves their NFT for the contract, and provides the secret from User A to lock their NFT and finalize the swap. The smart contract verifies the secret, and instantly transfers both NFTs to their new owners.
Safety Timelock: If User B does not complete the swap within 24 hours, either user can cancel the swap, safely returning the locked NFT to its original owner.
Alice (Initiator) Swapify dApp / Blockchain Bob (Responder)
------------------------- ----------------------------------------- -----------------------
| | |
| | |
[ 1. Creates Swap Offer ] | |
| Fills form with NFT details | |
| and Bob's address | |
+---------------------> [ dApp generates Secret + Hash ] |
| |
V |
+-----------------> [ Contract.createSwap(..., secretHash) ] |
| | |
| V |
| [ Swap created on-chain ] |
| (Status: Pending Initiator) |
| | |
[ 2. Shares Secret ] | |
| (e.g., via secure message) | |
+-------------------------------------------------------------------------------------> [ Receives Secret ]
| | |
| | |
[ 3. Approves & Locks NFT ] | |
| Clicks 'Approve NFT' | |
+---------------------> [ Wallet Tx: NFT.approve() ] |
| Clicks 'Lock NFT' | |
+---------------------> [ Contract.lockInitiatorNFT() ] |
| |
V |
[ Alice's NFT is locked ] |
(Status: Awaiting Response) |
| |
| |
| [ 4. Sees Pending Swap ]
| | Views offer details
| |
| [ 5. Approves & Completes ]
| | Clicks 'Approve NFT'
| [ Wallet Tx: NFT.approve() ] <--------------------+
| | Clicks 'Complete Swap'
| | Enters the Secret
| [ Contract.lockResponderNFTAndComplete(secret) ] <----+
| |
V |
[ Contract verifies Secret, locks Bob's NFT ] |
| |
V |
[ ** ATOMIC SWAP EXECUTES ** ] |
| Alice's NFT -> Bob |
| Bob's NFT -> Alice |
| |
V |
[ SWAP COMPLETE ] |
| | |
| | |I started with the contract design, I build the complete contract during the hackathon phase. Following which I focused on the frontend development. The project is still in MVP phase and is deployed on the testnet. Further improvements await.