[bisq-network/proposals] Fixed term BTC loans against BSQ collateral (#176)

Steven Barclay notifications at github.com
Tue Feb 11 19:24:24 UTC 2020


> _This is a Bisq Network proposal. Please familiarize yourself with the [submission and review process](https://docs.bisq.network/proposals.html)._

#### Basic Idea

In a similar vein to the BTC-BSQ atomic swap idea proposed in #50, I believe we may use the special properties of the BSQ token to implement on-chain collateralised BTC loans in a fairly safe and simple way.

To set up a loan, a BTC lender can create and sign a repayment transaction (which atomically repays the lender and returns the locked up BSQ collateral) using [_SIGHASH_ANYONECANPAY_](https://en.bitcoin.it/wiki/OP_CHECKSIG). Crucially, this allows the borrower to add whatever input(s) he pleases when closing the loan, so the repayment can be any valid source of BTC whose amount exceeds the tx output sum.

Additionally, the borrower signs and sends the lender a timelocked transaction to confiscate (i.e. pay to a lender-supplied address) their collateral in the event that they default.

Upon exchange of these two prepared transactions, the borrower may then safely lock up their BSQ collateral in a 2-out-of-2 multisig address in exchange for the BTC loan. This may be done either as a BTC-BSQ atomic swap as described in #50 or using the existing trade protocol.

Repayment before the deadline (or confiscation in the event of default) may then be done unilaterally, without needing any cooperation or contact with another party.

#### Motivation

Due to the very limited trade fee revenue right now, there is a lack of liquidity in the BTC-BSQ market and any modest increase in sell pressure is apt to plunge the price. This was particularly bad a couple of weeks ago (at the end of January), it seems, where BSQ was trading at less than 5000 sats, even though it's been around double that for the previous six months, as seen in the dashboard:

![Screenshot from 2020-02-11 01-52-48](https://user-images.githubusercontent.com/54855381/74205960-52a85380-4c71-11ea-955e-5ed51540e701.png)

Under such circumstances, BTC loans would possibly have been very useful. It would have made a lot more sense for those impatient to sell their BSQ to simply borrow BTC against it, instead of selling it anomalously cheap and crashing the price further. In short, loans could be a useful way to provide a short term cash injection to prevent a liquidity crisis, allowing BSQ sellers to get a fairer price.

Perhaps more controversially, such loans to individual BSQ holders could be seen as a means by which the DAO can effectively borrow money collectively, which could then be used to fund growth without having to worry too much about balancing the budget in the short term. Much like a startup receiving a bank loan to fund crucial development prior to becoming profitable and then needing to pay it back. In the event that too much money is borrowed, a long squeeze would ensue, causing many borrowers to default and much of the BSQ used for staking ending up in the hands of the creditors.

#### More Detailed Example

Suppose Alice were to borrow 0.5 BTC from Bob against a 10000 BSQ collateral, repayable after 2 months with 5% interest per month (80% APR). Then any time before the 2 month deadline, Alice must pay Bob 0.55125 BTC to claim back her collateral. This could proceed as follows:

1. Upon Alice taking Bob's offer of a loan, Bob sends Alice his public key for the 2-2 multisig BSQ collateral lockup, as well as his BSQ confiscation payout address.
2. Alice signs and sends Bob the timelocked confiscation transaction, with 2 inputs (BSQ collateral at P2SH address + BTC mining fee) and a BSQ output. This is possibly also anyone-can-pay & SIGHASH_SINGLE to allow Bob to add whatever mining fee he pleases (or alternatively have Bob construct the tx). Alice also sends Bob her BTC loan receipt address and her BSQ collateral repayment address.
3. Bob creates a payout tx template, signs it using SIGHASH_ANYONECANPAY and sends it to Alice. The template has a BSQ input (collateral at P2SH address) and 2 outputs (BSQ collateral repayment + 0.55125 BTC repayment & interest to Bob). Bob also sends Alice an unsigned partial tx paying out his 0.5 BTC loan to her (and returning any change to him).
4. Alice adds her BSQ collateral input, P2SH BSQ lockup output (and possible BSQ change output) to the tx and signs it.
5. Bob signs and publishes the loan payout tx received from Alice. This atomically swaps Bob's loan for Alice's collateral, opening the loan.
6. Less than 2 months later, Alice adds her (single) BTC input to the anyone-can-pay tx template provided by Bob, with input large enough to cover the output sum and mining fee. She then signs and publishes this, closing the loan.

As an alternative to the last step, we could have:

6. Alice is late with her repayment. Bob adds his mining fee to the timelocked (anyone-can-pay) confiscation tx provided by Alice, signs and publishes it, closing the loan by claiming her 10000 BSQ collateral.

#### Integrating into Bisq

I think we should consider integrating something like the above into the Bisq application, as this (as well as atomic swaps to reduce trade friction) could improve BTC-BSQ liquidity. It may also pave the way for other kinds of loans or some form of decentralised margin trading in the future. However, it would probably be a lot of work to add entirely new trading protocols, offer types and views to the UI for a separate loan market.

As an alternative, it may be possible to reuse the existing trade interface by implementing such loans as a special kind of altcoin - a non-fungible, once-transferrable token created by the borrower upon commencement of the trade. Then the "altcoin buyer's" (i.e. lender's) receipt address would be a concatenation of their BTC repayment address and their BSQ confiscation payout address. The normal trade protocol would have to be modified to exchange the partially signed final payout and confiscation transactions (prior to locking up the collateral). Then the collateral payment could contain an OP_RETURN with a hash to prove that those transactions were correctly exchanged in accordance with the modified protocol. Thus the borrower can prove to a mediator that he "paid" (i.e. locked up his collateral correctly) in the event of a dispute. (Alternatively, for extra safety, the OP_RETURN could contain everything needed to reconstruct both the signed payout and confiscation transactions.)

In this model, the "price" of the loan buy/sell offer would probably be the APR. We would also need to record other details in the offer book, namely the repayment date and the collateral amount, viewable in the offer details prior to taking it.

Integrating into the existing trade interface in this way would probably only need one new tab under the DAO part of the UI to view, create and manage all the BSQ-collateralised loans, both for the lenders and the borrowers.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/proposals/issues/176
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200211/54f902e0/attachment-0001.html>


More information about the bisq-github mailing list