-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure that all lnd transactions related to peerswaps are identifiable #254
Comments
mrfelton
changed the title
Add labels for onchain transactions to allow identification and categorisation
Ensure that all lnd transactions related to peerswaps are identifiable
Feb 4, 2024
I'd like take up this issue. |
With #281, I have implemented setting the payment_request for lightning payment. I will address Labeling of onchain transactions separately. |
YusukeShimizu
added a commit
to YusukeShimizu/peerswap
that referenced
this issue
Feb 11, 2024
Ensure that all lnd transactions related to peerswaps are identifiable by the label `peerswap`. This makes it easier to audit the transactions from faraday. This is performed by LND's LabelTransaction RPC. Since CLN has no such function, no label is assigned. Need to check with integration test, but LND needs to be upgraded to use GetTransaction RPC, To do so, it is necessary to upgrade the LND version. Therefore, this will be handled separately. ElementsProject#254.
YusukeShimizu
added a commit
to YusukeShimizu/peerswap
that referenced
this issue
Feb 11, 2024
Ensure that all lnd transactions related to peerswaps are identifiable by the label `peerswap`. This makes it easier to audit the transactions from faraday. This is performed by LND's LabelTransaction RPC. Since CLN has no such function, no label is assigned. Need to check with integration test, but LND needs to be upgraded to use GetTransaction RPC, To do so, it is necessary to upgrade the LND version. Therefore, this will be handled separately. ElementsProject#254.
YusukeShimizu
added a commit
to YusukeShimizu/peerswap
that referenced
this issue
Feb 11, 2024
Ensure that all lnd transactions related to peerswaps are identifiable by the label `peerswap`. This makes it easier to audit the transactions from faraday. This is performed by LND's LabelTransaction RPC. Since CLN has no such function, no label is assigned. ElementsProject#254
With #282, I have implemented labeling transactions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Peerswap adds a memo to some of the lightning invoices related to swapins that enable easy identification and categorisation of some of the off chain payments related to those swaps. However, labels are not added to the counterpart onchain transactions. This lack of identifying labels for the onchain transactions prevents easy categorisation of the economic activity, and therefore difficulties in accounting and reconciliation.
Additionally, when doing a BTC swapout, there is no way to identify either the onchain receive, or either of the lightning payments as being related to the swap - The onchain receive isn't labeled, and the lightning payments are non-identifiable in lnd. The issue is that peerswaps is paying directly to a payment hash, rather than to a payment request, and as a result payments in lnd's database have no association to the invoices that were paid and therefore no access to the memo from those invoices.
Ideally, we'd be able to use faraday's audit tool to properly classify all of the component parts of a swap,. but this is not currently possible because of the missing correlation points.
For example, the following faraday audit command should allow for classification of all parts of the swaps, but currently only the some are included in the output.
frcli audit --categories '[{"name":"peerswap","off_chain":true,"on_chain":true,"label_patterns":["peerswap.*"]}]'
The onchain transactions corresponding to the swaps have the
label
is set to the default value ofexternal
, which is why they are not being categorised as peerswaps by faraday:For more info, see:
Notes
Currently when performing a swap-out, appropriate descriptions are added to the invoices that the recipient creates. e.g.
fee:
peerswap lbtc fee 110x1x1 571e3c0ce9e504e0bda94e01144ed0164021574ce686c719d79488a7e1ac0949
claim:
peerswap lbtc claim 110x1x1 571e3c0ce9e504e0bda94e01144ed0164021574ce686c719d79488a7e1ac0949
However, when the payer pays these invoices, it's not paying to the payment request, but instead it's paying directly to the payment hash. See here https://github.com/ElementsProject/peerswap/blob/aef7098f9e57d4490db9799a1680baa1f60715d3/lnd/client.go#L321C26-L323
Notice in the following output from
lnd1 listpayments
thatpayment_request
is not set in either of the payments that relate to the peerswap, and because of this, the sender doesn't have a reference to the payment requests that it paid:Suggested fix
Do not use
SendToRoute
to send the payments here:peerswap/lnd/client.go
Lines 321 to 324 in aef7098
Instead, use the SendPaymentV2 RPC and set
payment_request
in the request. This will ensure that the payments are linked to the peerswap invoices that were paid.Additionally, when making onchain payments, set a label on the transaction (both in the sender and the recipient's wallets) in order to identify them as peerswaps.
For example, for BTC swaps, when publishing the onchain transaction here:
peerswap/lnd/lnd_wallet.go
Line 203 in aef7098
Set the
label
parameter when calling the PublishTransaction RPC.And on the receiving side, use the LabelTransaction RPC to label the incoming onchain transaction once it has been detected.
The text was updated successfully, but these errors were encountered: