It uses the mints in the 10019 event. Mine just happens to be my own mint (because I trust it haha).
Discussion
Ooooh SWEEET!
Then another question 😂 how is your LN node being used? You mentioned that in the previous response so I assumed it was just taking the bolt11 from your node
Not my ln node, but my ln server. I’ve had to draw out the process many times to not forget how it works. Basically:
1.
Sender requests LUD16 from my ln server (https://westernbtc.com/.well-known/lnurlp/josh)
2.
Sender gets callback and requests (https://westernbtc.com/api/v1/payreq/josh?amount&nostr=%5Bnostr event])
3.
I check (ln server) if username is taken / associated with a white listed pubkey in my db.
Get wallet information from 10019 event.
Get mint quote request from top mint (maybe will try multiple later if top fails).
Send a queue message to a listener with the mint quote info.
Send bolt 11 invoice back for associated quote id
4.
Listener polls mint with quote id to see if it got paid or expired.
If it gets paid, call back to ln server (aka my api) at admin endpoint (https://westernbtc.com/api/v1/admin/mint-tokens). Don’t worry it has an api key.
5.
LN server (my api) then takes the fulfilled quote id, the receivers p2pk key, and mints the tokens.
Create the 9321 event with all the tokens and send to relays.
I’m sure all of this stuff is very familiar to you, so sorry if it was fluff 😂.
no, this is great to have it all spelled out in such a detailed way; thanks for detailing this and this sounds great -- wrt to first mint vs other mints, since you're on a server I would probably get quotes from all of them in parallel and give back the first one that responds and then average out to avoid sending everything always to the same mint
but that's just getting fancy for fancy's sake 😂 this is AMAZING!!!!
Thanks for the feedback! That’s a great idea. A rare time I could actually use Promise.race haha. I meant to ask for any feedback where possible. So if you have any other suggestions, please give them to me. Would love feedback from you too nostr:npub12rv5lskctqxxs2c8rf2zlzc7xx3qpvzs3w4etgemauy9thegr43sf485vg if either of you can spare to give it.
Love it, sounds cool. Would like to have a look at the code. This could be a tool that anybody with a cheap server and a domain could run to host LN addresses for their service etc. maybe could even hard code the mint if it's run by the mint operator themselves.
One thing that could be challenging is the polling for the quote state. nostr:nprofile1qqsdmup6e2z6mcpeue6z6kl08he49hcen5xnrc3tnpvw0mdgtjemh0spyfmhxue69uhkummnw3ez6an9wf5kv6t9vsh8wetvd3hhyer9wghxuet5qyvhwumn8ghj7mn0wd68ytnrv4exxct5wfhhvcfwd4jsz8rhwden5te0dehhxarj9e3xjarrda5kuetj9eek7cmfv9kq3n26p2 has recently struggled with rage limiting of that.
Oh. Mints also have websockets for live updates btw.
you guys are super!! i am in IT too but all those terminologies are like Arabic to me. i would live to study this tech and understand it....
nostr:nprofile1qqsqu200c237k6txgqlgccwt304x67zj0t67q4j69w4q7vf7lu2z4uspp4mhxue69uhkummn9ekx7mqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduq3qamnwvaz7tmwdaehgu3wwa5kuegfy4mjq do you have a GitHub repo for that? tagging nostr:nprofile1qqswnetlw3z32u4eagzudc83dltqkwwlmq5n45n28spef5g3pln4l6cpp3mhxue69uhkyunz9e5k7qgswaehxw309ahx7um5wgh8w6twv5q3jamnwvaz7tmwdaehgu3w0fjkyetyv4jjucmvda6kg0rvz2z who maintains the awesome list
I don't, I use AWS CodeCommit which is private. I do have a Github account though, so I'll look into pushing a fork there.
This is going to force me to start handling some secrets better in templates.. because I'm not doing the best at that at the moment. Might take a while for me to sanitize my code.
Here you go https://github.com/btcjt/westernbtc-website.
These will probably be the files of interest: src/app/api/v1/payreq/[username]/route.ts, src/app/api/v1/admin/mint-tokens/route.ts
Note: I don't have the queue listener code here. It's kept separate. I can push that code too if wanted.
Sorry forgot to remove something important. Will push back up in a second.
