Why Nostr? What is Njump?
2024-07-01 16:52:36

Vitor Pamplona on Nostr: First steps on Cashu-native zaps ...

First steps on Cashu-native zaps
# NIP-XX: Cashu Zap

A Cashu Zap is a P2PK cashu token where the payment itself is the receipt.

```js
{
kind: 7375,
content: "Thanks for the coffee",
pubkey: "sender-pubkey",
tags: [
[ "amount", "1000", "msat" ],
[ "token", "cashuAeyJ0b2tlbiI6W3sicHJvb2ZzIjpbeyJpZCI6IjAwNDE0NmJkZjRhOWFmYWIiLCJhbW91bnQiOjEsInNlY3JldCI6IltcIlAyUEtcIix7XCJub25jZVwiOlwiYjI0NDNkZDRmMDQxNjgyYjRkMmEwMzkwNGQ5MDAyNjRiNzI1MzgwZTQ0YWM0MDk2Y2EwZWE2NDAzMGY0Mjc4OFwiLFwiZGF0YVwiOlwiZTlmYmNlZDNhNDJkY2Y1NTE0ODY2NTBjYzc1MmFiMzU0MzQ3ZGQ0MTNiMzA3NDg0ZTRmZDE4MThhYjUzZjk5MTExXCJ9XSIsIkMiOiIwMjYyOTM5ODRjODg1OTFiMzA2MzUxYjY5ZmNjODAxNGQ1NTc5MmYzMTQwYWEyZDlhYmQ0NGZhOWY0Y2Y2ZmQzZjEifV0sIm1pbnQiOiJodHRwczovL3N0YWJsZW51dC51bWludC5jYXNoIn1dLCJ1bml0Ijoic2F0In0="]
[ "u", "https://stablenut.umint.cash", ],
[ "e", "" ],
[ "p", "e9fbced3a42dcf551486650cc752ab354347dd413b307484e4fd1818ab53f991" ]
]
}
```

# Recipient reactions
The recipient of the cashu zap can create a `kind:7376` zap to acknowledge the payment once it has been claimed.

```js
{
kind: 7376,
content: "Received 1000 msat",
pubkey: "e9fbced3a42dcf551486650cc752ab354347dd413b307484e4fd1818ab53f991", // recipient
tags: [
[ "amount", "1000", "msat" ],
[ "e", "", "relay-hint", "root" ],
[ "e", "<7375-zap-id>", "relay-hint", "zap" ],
[ "p", "sender-pubkey" ]
]
}
```

## Verifying a Cashu Zap
* Clients MIGHT check that the receiving user has issued a `kind:38000` (cashu mint recommendation event) `u`-tagging the mint where the cashu has been minted.
* Clients MIGHT check that the token is locked to the user's pubkey.

Token payload:
```js
{
proofs: [
{
id: '004146bdf4a9afab',
amount: 1,
secret: '["P2PK",{"nonce":"b2443dd4f041682b4d2a03904d900264b725380e44ac4096ca0ea64030f42788","data":"e9fbced3a42dcf551486650cc752ab354347dd413b307484e4fd1818ab53f99111"}]',
C: '026293984c88591b306351b69fcc8014d55792f3140aa2d9abd44fa9f4cf6fd3f1'
}
],
mint: 'https://stablenut.umint.cash'
}
```
Author Public Key
npub1gcxzte5zlkncx26j68ez60fzkvtkm9e0vrwdcvsjakxf9mu9qewqlfnj5z