Finally got to playing with Cashu a bit more.

Before BTC Prague I wanted to have a mint that supports minting CZK. And I did not want to hardcode it.

I have two modifications - dynamic adding of currencies (instead of hardcoded sat, eur, usd).

Then I added a fiat backend, which knows the exchange rate and allows you to mint and melt fiat denominated ecash notes.

Be sure to check documentation, especially the section about limitations and further development.

This works currently with cashu.me and not minibits, since it has hardcoded units.

There should be some mechanism that would drive hedging of the fiat currency, don't use this in production! But basically just the balance of a number of minted tokens should be enough to keep a balanced hedge open on an exchange. I have not looked into it yet.

The unit abstraction allows also other fun stuff in the future:

Add support for a non-fiat backing backend.

- To have XMR in the backend. This quickly turns into an exchange, or instant XMR-denominated payments without needing for blockchain confirmations (you mint the tokens, wait and then you can use them immediately for eCash payments or through lightning)
- Or a ticket to an event. It can have static mint quote and disabled melt quote.
- Or a gift certificate to use with a proxynut service that is not meltable to lightning. "Here are some credits to try our service", but we don't want the users to cash them out through lightning.

The branch:

https://github.com/jooray/nutshell/tree/units

Docs:
https://github.com/jooray/nutshell/blob/units/docs/fiat-backend.md

CC: calle
The code needs a lot of cleaning up and testing.

This post and comments are published on Nostr.