4

How Lightning Network handles double-spend? What will happen when the other person is not available online to enforce the integrity of the transactions?

PFB my understanding of the Lightning Network.

Lightning Network builds an additional layer on top of the Bitcoin network that enables instant off-chain transfer of the ownership of the Bitcoin. Lightning Network utilises bi-directional payments channels that consist of multi-signature addresses.  Meaning Bitcoin will be held in a multi-signature address where transactions will use a multi-signature address as their input and point at two different addresses as their output. The transactions inside the lighting network are not broadcasted to the bitcoin network as long the channel is open (in order to reduce the load on the blockchain).

In this example how is Alice prevented from double spending?

  1. Alice and Bob both send 0.05 BTC into a shared 2-of-2 multisig address. This requires a transaction on the Bitcoin blockchain.

  2. Alice wants to pay 0.1 BTC to Bob. a. Alice creates a new transaction B2 and changes the balance to 0.4 BTC to Alice and 0.6BTC to Bob. b. Alice signs B2 and sends to Bob c. Now Bob creates a new transaction A2 and changes the balance to 0.4 BTC to Alice and 0.6BTC to Bob. d. Bob signs A2 and sends to Alice. After step 2a (before Bob verifies the transaction), can Alice close the channel and double spend the money?

  • In your example both the transactions are identical. They have the same balances. – Matthew Charles Stannard Jan 1 '18 at 14:51
  • Thanks! Have edited the question. Need to know how LN is stopping Alice from spending the same BTC to Bob and transfer the same by closing the channel if Bob is not online ? – Holmes Jan 1 '18 at 15:00
  • Which transaction is Alice broadcasting to close the channel? – Matthew Charles Stannard Jan 1 '18 at 15:19
  • can she broadcast the initial transaction balance 0.5 BTC to the blockchain & unilaterally close the channel? while Bob is unavailable to verify the transaction in the LN channel – Holmes Jan 1 '18 at 15:21
  • Did Bob receive and broadcast the 'anti-cheat' transaction from Alice after she sent him B2? – Matthew Charles Stannard Jan 1 '18 at 15:38
2

Based on your comments, I think one fundamental issue you're missing is that to pay with LN, the other party has to be online at the time. There's no question of "what happens if Bob is offline" because if he is offline, no payment is possible.

The other thing you need to know - especially if you meant that Bob is offline after the payment was completed - is that LN is complicated. Many transactions are involved in each payment. To get the full details you will have to read the whitepaper - https://lightning.network/lightning-network-paper.pdf.

But a main point is that as part of the process of accepting an LN payment, Bob gets a penalty transaction. If Alice ever tries to broadcast a tx representing an old channel state, thus reverting an earlier payment, Bob can broadcast his penalty tx, and take all the money in the channel (even the part that never belonged to him).

Because of this, it is recommended that Bob either stays online constantly, or delegates watchtowers to this job (which does not give the watchtowers access to Bob's money).

1

Doublespends are not possible, because a payment on LN is only considered finalized once both payment channel owners have revoked the previous state of the payment channel by handing their partner a breach remedy that invalidates the previous state.

Thus, Bob should not hand over whatever service Alice was purchasing until the payment is finalized. Once the payment is finalized, Alice can no longer broadcast the old state without opening herself up to the penalty transaction being broadcast by Bob.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.