Before the borrower deposits their collateral they get a signature from the lender that uses tapleaf 2 to send the collateral back to the borrower. But this signature is only valid for a transaction that sends the principle plus interest to the lender. So if the borrower wants to take back the collateral he can do it at any time but only by using that signature plus one of his own, which means he can only do it if he pays the lender the agreed upon amount.
signature is only valid for a transaction that sends the principle plus interest to the lender
That's interesting, didn't know it was possible to enforce something like this but it makes sense.
reply
Here is where a dead man is a risk to the borrower? Does this risk mean that a lender needs a dead man script that returns the collateral if there is not a signature available for acknowledgement of repayment after the duration closes?
reply
The death of the lender is not a risk to the borrower because he gets the signature he needs before any money gets deposited into the contract address
The signature is created by the lender in advance and shared with the borrower, and it is valid for any transaction that meets these two criteria: (1) it spends the utxo the borrower intends to deposit into the contract address, which the borrower tells the lender when he accepts the loan offer (2) it sends the lender an amount equal to the principle plus interest
So if the lender dies mid contract it has no effect on the borrower. He can still pay off the loan using the signature he already has, and send the collateral to himself. If he uses the signature he already has, the transaction will be valid as long as the transaction also sends the principle plus interest to the now-dead lender (which is exactly how it should be -- those were the terms of the original agreement, and bitcoin doesn't know the lender died)
reply
Thank you for clarifying that. The lender would need to somehow back himself up but the borrower is not affected.
reply
The lender can use the backup button to download a copy of his transaction details and tell his heirs about the contract. They can then upload the backup file to the website the day the contract expires, and the website will automatically sweep the collateral into their wallet for them if necessary, otherwise it will show them that the borrower paid off the loan and their new balance will show up as expected in the wallet
reply
Nice! I hope you can use this for the manual! Great stuff.
reply