Flow Of The P2P Lending Protocol

Olaf Tomalka
Getline.in
Published in
4 min readSep 13, 2017

--

The GetLine Network is a vast undertaking that will take a considerable amount of time and resources to jump-start, nevertheless we really want to show users a glimpse of the future we’re building. That’s why we’re creating a technical demo that showcases an example flow for the borrower. The architecture is similar, yet simplified, and thus I believe that I should explain how it works and the differences.

The first obvious thing is there aren’t any common GET tokens yet that could be used as collateral, we need placeholder tokens. For that reason, we created 3 demo tokens with infinite supplies. One that is used for collateral of demo loans, and two others for loaning, so that people can test out how it works without the fear of losing any assets. We distribute them with the help of a central printing authority contract, which when asked nicely will print a set amount of each token for the recipient. Since we know exactly which tokens you’re getting we can easily show them in the application interface and allow you to understand your assets at a glance.

Ethereum flow of how tokens are printed

Demo loans don’t provide proper security for the investors and so any other ERC20 tokens won’t be supported.

After you have enough tokens to do anything we’ll take you through the process of actually requesting the loan. Pretty standard stuff, like the title, description, how much you want to borrow, and what kind of token, what’s your collateral amount, how much of a percentage you’re willing to pay to the investors, etc. Afterwards the loan is created, listed, and a week of fundraising begins in which the investors would be able to see and invest in the loan itself.

The parameters of the loan you want to take

An interlude is in order. See, because putting data on-chain is expensive (explicitly expensive, each character put on block-chain costs actual money, and with the current exchange rates it’s cents per one actually). Because of this we’ve opted to save the title and description in a centralized backend. While the deployed Loan contract has all the data it needs to conduct a proper loan in terms of the math, we’re holding the data needed for a user-readable listing of such a loan. Putting that data on blockchain wouldn’t be useful at all, since the virtual machine doesn’t provide any listings of active loans. That is the responsibility of the Getline Network’s application layer. With the help of web3 APIs we can additionally link listed loans to a specific wallet that created them, and so, if you have any supported Ethereum wallet installed, the next time you come back, you’ll be greeted with all the loans that you created. How? Because we’re saving each loan’s metadata in a centralized backend. We’re using Meteor as well as the included MongoDB instance.

What metadata is saved?

  • Loan’s status
    Is it deployed on Ethereum already, or does it need deploying yet
  • Loan’s parameters
    If the user stops midway through the process (for example if they reject the transaction in Metamask), we need to be able to reinstate the request for deployment, even if they refresh the page
  • Loan’s Ethereum address
    After it’s deployed we need an easy way to access it again
  • Loan’s owner’s wallet address
    Useful to list all your loans at once without searching the whole blockchain

Now, that the interlude’s finished, you’re in the the fundraising phase of the Loan. Since there is no demo for the investors yet, we opted to have an automatic investor contract which puts out the money itself.

The frontend, after you’ve clicked the final button, on your behalf will ask the auto-investor to invest in the loan you created (and with your approval through Metamask). The auto-investor then prints additional tokens and puts them into your loan contract, enough to fulfill the fundraising phase.

Blockchain flow of the auto-investor

Now you’re left with your newly-borrowed capital and lenders to be repaid at a later date of your choosing (you did set a reasonable pay-back date during the loan’s creation, didn’t you?). If you miss the date, the loan’s gonna default, investor’s gonna get your collateral, and it’s gonna forever leave a mark on the blockchain, better not to do that. Fortunately, this is a demo, you can just print more tokens, but if that were not the case, your collateral would be gone and your credit score would decrease.

In the upcoming weeks, we’re going to describe details of the Loan contract itself, credit scoring and defaults. Stay tuned!

Got questions? Hit me up on Getline’s public Slack where I’m @ Olaf Tomalka

--

--