Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zig-bitcoin/coconut
π₯₯ Cashu wallet and mint implementation in Zig
https://github.com/zig-bitcoin/coconut
bitcoin cashu cashubtc lightning-network ziglang
Last synced: 3 months ago
JSON representation
π₯₯ Cashu wallet and mint implementation in Zig
- Host: GitHub
- URL: https://github.com/zig-bitcoin/coconut
- Owner: zig-bitcoin
- License: mit
- Created: 2024-08-06T16:11:52.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-30T17:32:29.000Z (3 months ago)
- Last Synced: 2024-10-01T03:21:18.163Z (3 months ago)
- Topics: bitcoin, cashu, cashubtc, lightning-network, ziglang
- Language: Zig
- Homepage: https://coconut.bitcoinzig.org/
- Size: 19.3 MB
- Stars: 17
- Watchers: 2
- Forks: 5
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - CoconutποΈCashu wallet and mint implementation in Zig
- awesome-cashu - Coconut
- awesome-cashu - Coconut
README
# 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 --mnemonicVersion: 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 πΊ - π±
π» π€ π§βπ« π π¬ π
Nikita Orlov
π»
Add your contributions
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!