Inspiration
Global access to financial markets is still highly unequal. Many people cannot easily trade U.S. stocks due to geographic restrictions, high brokerage fees, or regulatory barriers. At the same time, decentralized finance (DeFi) has demonstrated that financial infrastructure can be built in an open, permissionless way and in this rapidly evolving world of decentralized finance (DeFi) has opened up new possibilities for financial innovation.
I thought it'd be a good idea if somebody could buy stocks from their wallet represented by NFTs which are collateralized with real stocks. and it gives user to use there assets for borrowing, lending or just sell them in p2p market bringing traditional financial assets like stocks into a decentralized ecosystem. By tokenizing stock exposure as blockchain assets, users anywhere can participate in markets and unlock new forms of liquidity.
What it does
defi-TReX (defi-nex) is a decentralized next-gen peer-to-peer platform (marketplace) for tokenized stocks that lets you buy NFTs representing tokenized exposure to real-world stocks which in theory can be made available to any body across the globe without much paperwork.
Users mint NFTs representing tokenized stock assets, which can then be listed on the marketplace or used as collateral for peer-to-peer lending offers.
Users can: Hold tokenized representations of real-world assets Trade these assets directly with other users Create peer-to-peer lending offers using tokenized stocks as collateral Discover and interact with assets through a simple Web3 interface By combining tokenization and DeFi lending mechanisms, defi-TReX (defi-nex) enables new liquidity opportunities for traditionally illiquid financial assets.
How we built it
The project consists of three main layers: smart contracts, a web interface, and blockchain infrastructure.
Smart Contracts We implemented the core protocol in Solidity, including: An NFT contract representing tokenized stock assets A peer-to-peer marketplace contract that enables lending and trading These contracts were developed and deployed using Foundry, with Anvil used for local blockchain testing on a blockchain that's bitcoin L2 but fully evm compatible
Frontend The user interface was built with: Next.js React TypeScript
Wallet connectivity and contract interaction were handled using Next.js with wagmi and viem, which allowed the frontend to communicate directly with smart contracts through an Ethereum-compatible RPC node.
Authentication User sessions and wallet-based authentication were implemented using NextAuth.js, integrated with Web3 wallet connections.
Challenges we ran into
One of the biggest challenges was no chainlink oracle support, so it was hard to get accurate pricing, consuming data from third party APIs and maintaining data integrity, keeping it decentralized.
And also working with blockchain network configurations and contract integrations. Ensuring that the frontend correctly interacted with deployed contracts required careful handling of chain IDs, RPC connections, and contract address mappings.
Another challenge was building a peer-to-peer marketplace logic that safely coordinates offers between lenders and borrowers. Designing contract interfaces that remain flexible while protecting user funds required careful structuring of state and transaction flows.
We also faced the typical complexity of full-stack Web3 development, where issues can arise across three different layers simultaneously: the frontend application, the smart contracts, and the blockchain network.
Accomplishments that we're proud of
Succesfully mint asset NFTs and trade with them in the p2p market and continuing developing despite early uncertainty about the system working end-to-end.
What we learned
Balancing decentralization with user experience in DeFi applications. The importance of thorough testing and simulation in automated financial systems.
How to design tokenized representations of real-world assets. Best practices for smart contract architecture and deployment using Foundry How to integrate Web3 wallets into modern React applications
The importance of network configuration and contract address management in decentralized applications Most importantly, we gained a deeper understanding of how decentralized infrastructure can expand access to financial markets and enable entirely new economic models.
What's next for defi-TReX (defi-nex)
Expand our cross-chain capabilities to include more blockchain networks. Bring chainlink price feeds and ccip support. With defi-TReX (defi-nex), we're not just building another DeFi platform – we're creating a new paradigm for decentralized finance that empowers users to take control of their financial future in ways never before possible.
Built With
- ai-clients
- anvil
- aylys
- blockchain
- evm
- forge
- foundary
- gemini
- javascript
- next.js
- nextauth.js
- node.js
- openzeppelin
- react
- solidity
- typescript
- viem
- wagmi
- web3
Log in or sign up for Devpost to join the conversation.