How to develop blockchain-based lending platform
A lending platform is a marketplace that allows for lending and borrowing money directly from individuals or from a pool. Thus, it helps to omit traditional financial institutions like banks or any other third party intermediaries. The system has proven its usefulness for both fiat and cryptocurrency markets.
Crypto lending platforms started to attract more and more liquidity with the boost of DeFi. Therefore, we want to share our experience on how to create a DeFi lending platform from scratch or add blockchain to your current p2p lending solution.
Follow this navigation to find the right answers:
We will also tell the difference between p2p and pool-based lending and describe the advantages and disadvantages of both.
How Blockchain Could Improve P2P lending platform
A peer-to-peer (P2P) lending is a commonly known practice of getting financing from the individuals directly through the digital services. The platform connects lenders with borrowers through the application interface and allows for a number of advantages for both sides of the deal.
First of all, it offers better interest rates for lenders and more flexible time frames along with lower return rates for borrowers. However, despite the numerous pros and privileges the system offers, the p2p loans are often called unsecured loans due to the lack of collateral, enough level of transparency and tracking.
This is where blockchain can help.
The introduction of blockchain to the current p2p lending solution may turn to the list of benefits. Blockchain peer to peer lending help to resolve the following issues:
Since a majority of p2p lending services are centralized, the application management along with the whole loan transfer process is held by the platform. In blockchain p2p lending, the main job will be held by a smart contract that avoids a middleman involvement and leads to a higher level of program automation.
Blockchain technology ensures versatility and immutability of data. The main advantage of this feature is that once the information is provided to the system it cannot be changed or deleted. This can significantly increase the level of security for peer-to-peer lending users.
The distributed ledger technology used in the sense of data storing is able to create transparency and decentralization within a trustless environment. Thus, adding blockchain technology to your current p2p lending service may lead to easier data tracking and the highest level of transparency.
How to add blockchain to your current p2p lending solution
In this part we would like to tell you how to secure a lending platform with the integration of blockchain based solutions. Those are several fundamental steps for creating a Blockchain P2P lending platform:
Define your business case
In Blaize we often conduct business analysis of the clients use case during the discovery stage. The thorough research of the case’s exact business goal helps to define the right scope for development and justify the blockchain adoption.
See how Blaize team works on SRS and technical task preparation during the business analysis of our projects.
In terms of integrating blockchain into the existing solution, the platform already has its own business case and the task for developers is to know how to translate or transform it to the blockchain.
Choose the best blockchain
It will probably be very hard to define just one or two of the best blockchain platforms. Mainly because every project has its unique requirements and available toolset so every case should have detailed research to pick the best solution.
From our experience, we can say that Substrate framework with its modularity can be a very suitable option for blockchain P2P lending platform development. As an alternative, you can see the R3 Corda blockchain solution. Its permissioned access nature along with chaincode structure can add additional points to the security p2p services needs.
Find detailed explanations OF MENTIONED BLOCKCHAINS IN BEST PLATFORMS FOR BLOCKCHAIN DEVELOPMENT.
Smart contract development
The development of initial smart contract architecture is one of the vital parts of adding blockchain to your existing peer-to-peer lending.
When building smart contracts for a p2p lending platform, the main goal is to establish which data are stored on-chain and which are stored off-chain.
For example, with a high level of trust within the platform, the on-chain part can store transaction IDs, user IDs, and transferred amounts, relying on the fact that the main part of data is stored in the database and can be provided any time by the platform itself. We recommend storing as little as possible on-chain, but all stored data should be available for validation.
Since all data is stored on-chain and is easily validated, the process of collecting debts by collectors (as well as bargaining in overdue debts) becomes more convenient. On the other hand, the biggest challenge is to configure this process with KYC to prevent leakage of private and sensible client data as blockchain (in most cases) provides public access to all on-chain information. That is why, defining the explicit amount and format of on-chain data is crucial in this case.
We shall remind you that every developed smart contract requires unit tests coverage before making integration with the application. Thus, the developers’ team check the proper work of formal contract logic. The additional implementation of smart contract security audit on its part helps to evaluate whether the developed environment meets business case requirements and works in a proper way.
Summarizing this part integrating blockchain to the p2p lending solution might bring a lot of advantages and increase platform’s security. Hence, the implementation needs a qualified business analysis in order to justify the relevancy of blockchain technology adoption.
DeFi crypto lending platform
Previously discussed peer-to-peer lending services may offer a wide list of possible currencies for loans and ways of its management. Thus, building a peer to peer lending blockchain platform or integrating smart contract technology to the existing one enables following loan options:
- fiat to crypto and vice versa (MyConstant),
- crypto-to-crypto loans (Lendoit).
In contrast, DeFi crypto lending platforms are concentrated on crypto-to-crypto loans where stablecoins are the most preferable assets. The other distinctive feature of DeFi lending is the necessity of providing the collateral in a form of other cryptocurrencies offered against the loan.
Often, ETH (or Bitcoin) is used as a secured form of collateral, yet many platforms also use DAI as sufficient insurance. The majority of lendings in decentralized finance establish a very high loan-to-value (LTV) ratio, even up to 60% which means the borrower will get less than 60% of needed crypto in comparison to the collateral provided.
However, the principle of decentralization, anonymity, and the possibility of getting a loan in a trice is the advantage that distinguishes DeFi lending pools. Additionally, this type of lending creates very convenient opportunities for borrowers who like to take part in margin trading.
The instantaneous growth of DeFi has attracted an impressive amount of liquidity that helped some protocols gain an absolute market priority. AAVE, Maker, Compound, dX/dY are just a few among the top DeFi platforms that offer lending opportunities for their users.
Read the full list of Most Successful DeFi Startups in this article.
In the next part of this article we want to concentrate on how to build a successful defi lending platform in 2021. So if you want to create something similar to AAVE or Compound crypto lending read further parts.
How to create a DeFi lending protocol
Entering a decentralized finance market becomes challenging due to the growing amount of successful and working projects. In this part, we want to tell you how to start building a custom crypto lending platform.
Detailed use case analysis
In order to make your lending dApp prosperous and useful, you need to prepare an analysis of your business case. There is a high chance for a project to go into dust due to a lack of strong business logic and use case justification.
During the discovery stage, Blaize experts consider perspectives of product delivery to the market, tokenomics and product main features to adjust the best operating environment. After every discovery phase, we prepare a Software Requirement Specification (SRS) document and provide it to the client.
The distinctive feature of DeFi lending platform against p2p lending service is the possibility of token issuing with its further listing on the exchanges. The ability to possess a protocol token allows its users to get additional benefits from liquidity mining. Therefore, if you consider this feature as a prior, you should prepare a thorough tokenomy analysis at the discovery stage.
Architecture planning & initial development
Blaize team of DeFi developers has developed and deployed a significant number of smart contracts. That is why we know all the obstacles inexperienced programmers might face and strongly recommend choosing a solid blockchain contractor to develop your crypto lending platform.
During the initial project planning of DeFi lending protocol, the important thing is to establish the type of lending pool and the interest accrual format.
There are basically two types of pools – isolated pools (like trading pairs on Uniswap) or give access to all the coins of the protocol (like Compound) that allows you to leave any coin for any asset as collateral. The next thing is to consider between fixed (Torque) or floating interest rates (Compound) and perform the right architecture planning in advance.
The usage cost of smart contracts is one of the biggest challenges developers confront while developing DeFi lending. Such specifics of decentralized finance projects as gas optimization may cut down even a good and reliable smart contract because it will be simply too expensive for users to pay for gas.
Testing & project launch
DeFi lending protocol surely deals with a huge amount in swaps and therefore big capitals are at stake. The main goal of testing is to check that there is no possibility to block the pool, as this will make the collaterals irrecoverable.
The eventual transfer issues may lead to the block or loss of user collateral which is very painful because it’s always greater than the loan itself. In addition, the team should eliminate the possibility of leaving shitcoins as collateral, so that the user cannot take something valuable for something unnecessary.
Considering all of those points, Blaize team always prepares several levels of project testing to eliminate transferring issues or money locked into smart contracts.
The market has seen a lot of projects launched without proper testing in the dev environment or security audits of smart contracts. The experience shows this practice has faced a lot of problems regarding security issues and numerous hacks on the DeFi projects.
See the detailed overview of the most significant events regarding DeFi security in those articles:
- How to Prevent Liquidity Vampire Attacks in DeFi?
- DeFi Security: How to Prevent Your Project From Hacking?
From this article, you know how to create a DeFi lending platform or integrate blockchain solution to your current p2p lending service. As you see the process of development may vary and should contain a prior analysis of the main business goal and use case.
Every approach has its own pros and cons and needs to be studied carefully before starting the initial development. Go through the table of advantages and disadvantages comparing both.
Blockchain P2P lending vs DeFi lending protocol comparison
|P2P Blockchain-based lending||DeFi lending pool|
+ individual interest rate
+ gas fees price savings
+ no need for crypto collateral (in the majority of cases)
+ wider lists of loaning options (fiat to crypto
(CoinLoan) and vice versa, crypto-to-crypto loans)
+ well-known and trustable practice
– prolonged operational time
– less decentralization
– no (direct) liquidity mining opportunities
– KYC obligation
|+ the highest level of decentralization and anonymity |
+ instant loans (flash loans in AAVE or Uniswap)
+ easier/faster access to other DeFi opportunities
+ liquidity mining opportunities with native protocol token
+ fixed interest rates in some protocols (Torque)
+ no KYC
– the terms of the loan are often limited by collateral only
– high LTV ratio
– crypto collateral obligation
– higher gas fees limited to crypto loans only