Glintfund - A Decentralized Funding and P2P Lending/Borrowing Platform on Tron

Introduction

Glintfund is a decentralized funding platform that incorporates peer-to-peer (P2P) lending and borrowing, built on the Tron blockchain. It allows individuals and organizations to raise funds for various purposes such as personal needs, investments, and projects while utilizing a P2P lending/borrowing feature. Lenders can create proposals and borrowers can select the offers that best suit their needs, creating a flexible and transparent lending system. Built on the Tron blockchain, Glintfund offers fast, low-cost transactions and decentralized governance through token rewards.

Inspiration

Glintfund was inspired by the challenges faced by individuals looking to access decentralized funding solutions, as well as the growing need for P2P lending in the decentralized finance (DeFi) space. Many people are affected by volatile markets, and they often want to borrow stable assets against their volatile holdings without liquidating them at a loss. I wanted to create a platform where users could interact in a trust-less environment, negotiate lending terms directly, and raise funds with the security of blockchain technology.

The idea of allowing users to post loan proposals and letting borrowers search for favorable terms was especially appealing, as it adds flexibility and user empowerment. The platform is designed to serve anyone, from individuals needing quick financial support to large-scale projects seeking decentralized loans or support.

What I Learned

Building Glintfund was an enriching experience that taught me valuable lessons, particularly around decentralized finance (DeFi), P2P lending, and the Tron blockchain ecosystem. Specifically, I learned how to:

  • Implement DeFi mechanisms for lending and borrowing, including ensuring secure collateralization through smart contracts.
  • Leverage the Tron blockchain for building decentralized applications, utilizing its fast transaction speeds and low fees, which are crucial for financial applications.
  • Deploy smart contracts on Tron using TronBox and interact with them using TronWeb.
  • Optimize energy and bandwidth usage on the Tron network, using the Nile testnet to acquire bandwidth and energy for contract deployment and interactions.

How I Built the Project

Smart Contracts

Glintfund’s core functionality revolves around Solidity-based smart contracts deployed on the Tron blockchain. Below is a breakdown of the contracts developed:

  • Funding Contracts: These contracts allow users to request funding for specific purposes. They securely manage contributions from other users and track the funding progress.

  • P2P Lending/Borrowing Contracts: The most innovative aspect of Glintfund is the P2P lending and borrowing system. Lenders can create lending proposals specifying loan terms (e.g., interest rate, duration, collateral), and borrowers can browse these proposals and accept the ones that fit their needs. Borrowers can lock up collateral (volatile tokens like Tron) to secure a loan, and the contract ensures that lenders are paid back with interest or claim the collateral in the event of a default.

Key Features of the Lending System:

  • Collateral Management: Borrowers can use volatile assets (e.g., TRX) as collateral without having to liquidate them, ensuring they can still benefit from future price appreciation.
  • Loan Proposals: Lenders create custom loan proposals, which are listed for potential borrowers to browse and accept.
  • Secured Repayment: The contract locks collateral until the borrower repays the loan plus interest, ensuring lenders are protected.
  • Penalties for Default: In case of a default, the contract automatically transfers the collateral to the lender.

Frontend Development

The frontend of Glintfund is built using modern web technologies and integrates seamlessly with Tron blockchain through TronWeb. Here’s how it was built:

  • React: The UI was built using React to provide a fast, scalable, and modular interface. Users can easily navigate the platform, create funding requests, browse lending proposals, and monitor their transactions.

  • TailwindCSS: TailwindCSS was used for styling, making it easy to maintain consistency across the interface with utility-first classes. It ensures that the platform is mobile-responsive and provides a sleek user experience.

  • TronWeb: TronWeb was integrated to enable the frontend to interact directly with the Tron blockchain. This library allows users to connect their wallets (e.g., TronLink), make transactions, and interact with smart contracts securely.

  • TronLink Wallet: We integrated TronLink for user authentication and transaction signing. Users can manage their TRX holdings, collateral, and lending agreements directly from their wallets.

Frontend Process:

  1. User Interface:

    • Designed the UI/UX with the goal of making decentralized finance accessible to everyday users. Pages include:
      • Funding: Where users can post funding requests and monitor their campaigns.
      • Lending Marketplace: A marketplace for lenders to post proposals and borrowers to browse terms that suit them.
      • Dashboard: Users can track their active loans, repayments, and funding requests.
  2. Smart Contract Integration:

    • Using TronWeb, we connected the frontend to the deployed smart contracts. Users can create loan requests, contribute to funding campaigns, accept loans, and repay them directly from the interface.
  3. Responsive Design:

    • The platform is fully responsive to ensure users can access the platform from any device, whether mobile or desktop.
  4. Testnet Deployment and Validation:

    • We used the Nile testnet to test and deploy our contracts. Users can interact with the contracts on the testnet before launching on the mainnet.

Deployment Process

Tools Used:

  • TronBox: We used TronBox to compile, deploy, and manage smart contracts on the Tron network. TronBox allowed us to deploy our smart contracts seamlessly on both the testnet and the mainnet.

  • TronWeb: This was used to facilitate interactions between our frontend and smart contracts, allowing users to sign transactions and interact with the blockchain directly from the frontend.

Energy and Bandwidth Optimization:

  • We deployed our contracts on Tron’s Nile testnet, where we acquired energy and bandwidth to cover the cost of deploying and interacting with contracts. The use of Tron’s staking system for energy and bandwidth ensured low transaction costs.

Challenges Faced

  1. Smart Contract Complexity:

    • The complexity of combining a traditional funding platform with a P2P lending system required careful design of smart contracts, especially ensuring the security of collateral and protecting lenders from default.
  2. Tron-Specific Development:

    • Transitioning from Ethereum-based development to Tron required learning new tools like TronBox and TronWeb. Although Tron offers lower gas fees and faster transactions, it also comes with a learning curve.
  3. Docker Integration with TronBox

    • To streamline the development, testing, and deployment of Glintfund’s smart contracts, we utilized Docker. Docker allowed us to create an isolated, reproducible environment that made the setup of our development environment quick and consistent across different machines.
  4. Energy and Bandwidth:

    • Deploying smart contracts on Tron involves managing energy and bandwidth, which was a new concept compared to Ethereum’s gas fee model. We had to make sure we acquired enough energy and bandwidth for contract deployment and user interactions.
  5. Testing and Debugging:

    • Running extensive tests on the Nile testnet and locally to ensure that the platform worked as intended took time and effort. We needed to test various edge cases, including loan defaults, collateral recovery, and funding request fulfillment.

What's Next for Glintfund

  • Mainnet Launch: We plan to launch the platform on Tron’s mainnet, allowing users to create real funding campaigns and loans.

  • Additional Collateral Options: We will expand the collateral options to include more tokens on the Tron network, giving users more flexibility in securing their loans.

  • DAO and Governance: Our future roadmap includes developing a DAO where users can vote on platform upgrades and governance decisions using governance tokens they earn through contributions and lending activity.

  • Cross-Chain Expansion: We plan to make Glintfund a cross-chain platform, allowing users to raise funds and lend across multiple blockchain ecosystems such as Ethereum, BSC, and Solana.

Built With

Share this project:

Updates