gonuts

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: MIT

README

Disclaimer: The author is NOT a cryptographer and this work has not been reviewed. This means that there is very likely a fatal flaw somewhere. Cashu is still experimental and not production-ready.

Don't be reckless: This project is in early development, it does however work with real sats! Always use amounts you don't mind losing.

gonuts

Cashu wallet and mint implementation in Go.

Cashu is a free and open-source Chaumian ecash system built for Bitcoin. You can read more about it here.

Supported NUTs

Implemented NUTs:

Installation

With Go installed, you can run the following command to install the wallet:

git clone https://github.com/elnosh/gonuts
cd gonuts
go install ./cmd/nutw/

To setup a mint for the wallet, create a .env file at ~/.gonuts/wallet/.env and setup your preferred mint.

Using the wallet

Check balance
nutw balance
Create a Lightning invoice to receive ecash
nutw mint 100

This will get an invoice from the mint which you can then pay and use to mint new ecash.

invoice: lnbc100n1pja0w9pdqqx...
Redeem the ecash after paying the invoice
nutw mint --invoice lnbc100n1pja0w9pdqqx...
Send tokens
nutw send 21

This will generate a Cashu token that looks like this:

cashuAeyJ0b2tlbiI6W3sibW...

This is the ecash that you can then send to anyone.

Receive tokens
nutw receive cashuAeyJ0b2tlbiI6W3...
Request the mint to pay a Lightning invoice
nutw pay lnbc100n1pju35fedqqsp52xt3...

Development

Requirements

Wallet
  • cd cmd/nutw
  • create .env file and fill in the values
  • go build -v -o nutw nutw.go
Run mint
  • cd cmd/mint

  • you'll need to setup a lightning regtest environment with something like Polar and fill in the values in the .env file

  • go build -v -o mint mint.go

  • ./mint

Contribute

All contributions are welcome.

If you want to contribute, please open an Issue or a PR.

Directories

Path Synopsis
Package cashu contains the core structs and logic of the Cashu protocol.
Package cashu contains the core structs and logic of the Cashu protocol.
nuts/nut01
Package nut01 contains structs as defined in NUT-01 [NUT-01]: https://github.com/cashubtc/nuts/blob/main/01.md
Package nut01 contains structs as defined in NUT-01 [NUT-01]: https://github.com/cashubtc/nuts/blob/main/01.md
nuts/nut02
Package nut02 contains structs as defined in NUT-02 [NUT-02]: https://github.com/cashubtc/nuts/blob/main/02.md
Package nut02 contains structs as defined in NUT-02 [NUT-02]: https://github.com/cashubtc/nuts/blob/main/02.md
nuts/nut03
Package nut03 contains structs as defined in NUT-03 [NUT-03]: https://github.com/cashubtc/nuts/blob/main/03.md
Package nut03 contains structs as defined in NUT-03 [NUT-03]: https://github.com/cashubtc/nuts/blob/main/03.md
nuts/nut04
Package nut04 contains structs as defined in NUT-04 [NUT-04]: https://github.com/cashubtc/nuts/blob/main/04.md
Package nut04 contains structs as defined in NUT-04 [NUT-04]: https://github.com/cashubtc/nuts/blob/main/04.md
nuts/nut05
Package nut05 contains structs as defined in NUT-05 [NUT-05]: https://github.com/cashubtc/nuts/blob/main/05.md
Package nut05 contains structs as defined in NUT-05 [NUT-05]: https://github.com/cashubtc/nuts/blob/main/05.md
nuts/nut06
Package nut06 contains structs as defined in NUT-06 [NUT-06]: https://github.com/cashubtc/nuts/blob/main/06.md
Package nut06 contains structs as defined in NUT-06 [NUT-06]: https://github.com/cashubtc/nuts/blob/main/06.md
cmd
Package crypto implements the cryptography used in the Cashu protocol as explained in [Cashu].
Package crypto implements the cryptography used in the Cashu protocol as explained in [Cashu].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL