4 ms·
Each transaction spending the locked funds bears the signature of the party making the payment. The other party can then provide the counter-signature making th
by apo 9y ago
Each transaction spending the locked funds bears the signature of the party making the payment. The other party can then provide the counter-signature making the transaction valid on the Bitcoin network.
The main security problem to solve is preventing one party from publishing a previous channel state (half-signed transaction) giving themselves more money than they actually have by rights.
For example, Alice and Bob might start with a channel giving each of them 5 bitcoin. Then Alice makes two one-bitcoin payments to Bob:
A | B
------
4 | 6
3 | 7
Alice decides she wants to take back her last payment and instead publish the earlier transaction (signed by Bob) giving herself 4 bitcoin rather than the one giving herself 3.
This problem is solved with hashed timelock contracts (HTLCs). Without getting too technical, HTLCs make it possible for a party who spots a counterparty attempting to publish an invalid transaction to take all of the money in the channel (i.e., Bob would take all 10 bitcoin). The main idea is that cryptographic hash functions are one-way. If I make a payment contingent on knowing a preimage to a hash value, I can cause the payment to become valid by revealing the preimage.
Along with the signature to a transaction, Alice must also give Bob the preimage for the previous transaction before he will accept it. When she does, Bob knows that if Alice tries to play games, he can take all of her money.
This video gives a high-level overview:
https://www.youtube.com/watch?v=MpfvhiqFw7A https://www.youtube.com/watch?v=MpfvhiqFw7A
- vagab0nd 9y agoThis makes sense. However, this also means as one party of the off-chain transaction, I need to constantly monitor the main chain to make sure the other party doesn't try to screw me up. And if they do I need to publish the contract before they spend the money. Is this correct? And how can this be made 100% bulletproof?