Redeeming Cashu tokens onto Lightning like a pro:

1) Base64-urlsafe decode the part after cashuA...

2) You will get a JSON, let's call it cashu.

3) Notice the proofs in cashu.token[0].proofs

4) Get the Mint URL in cashu.token[0].mint

5) Get the value of the token:

```

let totalAmount = 0;

cashu.token[0].proofs.forEach((proof) => {

totalAmount += proof.amount;

});

```

(or use .reduce)

6) Create a Lightning invoice for the receiver (using LNURL?) worth totalAmount*0.98 but at least 2 sats less.

Make a POST request to the mint URL:

```

curl -X POST https://mint.host:3338/melt -d \

{

"proofs" :

cashu.token[0].proofs,

"pr": "lnbc100n1p3kdrv5sp5lpdxzghe5j67q..."

}

```

https://github.com/cashubtc/nuts/blob/main/05.md

Reply to this note

Please Login to reply.

Discussion

I'm sure it is amazing tho lol;) 🫡🫡