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

<p>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. </p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>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 <code>revocation keys</code> and <code>CHECKLOCKTIMEVERIFY</code> 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.</p>

CC BY-SA 4.0
2019-04-08T10:09:25.873Z
2019-04-08T10:09:25.873Z
Ugam Kamat
<blockquote>
  <p>Transactions in LN are off-chain, so transactions couldn't be stored in main-chain, so how could you look-up the transactions history? </p>
</blockquote>

<p>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.</p>

<blockquote>
  <p>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.</p>
</blockquote>

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

<p>When you make the payment, it is made for a specific <code>payment_hash</code>. This is done with a Hashed Time-Locked Contract (HTLC), which is a <em>conditional</em> payment. The payment expires after a timeout, unless the intended recipient accepts the payment by surrendering the <code>payment_preimage</code> for that <code>payment_hash</code>. 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.</p>

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

<p>By surrendering the <code>payment_preimage</code> to accept the payment, the recipient has provided proof that you have paid.</p>

<p>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.</p>

CC BY-SA 4.0
2019-04-09T04:52:15.413Z
tks Mark, any resource suggest for me, above info couldn't find in some documents I have.
nofomopls
CC BY-SA 4.0
2022-07-11T18:25:14.923Z
But how to do this test in practice? Using some famous client like LND or c-lightning, for example?
Felipe
CC BY-SA 4.0
2019-04-08T13:38:57.963Z
2019-04-08T13:38:57.963Z
Mark H
<p>I'm just a beginner in lighting network. Have some questions about transactions in LN when im doing the research</p>

<ol>
<li>Transactions in LN are off-chain, so transactions couldn't be stored in main-chain, so how could you look-up the transactions history? </li>
<li>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.</li>
</ol>

<p>Any helps, tks</p>

<lightning-network>
tracking history of transactions in Lighting Network
nofomopls
# tracking history of transactions in Lighting Network

(Asked by: username_0 on 2019-04-08)

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

**Tags:** lightning-network


---

## 2 answers

### Answer by username_2 on 2019-04-08. Score: 5 | Accepted answer

> 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.

> **Comments:**
> **username_0**: tks Mark, any resource suggest for me, above info couldn't find in some documents I have.  
> **username_3**: But how to do this test in practice? Using some famous client like LND or c-lightning, for example?  

---

### Answer by username_1 on 2019-04-08. Score: 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 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.


---

