<p>The payment secret is used to make sure the amount the sender intends to pay is actually received by the recipient. It is encoded in the BOLT11 invoice, so only the sender and recipient of the payment know about it. The sender adds the payment secret to the onion payload (BOLT4) for the recipient. This way the recipient knows the payload was constructed by the sender and thus the amount was the intended amount.</p>
<p>If the payment secret would not be added in the onion payload, the forwarding node of the final hop could attempt to forward a smaller amount than intended by the sender. If the sender overpaid the invoice, for example because it was a zero amount invoice, the recipient would accept the payment and release the preimage. The forwarding node will have made the difference in a successful attack by 'probing' with a smaller amount.</p>

CC BY-SA 4.0
2022-10-28T01:37:24.477Z
Interesting concept. However how can a node know it is forwarding the final hop of the payment in this scenario?
Bilthon
CC BY-SA 4.0
2022-10-28T07:40:08.173Z
@Bilthon it can't from the payment itself. It would have to know that the peer is a common destination and that it uses zero amount invoices a lot for example. But it could attempt the smaller amount and if that fails attempt with the actual amount too.
Jesse de Wit
CC BY-SA 4.0
2022-10-27T21:15:31.670Z
2022-10-27T21:15:31.670Z
Jesse de Wit
<p>In the tagged fields of the <a href="https://github.com/lightning/bolts/blob/master/11-payment-encoding.md" rel="nofollow noreferrer">BOLT 11</a>, it is stated:</p>
<blockquote>
<p>This 256-bit secret prevents forwarding nodes from probing the payment recipient.</p>
</blockquote>
<p>When referring to the tagged field identified by the <code>s</code> key. Can someone ELI5 what's the intended use of this field?</p>

<lightning-network><bolt11>
What's the purpose of the payment_secret in a LN invoice?
Bilthon
# What's the purpose of the payment_secret in a LN invoice?

(Asked by: username_0 on 2022-10-08)

In the tagged fields of the [BOLT 11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md), it is stated:

> This 256-bit secret prevents forwarding nodes from probing the payment recipient.

When referring to the tagged field identified by the `s` key. Can someone ELI5 what's the intended use of this field?

**Tags:** lightning-network, bolt11


---

## 1 answers

### Answer by username_1 on 2022-10-27. Score: 2 | Accepted answer

The payment secret is used to make sure the amount the sender intends to pay is actually received by the recipient. It is encoded in the BOLT11 invoice, so only the sender and recipient of the payment know about it. The sender adds the payment secret to the onion payload (BOLT4) for the recipient. This way the recipient knows the payload was constructed by the sender and thus the amount was the intended amount.

If the payment secret would not be added in the onion payload, the forwarding node of the final hop could attempt to forward a smaller amount than intended by the sender. If the sender overpaid the invoice, for example because it was a zero amount invoice, the recipient would accept the payment and release the preimage. The forwarding node will have made the difference in a successful attack by 'probing' with a smaller amount.

> **Comments:**
> **username_0**: Interesting concept. However how can a node know it is forwarding the final hop of the payment in this scenario?  
> **username_1**: @username_0 it can't from the payment itself. It would have to know that the peer is a common destination and that it uses zero amount invoices a lot for example. But it could attempt the smaller amount and if that fails attempt with the actual amount too.  

---

