Skip to content
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

Relation between Zap Request event and inbound and internal transaction events. #2

Open
rapax00 opened this issue Sep 18, 2024 · 0 comments

Comments

@rapax00
Copy link
Member

rapax00 commented Sep 18, 2024

Why?

If I send a Zap Request to URLx and I receive a Zap Receipt, it means the zap was paid correctly to URLx, but it doesn't mean that the sats were correctly transferred from URLx to the LaWallet user who was redirected to this.

I don't have an easy way to validate this. Both the Zap Request and the inbound transaction start share the same bolt11 tag value, but it isn't filterable in a Nostr relay.

Current way

The method I use to locate inbound and internal transaction events (which confirm that the sats are in the user's wallet) is by filtering based on the created_at value of the Zap Request with a small time margin before and after, and using it with the since and until parameters. I also use the authors key with the URLx public key, the p tag with the public key of the LaWallet user to whom the payment is directed, and the corresponding kind and t values.

Filter example:

{
  "authors": [
    <urlx pubkey>
  ],
  "kinds": [
    1112
  ],
  "#t": [
    "internal-transaction-start",
    "internal-transaction-ok",
    "internal-transaction-error",
    "inbound-transaction-start",
    "inbound-transaction-ok",
    "inbound-transaction-error",
  ],
  "#p": [
    <lawallet user pubkey>
  ],
  "since": <created_at of zapRequest minus 60 seconds>,
  "until": <created_at of zapRequest plus 60 seconds>
}

Suggestions

Carry e tag

The Zap Request event may have an e tag that is placed in the Zap Receipt (NIP-57).
Carry this e tag to consecutive events (inbound-transaction-start, inbound-transaction-ok, inbound-transaction-error from URLx, internal-transaction-start, internal-transaction-ok, internal-transaction-error from Ledger).

Use the id from the Zap Request in the e tag

The e tag of event A includes the id of event B, which is related to event A (NIP-01).
Use the id of the Zap Receipt in the consecutive events (same the above).

@rapax00 rapax00 changed the title Relation between _Zap Request_ event and _inbound_ and _internal_ transaction events. Relation between Zap Request event and inbound and internal transaction events. Sep 18, 2024
@rapax00 rapax00 assigned rapax00 and unassigned rapax00 Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant