My POW #1

Last week I promised to keep all of you updated about my open source work on Cashu and npub.cash. So this is it, the very first weekly POW log. I hope you will enjoy it as many more will follow.


Cashu is going Realtime: WebSockets

One of the projects that excites me the most is the proposal for WebSocket enabled Cashu mints. Right now clients need to poll mints for updates, which can cause unnecessary traffic and make more complex use cases (like npub.cash) really complicated.

Right now npub.cash uses wrapper invoices created using the Blink API to keep track of invoices and payments. It would be much cooler to let payers interface directly with the mint, but that would mean the npubcash-server would have to constantly poll a mint for all inflight invoices. And those can stack up quickly...

So I started a NUT proposal to add WebSocket connections to mints. It is not a drop-in replacement for the REST API, but an add-on enabling live updates for state changes.

I reached out to nostr:npub12rv5lskctqxxs2c8rf2zlzc7xx3qpvzs3w4etgemauy9thegr43sf485vg (Cashu master-pioneer and maintainer of Nutshell) to reflect on my approach and we agreed that it makes sense to build some reference implementations in order to put the design to the test. He began working on the mint while I started on the client side with a PR for cashu-ts. As of right now we are still drafting and going back and forth, but I think it is reasonable to assume that we will be able to have some working tests soon(TM).

Links


npub.cash

Custom mints for npubcash-server

One of my favorite things about npub.cash is the idea to decouple a Lightning Address from your custodian. Because npub.cash "outsources" Lightning payments to the mint, users can choose their LN custodian themselves. Although I had this in mind when writing the first version, npubcash-server was still missing APIs to let a user actually change their mint.

To change this I started another PR, adding the missing APIs as well as some additional logic and validation. I am thoroughly testing this right now and will roll it out soon. Once this first version goes live I want to dive in deeper and explore multi-mint setup, which will users essentially eliminate single points of failure

Animated QR codes for npubcash-website

Another thing that should have been there from the start is QR codes on the npub.cash website. However, Cashu tokens as QR codes can be challenging, because they need to encode A LOT of data. Especially on older phones or dim displays, this becomes a problem quickly, as such QR codes are really large and dots are tiny. Animated QR codes to the rescue! What some might already know from PSBT are animated QR codes that encode data in fragments and then stream it.

The Cashu dev community has been discussing this for a while now and most agreed that the Blockchain Commons MUR QR Codes are best suited for the task. The encoding is based on Google Fountain Codes and can already be found in some Bitcoin apps

While I have created my own WASM port of one of the blockchain commons libraries a while ago, I went with another BC Commons fork created by nostr:npub1cj6ndx5akfazux7f0vjl4fyx9k0ulf682p437fe03a9ndwqjm0tqj886t6.

Decoupling npubcash-alias

The last project of this week is the decoupling of npubcash-server and npubcash-alias. I realized that while the ability to create a human-readable alias for npub.cash is great, it adds a huge amount of overhead to the service. I decided that aliases should rather be an implementation detail up to the service provider, so I began to remove them. In the end, not everyone might want to sell aliases or use other gateways to create them...

Don't worry! Aliases will not go away, but the purchases will instead be handled by a second service, running along npubcash-server. This service "npubcash-alias" also brings some improvements over the old one, but I'll go into more details next week. Of course, just like everything else, npubcash-alias is also open source.

Links


I hope you enjoyed this very first POW. Until next week :)

Image of Jibun AI author Starbuilder

egge

Building current; a nostr + bitcoin client! https://app.getcurrent.io 💜⚡️🧡

Share this post