Author

Topic: how lightning network works off chain (Read 125 times)

newbie
Activity: 11
Merit: 7
March 13, 2023, 10:37:16 PM
#4
Lightning network works through a concept called Atomic Multi-Path Payments:
https://bitcoinops.org/en/topics/atomic-multipath/

These are effectively payment channels secured by multi-signature, they start on chain with a channel opening commitment:
https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity#channels

This is the start of the on chain portion of lightning.

The off chain lightning network is enabled once these channels are established, re-balancing channels is an example of an off-chain task you can do with the established channels:
https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity#rebalancing-channels

Once a user wants to settle the funds back on the main bitcoin chain they need to initiate a channel close:
https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity#closing-channels

There are two options for this, a cooperative close:
Quote
In a cooperative close both nodes are signing a new commitment transaction and publishing it to the network. The on-chain funds created in such a transaction will become available for a new channel opening almost immediately. In such a case it is also possible to set the fee with the --conf_target or --sat_per_byte arguments and define which address the funds should be sent to via --delivery_addr (unless this was already specified at the channel opening).

And a force close:

Quote
When closing a channel unilaterally, known as a force close, the funds will be locked up for a period of time before they can be redeemed by the closer, while the other party can redeem their funds immediately. Unless an anchor channel was created, you are unable to change the transaction fee of the closing transaction. To force close a channel use the --force flag.

Both of these closes involve finalizing the state of the atomic multi signature script committed to by the members of the channel on chain.

(closing channel quotes are from https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity#rebalancing-channels)
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
March 11, 2023, 02:49:27 PM
#3
Lightning doesn't work like a blockchain, no. Transaction data is shared only between channel partners, and is updated throughout. The only history lightning leaves on-chain is the opening and closing channel transactions.
hero member
Activity: 504
Merit: 625
Pizza Maker 2023 | Bitcoinbeer.events
March 11, 2023, 01:31:20 PM
#2
my question is how lightning network works offchain,
does it functions like real blockchain ?, and all transaction data where being stored,?
lightning network also creates transaction history in real blockchain?



The Lightning Network is not a blockchain in its own right, but rather a network of off-chain payment channels (outside the block chain) that exploits the blockchain as a security and guarantee system.

 In practice, transactions on the Lightning network are made through payment channels between users, which are made up of blockchain transactions locked by smart contracts.  These contracts ensure that parties involved in the channel can only exchange funds up to the amount of money initially blocked.
full member
Activity: 448
Merit: 223
March 11, 2023, 08:45:25 AM
#1
my question is how lightning network works offchain,
does it functions like real blockchain ?, and all transaction data where being stored,?
lightning network also creates transaction history in real blockchain?

Jump to: