Damus

Recent Notes

Egge · 13w
This looks great! Lots is still mocked, right? I have only quickly glanced over the files, maybe I was looking in the wrong place. You might want to look into CDK as well. It’s a battle-tested Cashu...
Ivan Myrvold profile picture
I have tested minting, sending/receiving tokens, and it seems to work. All with real sats. There is probably a lot of bugs in the code, so it should be used with care. I have developed this (with a lot of help from Google Gemini) to learn how Cashu wallets work, but I have still a lot to learn.
Ivan Myrvold profile picture
I have pushed the repositories for my native SwiftUI app CocoCashuApp that I have developed with great inspiration from @Egge coco-cashu. CocoCashuApp is a native, cross-platform Cashu wallet for iOS and macOS, built specifically for the Swift ecosystem. CocoCashu demonstrates how to build a self-custodial ecash wallet using the CocoCashuSwift library at https://github.com/imyrvold/CocoCashuSwift. The app itself is available at https://github.com/imyrvold/CocoCashuApp.
3
Ivan Myrvold · 13w
Looks like a period at the end of the URL’s destroys the opening of my repositories. Here are the repositories: https://github.com/imyrvold/CocoCashuApp and https://github.com/imyrvold/CocoCashuSwift
Egge · 13w
This looks great! Lots is still mocked, right? I have only quickly glanced over the files, maybe I was looking in the wrong place. You might want to look into CDK as well. It’s a battle-tested Cashu implementation written in rust and they got Swift bindings too!
Ivan Myrvold profile picture
I have been working on a Cashu wallet written totalt in Swift for the last few weeks, and at last I got my demo app Cashu wallet working with both minting and melting sats. I used CocoCashu as the template for my app, and asked ChatGPT many weeks ago to create a framework for a Swift-based app.

That resulted in a DemoApp and a Swift Package Manager-based library with a core of the bitcoin-related code that the demo app had a dependency on. The library had only two dependencies:
https://github.com/GigaBitcoin/secp256k1.swift
https://github.com/groue/GRDB.swift.git

After many hours of dialog between ChatGPT and me, I had an app that I could mint sats from one of my Bitcoin wallets (Alby Go and Minibits). But it always failed to withdraw the sats back to my wallets.
And at last ChatGPT gave up, and adviced me to just let it be for now.

When Gemini 3 came out a week or two ago, I wanted to see if it could help me progressing my project. I made a small script to copy all my Xcode Swift files into one file, preserving the file paths with a comment on top of each file. Gemini 3 picked up the project in no time, and then we made some changes that at last made the melt function work.

Why would anyone try to make a Cashu wallet in Swift, I am sure you will ask? Well, I have been developing iOS apps for the iPhone since Swift came out 10 years ago, and is the programming language I know best, so other programming languages are no option for me. And to understand something I have to build it in the language I know. I don't claim that I know all of the Cashu protocol now, but working with it more I hope I will get a reasonable knowledge of it. And I love the concept of Cashu wallets and follows @calle here in nostr.

Now that the app and the library is working, I will test it more and cleanup the code to be more like a real app instead of a demo app, and publish it in Github for anyone else that want to use it.

Håper dette er til nytte for noen andre enn meg etterhvert 😊 Thanks @calle for your work on Cashu. You are a great inspiration..

Here is Gemini’s closing coment on my last run:

That is a perfect run! Your Cashu wallet is now fully functional and robust.
Here is the accounting of that transaction to confirm why 76 sats is the correct balance:
Starting Balance: 100 sats.
Input Selected: The wallet picked the 64 sat coin to pay the bill.
Remaining in wallet: 32 + 4 = 36 sats.
The Bill: 20 sats to Lightning + 2 sats Fee Reserve = 22 sats.
The Change Calculation: 64 (Input) - 22 (Cost) = 42 sats.
The Split: 42 sats was split into [32, 8, 2].
The Mint's Response: The mint signed the 32 and 8 coins, but kept the 2 sat coin (likely because the actual routing fee turned out to be 4 sats total, consuming the reserve + the dust coin).
Robust Recovery: Thanks to your fix, the app accepted the 32+8 sats and just warned about the missing 2 sats instead of failing.
Final Balance: 36 (Unspent) + 40 (Change) = 76 sats.
Final Cleanup

You have successfully built a Swift Cashu wallet that handles:
[x] Minting (NUT-03)
[x] Melting (NUT-05)
[x] Standard Blinding (Hash-To-Curve)
[x] Robust Change Handling
[x] Persistence

Great job! Would you like to tackle Token Swapping (sending Cashu tokens to another user) next, or perhaps improve the UI?
Ivan Myrvold profile picture
I thought today would be a good day to buy some Bitcoin, and I sent some of my fiat kroner to Strike from my bank. Then I got an email from my bank, demanding 1. What’s the purpose of the money transfer, 2. How did I get in contact with the company I wanted to send money to, 3. Do I expect to send more money to the company and 4. Asking me to document the purpose of the money transfer with an invoice or contract. If I didn’t do that they would not transfer the money. I wanted to say fuck you, but as the nice person I am I answered all but the last question. I explained I used a modern digital way of obtaining bitcoin with a mobile app and don’t have a contract or invoice. They at last confirmed the transfer, letting me use my own hard-earned money to buy bitcoin.
Thomas · 35w
Simpler times 😂 I was doing iOS dev in objective-c and I remember watching the swift release video.
Vildes Verden · 39w
Takk!🙏🏻