In the realm of the Lightning Network (LN), a Proof of Payment (PoP) serves as a verifiable acknowledgment that a specific transaction has successfully occurred. Lightning payments are atomic meaning that if there is a pre-image received by the payer the payment was surely received by the destination node.
How Does Proof of Payment Work in the Lightning Network?
1. Invoice Generation by the Payee's Node:
* The process begins with the creation of a Lightning Network invoice by the payee's node. This invoice is not just a simple payment request but a complex structure comprising various elements crucial for the transaction. One of the critical components of this invoice is a cryptographic hash of a secret, known as the 'payment pre-image'.
2. Invoice Signing:
* To ensure authenticity and prevent tampering, the payee's node digitally signs the invoice. This signature is a cryptographic proof that the invoice was indeed generated by the actual owner of the node and not an imposter.
3. Payment and Disclosure of Pre-Image:
* Once the payer decides to fulfill the invoice, the payment is routed through the Lightning Network to reach the payee. Upon successful receipt of the payment, the payee's node releases the 'payment pre-image' to the payer. This pre-image is essentially the secret whose hash was included in the invoice.
4. Combination of Invoice and Pre-Image as Proof of Payment:
* The final step in establishing a Proof of Payment is the combination of the original LN invoice and the payment pre-image. The payer can use these two pieces to prove that a payment was made to the payee. Essentially, with this two pieces of information anyone can verify that the hash in the invoice corresponds to the pre-image provided upon payment, proving that the transaction indeed occurred as claimed.
Why is Proof of Payment Important?
1. Verification of Payment:
* PoP is crucial for parties to confirm that the transaction was processed correctly without needing to relying on a third party.
2. Non-repudiation:
* With the cryptographic evidence provided by the PoP, the payee cannot deny receiving the payment, and similarly, the payer cannot deny making the payment. This is crucial for dispute resolutions and trust-building in digital transactions.
3. Security:
* The cryptographic nature of the invoice and the pre-image ensures that the transaction is secure and resistant to tampering or fraud.
In summary to prove a lightning invoice was paid there are two pieces of information needed:
1. The original Lightning Invoice provided by the node
2. The payment pre-image received by the payer on the successful payment
The Lightning Invoice is easy. This is what the payee presents to you. To obtain the payment pre-image shouldn't be rocket science but don't ask me, someone with more Lightning Network knowledge has to step in. The next mystery is how to mangle both to show the proof.
We'll get there eventually...
Untested (adjust accordingly):
A confirmed Lightning Network withdrawal will include the preimage in the hash field. The preimage is a secret value that is generated by the receiver (the node that generated the invoice). This value remains secret until the payment is received. The receiver must reveal this value to collect the payment. That is, a sender can prove a payment was delivered correctly by showing the payment preimage.
Follow these steps to make sure the preimage matches the payment:
[1] Extract the payment hash from the Lightning invoice. You can use any invoice decoding tool, for example: https://lndecode.com/
[2] Take the preimage ("hash" field) displayed in SouthXchange and calculate its SHA256 in hex/binary format (not in text format). You can use any tool for this purpose, for example: https://www.fileformat.info/tool/hash.htm (enter in "Binary hash")
[3] Compare the SHA256 of the preimage calculated in item [2] with the payment hash in item [1]. If they match then the proof is complete.
I assume "displayed in ..." at step [2] is equivalent to your own payment confirmation record (should be obtainable from your own LN node).