Bitcoin Forum

Bitcoin => Project Development => Topic started by: maclane on November 14, 2014, 05:59:37 PM



Title: Secured Lending with Smart Contracts
Post by: maclane on November 14, 2014, 05:59:37 PM
Hi bitcointalk,

I'm writing a smart contract for secured lending (BTC collateral) on the blockchain and I'm thinking of two possible implementations. Both depend on an independent oracle in certain situations. In one case, the lender depends on the oracle to perform and in the other case, the borrower does.

Any thoughts/criticisms of either contract would be appreciated! Does either have a clear weakness I'm missing? Is secured lending on the blockchain even useful? Thanks!

**Collateral Refund Txn with nLockTime**
- Borrower escrows BTC to a multisig address (2-of-3: borrower, lender, independent oracle) and gets lender to sign an nLockTime refund txn that becomes valid some time after the loan expires
- Lender sends loan to borrower
- If borrower defaults, an independent oracle and the lender will claim the escrowed BTC, otherwise borrower will reclaim her collateral once the nLockTime txn becomes valid
- In this case, lender is dependent on oracle to perform if borrower defaults

**Secret Number**
- Borrower escrows BTC into a P2SH address that is redeemable using borrower sig + lender sig OR borrower sig + secret number (known only by lender) OR borrower sig + oracle sig
- Borrower signs a txn paying collateral to lender with nlocktime set to some time after the loan expires and sends it to borrower
- Lender sends loan to borrower
- Borrower repays loan to P2SH address that is redeemable with the same secret number as above
- If borrower repays as expected, lender will claim repaid funds using the secret number (making it public) and borrower will then use the secret number to reclaim his collateral before the lender's nLockTime txn becomes valid
- If borrower defaults, the lender will seize his collateral using the previously signed txn once the locktime expires
- If lender fraudulently refuses to sign for satisfactorily repaid funds (for example, BTC collateral has gone up in value so he prefers to take that instead) borrower and oracle can reclaim collateral
- In this case, borrower is dependent on oracle to perform if lender acts in bad faith