coconut-logo

Cashu wallet and mint in Zig

GitHub Workflow Status Zig Bitcoin Bitcoin Lightning
# About Coconut πŸ₯₯ is a Cashu Wallet and Mint implementation in Zig. ## Test ```sh zig build test --summary all ``` ## Build ```sh zig build -Doptimize=ReleaseFast ``` ## CLI Usage The Coconut wallet provides a command-line interface for various operations. Here's how to use it: ### General Help To see the general help and available commands, run: ```text $ coconut --help Version: 0.1.0 Author: Coconut Contributors USAGE: coconut [OPTIONS] COMMANDS: info Display information about the Coconut wallet OPTIONS: -h, --help Show this help output. --color When to use colors (*auto*, never, always). ``` ### Info Command The `info` command displays information about the Coconut wallet. Here's its specific help: ```text $ coconut info --help USAGE: coconut info [OPTIONS] OPTIONS: -m, --mint Fetch mint information -n, --mnemonic Show your mnemonic -h, --help Show this help output. ``` ### Example Usage Here's an example of using the `info` command with the `--mnemonic` option: ```text $ coconut info --mnemonic Version: 0.1.0 Wallet: coconut Cashu dir: /Users/abdel/Library/Application Support/coconut Mints: - URL: https://example.com:3338 - Keysets: - ID: example_id unit: sat active: True fee (ppk): 0 Mnemonic: - example word1 word2 word3 ... Nostr: - Public key: npub1example... - Relays: wss://example1.com, wss://example2.com ``` This command displays general information about the wallet, including the version, wallet name, Cashu directory, mint information, and Nostr details. The `--mnemonic` option additionally displays the wallet's mnemonic phrase. Note: Be cautious when using the `--mnemonic` option, as it displays sensitive information. Make sure you're in a secure environment when viewing your mnemonic. ## Benchmarks This project includes performance benchmarks for each step of the BDHKE process, as well as the end-to-end flow. ### Running Benchmarks Locally To run the benchmarks on your local machine: ```sh zig build bench -Doptimize=ReleaseFast ``` The benchmarks will be compiled with the ReleaseFast optimization level. ### Benchmark Results Current results: | Operation | Time us | Time ns | | ----------- | ---------- | ------------ | | hashToCurve | 7.182 us | 7181.94 ns | | step1Alice | 23.608 us | 23608.43 ns | | step2Bob | 28.003 us | 28002.82 ns | | step3Alice | 25.102 us | 25101.80 ns | | verify | 29.020 us | 29020.39 ns | | e2e | 112.626 us | 112626.12 ns | This run was performed on a MacBook Pro with an M1 chip. ```bash Machine Info: Model: MacBook Pro CPU: Apple M1 Max Cores: 10 (Physical), 10 (Logical) Memory: 64 GB macOS Version: 14.5 Zig Version: 0.14.0-dev.850+ddcb7b1c1 ``` ## Resources - [Cashu documentation](https://docs.cashu.space/) - [Cashu slides by Gandalf](https://lconf.gandlaf.com/) - [Nutshell reference implementation](https://github.com/cashubtc/nutshell) ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Aβ‚Ώdel ∞/21M 🐺 - 🐱
Aβ‚Ώdel ∞/21M 🐺 - 🐱

πŸ’» πŸ€” πŸ§‘β€πŸ« πŸ“† πŸ”¬ πŸ‘€
Nikita Orlov
Nikita Orlov

πŸ’»
Add your contributions
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!