in simplistic terms
LN is just X parties creating a multisig by handing each other a public key (not private)
this public key creates a multisig address
they double check they are both using the same address after joining the public keys together. and then both side put in some funds.
funding the address is done onchain. but the funds are locks for xxxx blocks.
lets say they both put in 0.1btc each
which would be on the blockchain 2 transactions
personAbitcoinaddress 0.1btc -> LNMultisigbitcoinaddress 0.1btc
signed A
personBbitcoinaddress 0.1btc -> LNMultisigbitcoinaddress 0.1btc
signed B
now that they both have something to lose they are more willing to be honest with each other.
offchain they create a private transaction to spend the 0.2btc total by giving person A 0.1 and person B 0.1 and both sign it
LNMultisigbitcoinaddress 0.1btc -> personAbitcoinaddress 0.1btc
LNMultisigbitcoinaddress 0.1btc -> personBbitcoinaddress 0.1btc
signed personA
signed personB
this is the defacto 'refund' transaction.
then later, still privately if person A buys something. they agree that person B gets more..
by giving person A 0.099 and person B 0.101 and both sign it
LNMultisigbitcoinaddress 0.1btc -> personAbitcoinaddress 0.099btc
LNMultisigbitcoinaddress 0.1btc -> personBbitcoinaddress 0.101btc
signed personA
signed personB
obviously person B wants the extra 0.001 each purchase so he is happy to sign. and person A wont receive the goods until he signs so he is happy to sign
later person A buys something else
by giving person A 0.098 and person B 0.102 and both sign it
LNMultisigbitcoinaddress 0.1btc -> personAbitcoinaddress 0.098btc
LNMultisigbitcoinaddress 0.1btc -> personBbitcoinaddress 0.102btc
signed personA
signed personB
the first transaction can be happily forgotten as they now have a new active transaction they are happy with
later person A buys something else
by giving person A 0.097 and person B 0.103 and both sign it
LNMultisigbitcoinaddress 0.1btc -> personAbitcoinaddress 0.097btc
LNMultisigbitcoinaddress 0.1btc -> personBbitcoinaddress 0.103btc
signed personA
signed personB
and so on and so on for over lets say 90 trades.
...person A buys something else
by giving person A 0.007 and person B 0.193 and both sign it
LNMultisigbitcoinaddress 0.1btc -> personAbitcoinaddress 0.007btc
LNMultisigbitcoinaddress 0.1btc -> personBbitcoinaddress 0.193btc
signed personA
signed personB
as long as both people are online. signing it is near instant and these transactions are only stored on in the mempool of the individuals involved
after a while they decide its time to settle up. so close the link between each other and broadcast the most uptodate transaction onto the bitcoin network:
LNMultisigbitcoinaddress 0.1btc -> personAbitcoinaddress 0.007btc
LNMultisigbitcoinaddress 0.1btc -> personBbitcoinaddress 0.193btc
signed personA
signed personB
and even though there have been 93 trades between A and B. all the bitcoin blockchain sees 3 transactions (2 to setup 1 to settle)
personAbitcoinaddress 0.1btc -> LNMultisigbitcoinaddress 0.1btc
signed A
personBbitcoinaddress 0.1btc -> LNMultisigbitcoinaddress 0.1btc
signed B
LNMultisigbitcoinaddress 0.1btc -> personAbitcoinaddress 0.007btc
LNMultisigbitcoinaddress 0.1btc -> personBbitcoinaddress 0.193btc
signed personA
signed personB
hope this has helped people visualise the simplicity of the concept.
LN uses buzzwords like bi-directional. but because its not using a long chain of transactions that are linked to previous transactions. its more like having a pool of funds and negotiating who deserves what.
meaning person A could prove goods are not delivered and they both sign that A gets a little more and B gets a little less
however there are still a few issues that need sorting.
the private communications channel(ensure they dont lose touch or other issues)
locking initial funds in
3rd party(hubs) to mitigate disputes
parameters to settle
preventing double spends(person A sending defacto refund to get 0.1 back even after buying 93 products)