0

I'm just a beginner in lighting network. Have some questions about transactions in LN when im doing the research

  1. Transactions in LN are off-chain, so transactions couldn't be stored in main-chain, so how could you look-up the transactions history?
  2. Payment channel is private for someone outside, and if there is no transaction history, how do i give the information to others to proof that I've just made a payment in LN.

Any helps, tks

2

Transactions in LN are off-chain, so transactions couldn't be stored in main-chain, so how could you look-up the transactions history?

You cannot view the transaction history of any node except your own. Transactions in LN are private and sent encrypted over an onion routing layer. It is up to the software client to keep track of payments if you want your own payment history.

Payment channel is private for someone outside, and if there is no transaction history, how do i give the information to others to proof that I've just made a payment in LN.

Every payment on LN uses a 256-bit random number, called a payment_preimage. The preimage is hashed using SHA256 to produce a payment_hash. The intended recipient of funds initally witholds the payment_preimage, but gives you the payment_hash and asks you to make the payment.

When you make the payment, it is made for a specific payment_hash. This is done with a Hashed Time-Locked Contract (HTLC), which is a conditional payment. The payment expires after a timeout, unless the intended recipient accepts the payment by surrendering the payment_preimage for that payment_hash. If the recipient does not accept the payment, they must fail the HTLC before the timeout, else their channel may be forcibly closed and they will not receive the payment.

Once the recipient has accepted a payment by sending the payment_preimage, it is trivial for you to prove that you have paid payment_hash, because anybody can perform the SHA256 on the preimage and assert that it matches payment_hash. The assumption here is that SHA256 is cryptographically secure and it is not possible to brute force a payment_preimage to produce an expected payment_hash.

By surrendering the payment_preimage to accept the payment, the recipient has provided proof that you have paid.

Note that this must assume that a preimage is never reused. Every payment must use a unique random preimage else it may be possible that funds are stolen.

  • tks Mark, any resource suggest for me, above info couldn't find in some documents I have. – ducanhng Apr 9 at 4:52
1

Transactions in LN are off-chain, so transactions couldn't be stored in main-chain, so how could you look-up the transactions history?

You are correct, an outsider does not get to know the transaction history. When two parties (say A and B) set up a payments channel they lock the current state of the channel on the main chain. This involved sending A and B sending X BTC and Y BTC respectively to a multi-sig address controlled by private keys of A and B. This transaction is called the funding transaction. Then both the users sign a commitment transaction sending X BTC to A and Y BTC to B from the multi-sig address. Every transaction that follows in the channel (also called commitment transactions) revoke the prior state and enter into a new state. You can send multiple transactions each time revoking the previous state and entering into the new state. When the two parties finally agree to close the channel, they can broadcast the final state which sends the final value to A and B.

Payment channel is private for someone outside, and if there is no transaction history, how do i give the information to others to proof that I've just made a payment in LN.

As described above, every new commitment transaction undoes the previous state and enters into a new state. Payment channels involve provisions like signing asymmetric commitment transactions involving revocation keys and CHECKLOCKTIMEVERIFY so that one cannot cheat the other by broadcasting previous commitment transactions, if that one is favorable to that party. If that happens, it allows the wronged party to take the entire balance of the channel. In a unanimous closing of the channel, you broadcast the transaction signed by both parties sending the right amounts that are owed to both the participants of the channel. This transaction is called the settlement transaction.

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.