10 sats \ 0 replies \ @supertestnet OP 1 Jan \ parent \ on: Loan shark: Super Testnet's non custodial, bitcoin only borrow and loan tool bitcoin
That's how I look at it too. It's good enough to get the job done and the more I do these videos the better I will get at them.
Good idea!
Thank you, thank you
I think it is fascinating too, I'm so glad I get to do this stuff every day, and show people stuff they never thought was possible on bitcoin
Depositing money into the contract address happens in one atomic swap transaction, in which the borrower pays the fee. The swap works like this:
(1) The borrower tells the lender a utxo he intends to deposit into the contract address as collateral
(2) The lender picks a utxo to send to the borrower as principle, and creates a bitcoin signature. This signature is valid for a transaction with two inputs (the borrower's utxo and the lender's utxo) and three outputs: (a) the first output will fund the contract address with the amount of the collateral. (b) The second output sends the borrower's change back to him with three variations: the amount of the collateral is subtracted from this utxo's value, the mining fee is subtracted from this utxo's value, and the amount of the principle is added to this utxo's value. (c) The third output sends the lender's change back to him minus the amount of the principle.
(3) The lender sends the signature to the borrower along with info about the utxo he used as input to the transaction
(4) The borrower validates that the signature unlocks the lender's utxo for use in this transaction, and if the signature is valid, he creates a second signature, valid for the same transaction but unlocking his own utxo (the one he picked in step 1) rather than the lender's utxo
(5) Then the borrower adds both signatures to the transaction and broadcasts it. The signatures make the transaction valid, so miners mine it.
So I deal with the fee by having the borrower pay it
I think there is a way to make it work on lightning, I will consider this further
I decided the borrower should pay the fee because he is essentially purchasing a loan contract from the lender. If he doesn't think the fee plus the interest rate is worth it he can just not take the offer. Free market decision making should find an appropriate rates for these loans.
I hope so, I suspect they will prefer whichever transactions pay them more money