user51487: As I understand payment-channels, like the lightning network, they are working off chain (no record in the blockchain). The only record to the blockchain is the deposit transaction to open the payment-channel and by closing the payment channel. But later all the transactions inside the payment-channel running on centralized servers, like traditional bank transfers. This is very fast, and could be very cheap if there is competition. But how the banks, who would run such payment-channels can secure that inside the payment-channel the transactions are not hacked and safe? And how the bank guarantee the customers that they dont double spend the funds if inside the channel all transaction are totally anonymous? 

user48884: Transactions in a payment channel are still real Bitcoin transactions. They require the cooperation of both parties in the channel, so there is no bank and no central party that can rewrite history or double spend anything in a channel.
In order to change one party's balance in a payment channel, both parties must agree to it and sign the commitment transaction that changes the balances. So neither party can double spend nor can they change the transaction history without the other party agreeing to it.
To avoid a malicious party from broadcasting an old commitment transaction where they had a higher balance, such commitment transactions have a revocation key where the other party that would be defrauded is allowed to take ALL of the Bitcoin in the channel. This is an incentive for people to not broadcast old commitments as they would lose all of their money in the channel.

user51948: All transactions that are sent between the two parties in a channel are valid bitcoin transactions, and they can be used to close the channel at any time by either party. 
When a channel is opened, those bitcoins are locked up in that channel until it is closed with a spending transaction, sending an agreed amount of bitcoin to each party in the channel. Initially this spending transaction is created to return the same amount of bitcoin that each party put in to the channel. But 'transactions' are made, which is really just each party agreeing to create new spending transactions to replace the old one, giving each party a different amount. 
If each party, for example, locks in 1 BTC to a channel, they will also create a spending transaction at the same time returning that 1 BTC to each person. Then let's say person A wants to send 0.2 BTC to person B. To do this, they simply work together to create a new valid spending transaction to replace the old one, the new one would pay A 0.8 BTC and B 1.2 BTC, effectively transferring that 0.2 BTC from A to B. New transactions like this are continually created every time either person wants to send coins, until finally one of the two participants wishes to close the channel and actually get their BTC back. This also happens if one party stops responding/cooperating. The final transaction they agreed upon is broadcast to the actual blockchain, closing the channel and paying both participants.
Thus, at all times, the transactions are valid and the actual bitcoins being exchanged are locked up in the blockchain, so there is no way for anyone to double-spend the transactions.

51487: <p>As I understand payment-channels, like the lightning network, they are working off chain (no record in the blockchain). The only record to the blockchain is the deposit transaction to open the payment-channel and by closing the payment channel. But later all the transactions inside the payment-channel running on centralized servers, like traditional bank transfers. This is very fast, and could be very cheap if there is competition. But how the banks, who would run such payment-channels can secure that inside the payment-channel the transactions are not hacked and safe? And how the bank guarantee the customers that they dont double spend the funds if inside the channel all transaction are totally anonymous? </p>
 48884: <p>Transactions in a payment channel are still real Bitcoin transactions. They require the cooperation of both parties in the channel, so there is no bank and no central party that can rewrite history or double spend anything in a channel.</p>

<p>In order to change one party's balance in a payment channel, both parties must agree to it and sign the commitment transaction that changes the balances. So neither party can double spend nor can they change the transaction history without the other party agreeing to it.</p>

<p>To avoid a malicious party from broadcasting an old commitment transaction where they had a higher balance, such commitment transactions have a revocation key where the other party that would be defrauded is allowed to take ALL of the Bitcoin in the channel. This is an incentive for people to not broadcast old commitments as they would lose all of their money in the channel.</p>
 51948: <p>All transactions that are sent between the two parties in a channel are <em>valid</em> bitcoin transactions, and they can be used to close the channel at any time by either party. </p>

<p>When a channel is opened, those bitcoins are locked up in that channel until it is closed with a spending transaction, sending an agreed amount of bitcoin to each party in the channel. Initially this spending transaction is created to return the same amount of bitcoin that each party put in to the channel. But 'transactions' are made, which is really just each party agreeing to create <em>new</em> spending transactions to replace the old one, giving each party a different amount. </p>

<p>If each party, for example, locks in 1 BTC to a channel, they will also create a spending transaction at the same time returning that 1 BTC to each person. Then let's say person A wants to send 0.2 BTC to person B. To do this, they simply work together to create a new valid spending transaction to replace the old one, the new one would pay A 0.8 BTC and B 1.2 BTC, effectively transferring that 0.2 BTC from A to B. New transactions like this are continually created every time either person wants to send coins, until finally one of the two participants wishes to close the channel and actually get their BTC back. This also happens if one party stops responding/cooperating. The final transaction they agreed upon is broadcast to the actual blockchain, closing the channel and paying both participants.</p>

<p>Thus, at all times, the transactions are valid and the actual bitcoins being exchanged are locked up in the blockchain, so there is no way for anyone to double-spend the transactions.</p>
