All transactions which are despatched between the 2 events in a channel are legitimate bitcoin transactions, and so they can be utilized to shut the channel at any time by both social gathering.
When a channel is opened, these bitcoins are locked up in that channel till it’s closed with a spending transaction, sending an agreed quantity of bitcoin to every social gathering within the channel. Initially this spending transaction is created to return the identical quantity of bitcoin that every social gathering put in to the channel. However ‘transactions’ are made, which is de facto simply every social gathering agreeing to create new spending transactions to interchange the previous one, giving every social gathering a distinct quantity.
If every social gathering, for instance, locks in 1 BTC to a channel, they will even create a spending transaction on the identical time returning that 1 BTC to every particular person. Then to illustrate particular person A desires to ship 0.2 BTC to particular person B. To do that, they merely work collectively to create a brand new legitimate spending transaction to interchange the previous one, the brand new one would pay A 0.8 BTC and B 1.2 BTC, successfully transferring that 0.2 BTC from A to B. New transactions like this are regularly created each time both particular person desires to ship cash, till lastly one of many two members needs to shut the channel and really get their BTC again. This additionally occurs if one social gathering stops responding/cooperating. The ultimate transaction they agreed upon is broadcast to the precise blockchain, closing the channel and paying each members.
Thus, always, the transactions are legitimate and the precise bitcoins being exchanged are locked up within the blockchain, so there isn’t a approach for anybody to double-spend the transactions.