Releases: cashubtc/nutshell
0.15.1
This update introduces Blink as a Lightning backend for the mint and includes various other housekeeping items with smaller bug fixes.
This release includes a database migration for the mint. Make sure to back up your mint database before upgrading.
Mint
- Add Blink as a Lightning funding source
- Fix: Quote expiry with absolute Unix time
- Fix: Catch
CashuErrors
and print them nicely - Fix: Do not check MeltQuote status before payment attempt
- Fix: Mint seed encryption
cashu/mint/encrypt.py
Wallet
- Token invalidation: add setting for batch size
Protocol
- NUT-07: Token state check with
Y
(cashubtc/nuts#93) - NUT-09: Response model for v1 updated (cashubtc/nuts#87)
New Contributors
- @findingsov made their first contribution in #450
- @thesimplekid made their first contribution in #453
0.15.0
Nutshell upgrades to Cashu v1
The Cashu protocol has recently been updated to its first stable version. This release of Nutshell now supports the v1 protocol. The Cashu v1 protocol paves the way for Ecash with multiple denominations (sat, msat, usd, ...) and payment methods (Lightning, On-chain, ...). This update has been a long time in the making, with significant changes in the overall software architecture and several database migrations.
Mint runners: Always backup your mint database before upgrading.
With this release, Nutshell is also preparing for exciting upgrades in the future. These upgrades will enable you to run a Cashu mint with replication in a distributed cluster for highly available services and significantly increased throughput. Furthermore, a single deployment of a mint will be able to serve many "virtual mints" for different users.
Mint
- New v1 API implementation with backwards compatibility. Old v0 wallets will keep working with the mint.
- Mint can now rotate keysets by using BIP32 key derivation.
- Each keyset can now have a separate seed from which it is generated.
- Mint stores the seed for each keyset in the database. The seed can optionally be encrypted using a separate CLI tool
cashu/mint/decrypt.py
. - Fix P2PK multisig checks.
- Supports database backups before future migrations via env var
DB_BACKUP_PATH
- New safety settings for limiting the maximum balance of the mint (
MINT_MAX_BALANCE
) and the maximum amount for mint (MINT_MAX_PEG_IN
) and melt (MINT_MAX_PEG_OUT
) requests.
Wallet
- New v1 API implementation with backwards compatibility. The wallet will still work with old v0 mints.
- Support for multiple denomination in the same wallet.
- Many smaller issues fixed.
0.14.1
Updates in a Nutshell
- Stateless Mint: Nutshell mint can now be run "stateless" meaning that all state is in the database. This is a step towards being able to run multiple mints workers in parallel for heavy load scenarios.
- Max balance for mints: a new
MINT_MAX_BALANCE
environment flag makes sure that the mint can only hold a maximum amount. - CLI: Create an invoice without blocking with
cashu invoice <amount> -n
What's Changed
- Mint: Add LndRest and regtest tests by @callebtc in #359
- Add CoreLightningRestWallet by @callebtc in #362
- Upadte to c-lightning-REST v0.10.5 by @callebtc in #364
- Fix: Cast keyset keys (amount) to int by @callebtc in #368
- Mint: add max balance setting by @callebtc in #369
- index on db and read spent proofs from db by @callebtc in #370
- docker mint listen on 0.0.0.0 by @callebtc in #371
- add test private key by @callebtc in #372
- Test/mint_add_verification_balance by @callebtc in #373
- Mint: invalidate and generate promises in single db transaction for split by @callebtc in #374
- mint: fix postgres migrations by @callebtc in #375
- Wallet/fix_nostr_timeout by @callebtc in #376
- Mint/verify_outputs_not_already_signed by @callebtc in #377
- Mint: verify outputs first during mint by @callebtc in #379
- fix missing dleq proof in db by @callebtc in #380
Full Changelog: 0.14.0...0.14.1
0.14.0
Nutshell 0.14.0
brings many new features and improvements. These include a completely redesigned approach to use ecash spending conditions (programmable ecash) and the ability to transact offline (using offline signature validation). Protocol changes are according to the new specifications NUT-10, NUT-11, and NUT-12.
Protocol updates
Well-known spending conditions
Nutshell now supports NUT-10 spending conditions. This is a standardized way to create complex contracts between two Cashu users, if the mint supports a certain type of contract. One example is the P2PK implementation (see below).
Pay to Pubkey (P2PK)
P2PK allows you to lock a token to a specific pubkey. That way, only the intended receiver can redeem a token and nobody else. The recipient receives the token by providing a valid signature when redeeming it with the mint. The contract is enforced by the mint. To create a pubkey lock as a receiver, enter cashu lock
. To send to this lock, the sender enters cashu send <amount> --lock <p2pk_lock_of_receiver>
. This token can now be redeemed by the receiver. Read the specifications in NUT-11
DLEQ proofs
Discrete-log equality (DLEQ) proofs are now generated by the mint and handed over to wallets. Wallets can use these to verify the signature of the mint given their public key. Wallets can also send DLEQ proofs to other receiving wallets via cashu send --dleq <amount>
. Receiving wallets will validate the DLEQ proof before redeeming the token via the mint. Read more information in the DLEQ PR and the specification in NUT-12.
Other Improvements
- Wallet secret derivation fixed. Old tokens will not be restored with the new secret derivation. Use
cashu selfpay
to send yourself entire balance once. cashu info
now shows all mints- Wallet stores mint keysets for offline verification.
- Mint DB with Postgres support
- Include nostr submodule in project repo
- Improve Docker pipeline for wallet and mint
All changes
- FEAT: Add flake8 by @dni in #267
- Update makefile format check by @callebtc in #293
- [FEAT] add pre-commit by @dni in #294
- [FEAT] Improve tests by @dni in #296
- [DEV] add ruff and remove isort and flake by @dni in #300
- Show all mints in cashu info by @sihamon in #299
- quickfix ruff by @dni in #303
- [CHORE] updating dependencies, mainly fastapi by @dni in #302
- [Wallet] Refactor
restore_promises_from_to
by @callebtc in #307 - update requirements.txt by @callebtc in #308
- Mint/add_cors_to_error_response by @callebtc in #312
- load the proofs or we get a zero balance by @dyKiU in #310
- Refactor: P2PKSecret by @callebtc in #323
- [Wallet/Mint] DLEQ proofs by @callebtc in #175
- HTLCs by @callebtc in #325
- Tests: Test with
LIGHTNING=True
and refactor mint by @callebtc in #326 - Tests: mint operations by @callebtc in #328
- Bump to
0.14.0-rc1
by @callebtc in #329 - Ledger: add more type hints by @callebtc in #330
- Docker: Add wallet daemon and
docker-compose.yml
by @callebtc in #321 - Wallet: fix secret derivation & new CLI command
cashu selfpay
by @callebtc in #331 - update readme by @callebtc in #336
- readme: fix links by @callebtc in #337
- Coalesce all witness fields to
Proof.witness
by @callebtc in #342 - Remove P2SH by @callebtc in #341
- codecov nutshell by @callebtc in #343
- Update README.md by @callebtc in #344
- Wallet: Cache keysets by @callebtc in #333
- Join mint URL and endpoint in a safe way by @sihamon in #298
- [Wallet] Fix fee return for fee=0 by @callebtc in #345
- [Wallet] Add nostr dependency directly to repo by @callebtc in #346
- Format nostr submodule by @callebtc in #347
- Mint: Allow 0-valued amounts for blank outputs by @callebtc in #348
- Zero amount invoices: throw error before attempting a payment by @callebtc in #349
- Wallet: Lightning interface by @callebtc in #318
- Refactor secret conditions by @callebtc in #350
- use specific keyset for returned change by @callebtc in #351
- Fix LNbits backend to use proper BaseModels by @callebtc in #352
- Postgres migrations: remove balance view before children by @callebtc in #353
- fix proxy keys by @callebtc in #355
- Wallet: ensure that mint keys are loaded before calling appropriate api methods by @callebtc in #356
- Hide stacktrace for
DEBUG=FALSE
andProof.do_tict()
minor fixup by @callebtc in #357 - fakewallet: return preimage by @callebtc in #358
Full Changelog: 0.13.0...0.14.0
DLEQ + P2PK - RC2
This is a release candidate for Cashu Nutshell 0.14.0.
What's Changed
- Ledger: add more type hints by @callebtc in #330
- Docker: Add wallet daemon and
docker-compose.yml
by @callebtc in #321 - Wallet: fix secret derivation & new CLI command
cashu selfpay
by @callebtc in #331 - update readme by @callebtc in #336
- readme: fix links by @callebtc in #337
- Coalesce all witness fields to
Proof.witness
by @callebtc in #342 - Remove P2SH by @callebtc in #341
- codecov nutshell by @callebtc in #343
- Update README.md by @callebtc in #344
- Wallet: Cache keysets by @callebtc in #333
- Join mint URL and endpoint in a safe way by @sihamon in #298
- [Wallet] Fix fee return for fee=0 by @callebtc in #345
- [Wallet] Add nostr dependency directly to repo by @callebtc in #346
- Format nostr submodule by @callebtc in #347
- Mint: Allow 0-valued amounts for blank outputs by @callebtc in #348
Full Changelog: 0.14.0-rc1...0.14.0-rc2
0.13.0 – Ecash backups
This update marks a significant milestone in the journey of Cashu. Cashu aims to be an open ecash protocol for the web built on Bitcoin. In order to fulfill this promise, ecash must become easy and safe to use. One of the big challenges for ecash lies in its barer asset nature: if you lose your wallet, your funds are gone. Not anymore!
Background: Deterministic secret derivation
Typically, ecash is minted by generating random data and receiving a mint's blind signature on it. However, we can also derive the data deterministically from a root private key using a standardized BIP32-compatible derivation path. This allows us to derive the root private key as a BIP39 seed phrase (mnemonic) and to derive the same (pseudo-random) data over and over again. If a user loses access to their wallet, we can use this to re-generate all tokens (more precisely the blinded messages) and re-request the mint's signatures on them. Currently, this works over API calls to the mint but we plan to add the ability to restore all ecash from a public copy of the mint's database which will improve the user's privacy during the restore process. See this PR for more details.
Generating a seed phrase
The seed phrase (or mnemonic) is generated when you start the wallet for the first time. To see the seed phrase, enter the following command and write it down somewhere.
cashu info --mnemonic
Note: You can use multiple wallets with Nutshell by using the flag --wallet wallet_name
. Every wallet will have its own mnemonic.
Restoring from a backup
If you lose your wallet and want to restore your balance, first make sure that you did not initialize a wallet already. Backup restore will only work if your wallet is completely fresh. To be sure of that, you can move your local wallet data directory to another place: cp -r ~/.cashu/wallet ~/.cashu/wallet_bak
. If you used a custom wallet name, replace wallet
with the name of your wallet.
When your data directory is empty (i.e. no wallet is initialized yet) you are ready to restore your ecash. Enter the following command to restore your backup.
cashu restore
You will be prompted to enter your mnemonic. After doing so, press enter and you should soon see your balance restored.
Important notes
No backups of old ecash
The seed phrase is generated upon the first startup of the updated wallet. From that moment on, all new ecash will be derived deterministically and can be restored from the seed phrase. This means that, without any further action, you will not be able to restore your old balance in case of a loss of your wallet! In order to be able to restore your old balance as well, you can make one self-payment with your entire balance for each mint. Simply enter cashu send <your_balance>
and cashu receive <token>
. You need to repeat this step for every mint you are using.
Avoid concurrent use in multiple wallets
Since the BIP32 derivation is stateful (i.e., a counter needs to be kept track of), the same mnemonic should not be used across multiple wallets at the same time. That means, if you restore your backup on a new device, you must not keep using the same mnemonic on your old device in the future. Using the same seed phrase over multiple wallets will lead to unpredictable behavior and should be avoided at all times!
New Contributors
Full Changelog: 0.12.3...0.13.0
0.12.3 - P2PK
Pay to pubkey – P2PK
Getting ready for a new type of Nostr zaps
This Nutshell release introduces a new token lock type called Pay-to-Pubkey or P2PK. This allows you to create ecash tokens that can only be spent by their designated recipient. A token locked with P2PK can be posted online without any third party being able to spend it.
Using P2PK
- The receiver generates a public key lock via
cashu lock
. - The sender locks tokens to this public key via
cashu send <amount> --lock <P2PK_lock>
. - The receiver then receives the tokens via
cashu receive <locked_token>
.
Background
In an upcoming upgrade we will also add DLEQ proofs (PR) which allow anyone to check the validity of the mint's signature on a token without having to contact the mint.
These two features combined, P2PK and DLEQ proofs, allow for a very interesting use case: publicly verifiable payments to a pubkey in the form of ecash. As soon as the ecash is publicly posted, the transaction can be viewed as complete: The token can evidently be spent only by the intended recipient, and the validity of its signature can be verified client-side. In such a case, the recipient of this ecash can remain fully offline but be confident that they received a transaction.
It gets even more interesting: This ecash can be attached to anything.... including as a reply to a Nostr note! TBD
The P2PK feature also includes a new timelock
feature that allows you to release a token from its lock after a certain time has passed. After the timelock is passed, the token can either be spent by everyone
Note: This feature is still experimental and some parts are incomplete. Things to add are multisignature spending paths and signature flags that can commit to the outputs of a transaction as well.
NUT updates
- NUT-09: wallet can now show mint information with
cashu info -m
(#262) - NUT-07: Mint responds with token proof's pending state #277
Other changes
- Wallet: Ability to configure a HTTP proxy (#269)
- Fix corner case for fee reserve output calculation (#260 and #261)
Full Changelog: 0.12.1...0.12.3
0.12.1
This release includes a ton of performance and stability improvements!
NUTs:
- Dynamic change output amounts (NUT-08 update)
Mint:
- Use
httpx
library instead ofrequests
for asynchronous operations - Transition from using DB locks to asyncio locks (for compatibility with RaspberryPi systems and LNbits)
Wallet:
- Huge performance increase thanks to db optimizations
- Multimint swaps in Nutshell! Enter
cashu swap
or use the wallet API. - Option to mint tokens of a specific denomination (for headless operation)
- Option to send existing token denominations without a
/split
(for high-frequency payments) - Improve wallet REST API
What's Changed
- [Wallet] Bugfix/enable-funding-multiple-mints by @callebtc in #210
- add CONTRIBUTING.md by @callebtc in #211
- Allow to set maximum peg in/out for mint by @sihamon in #209
- Assert
mint_private_key
is available at startup by @xphade in #208 - [Mint] add trace logs by @callebtc in #213
- more traces by @callebtc in #214
- Mint/moremore_traces by @callebtc in #215
- more logging by @callebtc in #216
- add transactions and locking for certain operations by @Semisol in #217
- Chore: make format by @callebtc in #218
- Refactor Compat and Database for LNbits comaptibility by @callebtc in #219
- [Mint] Fix balance views for Postgres by @callebtc in #222
- [Mint] rewrite lnbits backend with httpx by @callebtc in #230
- Mint API: Check
?amount
is within a sensible range by @AngusP in #226 - [Mint] LNBits backend refactor httpx by @AngusP in #234
- db: postgres cast int to bigint by @callebtc in #231
- Add secp256k1 deps to dockerfile by @ebrakke in #235
- [Wallet] Define responses for API by @sihamon in #233
- Catch all exceptions in wallet API by @sihamon in #220
- Implement dynamic amount of tokens for change by @xphade in #223
- [Wallet] API: optional amount in
InvoiceResponse
by @callebtc in #236 - update .env example to reflect latest flags by @callebtc in #238
- fix typo by @callebtc in #239
- Allow to start wallet API by cashu --daemon by @sihamon in #243
- [Wallet] Allow minting of specific amounts by @callebtc in #248
- [Wallet] send without split by @callebtc in #249
- [Wallet] DB optimization for faster payments by @callebtc in #250
- update readme by @callebtc in #251
- [Mint] Fix: check keyset id in mint and allow custom split amounts for
LIGHTNING=False
by @callebtc in #253 - [Wallet] balance: await wallet.load_proofs() by @callebtc in #254
- [Wallet] no async for deserialization functions by @callebtc in #255
- Use m̶u̶l̶t̶i̶p̶r̶o̶c̶e̶s̶s̶i̶n̶g̶ asyncio locks instead of db locks by @callebtc in #256
- [Wallet] store public keys of each keyset by @callebtc in #165
- Add multi-mint swap to CLI and API by @sihamon in #212
- bump version to 0.12.1 by @callebtc in #258
- Wallet: fix wallet pubkey migration start by @callebtc in #259
New Contributors
- @xphade made their first contribution in #208
- @Semisol made their first contribution in #217
- @AngusP made their first contribution in #226
- @ebrakke made their first contribution in #235
Full Changelog: 0.12.0...0.12.1
Big nut energy
So many new things
Wallet REST API, TokenV3, coin selection
This new release of Nutshell will make you go nuts!
Wallet: New TokenV3 format
The new TokenV3 format makes it a lot easier to parse Cashu tokens. It is already supported by all known Cashu wallets.
Wallet: coin selection of all tokens from old epochs
If the a mint rotates its keys to a new epoch, the wallet will now automatically select all coins from past epochs and redeem them for new ones. That means that all tokens in the wallet should be from the latest epoch which is a requirement for making the Proof of Liabilities Scheme for Ecash work.
Wallet: New REST API
This is a huge improvement for the wallet's utility. This update provides a simple REST API for almost all of the functionality of the wallet that is otherwise accessible via the command line interface. This will make it a lot easier to write apps that can use the Nutshell wallet in the background, for example faucets or other third party software that wants to use Nutshell.
NUT updates
Misc
- Mint: Allow setting as peg-out only by @sihamon in #160
- Mint settings: add mint derivation path by @callebtc in #166
- Wallet: enable Tor tests in CI by @callebtc in #185
Fixes
- Fix: TypeError in burn token by @sihamon in #152
- fix derivation path to 0/0/0/0 by @callebtc in #157
- Fix/ln unsuccessful payment by @callebtc in #159
- fix: load mint with most recent keyset by @callebtc in #162
- load keys of output, not of inputs by @callebtc in #169
- fix: test_step2 by @ngutech21 in #174
- fix double "or" typo in burn parameter validation error message by @theStack in #172
- [Mint] Fix key rotation by @callebtc in #177
- Fix: NOSTR_RELAYS in .env.example by @moonsettler in #181
- [Mint] Fix key derivation by @callebtc in #187
- [Mint] reenable balance db views by @callebtc in #190
- [Mint] load the latest keyset from db based on the derivation path by @callebtc in #193
New Contributors
- @ngutech21 made their first contribution in #174
- @theStack made their first contribution in #172
Full Changelog: 0.10.0...0.12.0
NUT-08: Lower Lightning fees
- Implements NUT-08: mint returns overpaid Lightning fees to wallet
- New FakeWallet backend for testing
- PostgreSQL support enabled (@trbouma)
- CLI improvements (@sihamon)
- Use Pydantic settings class
Mint runners: a few config flags have changed with 0.10.0:
MINT_SERVER_HOST -> MINT_LISTEN_HOST
MINT_SERVER_PORT -> MINT_LISTEN_PORT
LNBITS_ENDPOINT -> MINT_LNBITS_ENDPOINT
LNBITS_KEY -> MINT_LNBITS_KEY
New config flag:
MINT_LIGHTNING_BACKEND
which can bei either LNbitsWallet
or FakeWallet
. The latter is only for testing.