Blockchains promise a new world, but for the moment, they remain far removed from the real world. I wanted to find an idea that could bring these 2 worlds closer together, and also an idea that would allow me to learn how Substrate/Polkadot and Chainlink work.
For several years, I have been a donor for Kiva which connects individuals who lend money (dollars) to small borrowers. So the idea is to connect the borrowers' projects to a community of Blockchain users, ready to invest their digital assets :)
Disclaimer : this project is a pure proof of concept. No money nor cryptocurrency is spent, no project is really funded. I am not involved in the Kiva organization, I am just a regular user. All credits regarding to loans details, such as pictures and stories, go to the Kiva Team.
What it does
Bring real existing loans to a blockchain
The Ki.Dot project displays randomly picked real world loans (retrieved from Kiva) to the users.
Let's say we have a brand new token named Ki.Dot token (KD$). It's USD price is retrieved through the use of a Chainlink Oracle.
The users can lend some of their KD$ to the project of their choice. Many users can lend to the same project.
The loan is completed when the amount of KD$ converted to USD reach the loan amount : the KD$ are converted to USD and the loan is fund.
In the meantime, an identical amount of KD$ is staked or place in a pool : during all the loan, rewards are earned.
Each month, the borrower pays back : the payment is converted back to KD$, and reverse to the lenders with a fraction of the staked assets and rewards.
The earned rewards could be used to cover currency exchange risk or borrowers payment defaults.
All the transactions involved in this process are stored in the blockchain.
From a technical point of view
Technically, the project is all about developing a substrate blockchain, and connecting it to a custom Chainlink External Adapter, as an Oracle to bring real aggregated asset prices to the substrate blockchain.
See Ki.Dot Components.
- Price Feed External Adapter : Chainlink External Adapter that connect to the Chainlink Price Feeds to retrieve price feed upon Chainlink customer request.
- Price Feed Pallet : a substrate pallet to trigger chainlink request to the Price Feed External Adapter.
- Loans Pallet: substrate pallet that deals with loans ans lenders inside the Ki.Dot blockchain.
- Frontend: the User Interface to connect to the Ki.Dot blockchain.
How I built it
Building the Price Feed External Adapter
Updating the Chainlink/Substrate bridge
After studying the Chainlink/Polkadot project, it was clear that this stuff need an update in order to use the latest Substrate samples and documentation.
It takes me a couple of days to get the things work. As a result, 4 projects have been updated/built and tested:
Creating the Ki.Dot blockchain
The funny things started here :)
I tried some iterative developments to have something working quickly, then added more features :
- Building my own substrate blockchain, using samples from parity repositories
- Add the Price Feed Pallet, make it call my Price Feed External Adapter through the help of the Chainlink Pallet
- Craft a basic UI to call the Price Feed Pallet
- Add a first version of the Loans Pallet, with some basic features (store and lend loans)
- Add a simple react component to view and lend loans
- Call Kiva API to get real loans
- Enhance UI to have nice cards for each loan
- Add charity like feature
- Simulate paid back from borrowers
- Simulate some staking feature to demonstrate the full concept
Putting all things together online
As soon as I got something working, I tried to put it online.
I chose an online Kubernetes cluster provider and deployed all components on it:
- Chainlink nodes on the 3 testnets : Kovan, Rinkeby, Ropsten
- Some external adapters to help other guys from Discord ;)
- Chainlink Price Feed Adapter
- Chainlink Ki.Dot Adapter
- Ki.Dot blockchain with a load balancer to bring it to the world ! See it in action at https://ki.dot.ltk.codes/
Challenges I ran into
The whole project was a challenge, but in particular :
- Coding for the first time in Solidity, Rust and Go
- Get familiar with how both Chainlink and Substrate work
- Updating the Chainlink/Substrate bridge (Initiator/External Adapter/Pallet) to the latest version of Substrate
- Develop something working in a timely manner
- Speak English ;)
What's next for Ki.Dot, a substrate based blockchain to help micro funding
I don't know if this project will find its audience. It's a project that represents me quite well: both a very technical thing, and something done to help others.
But if there is any interest in it, I would like to :
- contact Kiva to see if they are interested (they already have a foot in the Blockchain)
- play with other cool stuff from Substrate, such as the Democracy pallet
- understand how the Defi can concretely help in this project
- meet awesome and inspiring people to help me
I don't know where this project is going, or even if it's going anywhere, but the Definitive Truth is that I've already much enjoyed the journey so far.
Thank you for reading me.