4.12 Workshop: Secured Loan

This workshop assumes that you have recently completed Workshop: Trust Fund.

In this workshop, we implement a secured loan, wherein a Borrower posts collateral and terms to the public, and an arbitrary Lender gives a loan, then after some maturity, the Borrower either repays the loan, plus interest, or sacrifices the collateral. It is easy to model this scenario using only network tokens, but it would be useless, because the premise ofa loan is that the participants believe the Borrower can make better use of the funds than the Lender. However, many consensus network also support custom fungible assets that are like tokens. If this is the case, then a secured loan will typically have different assets as the loan amount and the collateral amount. Thus, the interest rate for the loan is essentially the Lender’s prediction of the movement of the exchange rate between the two currencies over the lifetime of the loan.

This page is a placeholder for a future more detailed workshop. You could try to implement yourself though, given the sketch above! If you’d like to see a draft version of our code, please visit examples/secured-loan in our GitHub repository