Skip to content

An JavaScript library for building Cashu wallets

License

Notifications You must be signed in to change notification settings

devSabz404/cashu-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cashu-js

cashu-js is an npm package for building Cashu ecash wallets.

Cashu is an Ecash implementation based on David Wagner's variant of Chaumian blinding. Token logic based on minicash (description) which implements a Blind Diffie-Hellman Key Exchange scheme written down by Ruben Somsen here.

Progress

  • Request mint
  • Mint tokens
  • Split tokens
  • Send tokens
  • Receive tokens
  • Melt tokens
  • Check spendable
  • Check fees
  • Keysets
  • Local storage
  • Serialize tokens V1
  • Serialize tokens V2

Running and testing the client

You need a Cashu mint for testing. If you don't already have one, follow the instructions below to set one up. Then we will run the JS code in this repo.

Set up a mint

Install the Cashu Python mint and run the server on localhost:3338. Don't be afraid. This is a quick an easy process if you follow the instructions carefully.

Run the mint:

LIGHTNING=FALSE poetry run mint

Here we made sure to disable Lightning for testing purposes, otherwise the mint will demand a Lightning payment (set LIGHTNING=FALSE in .env file to disable it permanently).

Set up cashu-js

Clone this repository and install the dependencies:

git clone https://github.com/cashubtc/cashu-js-wallet.git
npm install
Mint tokens and receive Lightnign invoices
node src/index.js mint 420 <invoice_hash>

Note: If you've set LIGHTNING=FALSE in the mint, you can use any invoice_hash you want here.

Melt tokens and pay Lightnign invoices
node src/index.js pay <invoice>
Send tokens
node src/index.js send 69
Receive tokens
node src/index.js receive W3siaWQiOiJEU0FsOW52dnlm...
Receive tokens
node src/index.js receive W3siaWQiOiJEU0FsOW52dnlm...
Run tests

...

About

An JavaScript library for building Cashu wallets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published