diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cf1a176b..42069702 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,7 +49,7 @@ jobs: poetry-version: ${{ inputs.poetry-version }} - name: Run tests env: - MINT_LIGHTNING_BACKEND: FakeWallet + MINT_BACKEND_BOLT11_SAT: FakeWallet WALLET_NAME: test_wallet MINT_HOST: localhost MINT_PORT: 3337 diff --git a/Makefile b/Makefile index f6cb065b..3dc8c347 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ test: test-lndrest: PYTHONUNBUFFERED=1 \ DEBUG=true \ - MINT_LIGHTNING_BACKEND=LndRestWallet \ + MINT_BACKEND_BOLT11_SAT=LndRestWallet \ MINT_LND_REST_ENDPOINT=https://localhost:8081/ \ MINT_LND_REST_CERT=../cashu-regtest-enviroment/data/lnd-3/tls.cert \ MINT_LND_REST_MACAROON=../cashu-regtest-enviroment/data/lnd-3/data/chain/bitcoin/regtest/admin.macaroon \ diff --git a/README.md b/README.md index fb6aa6b4..9a9a2b0f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ *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.* -Cashu is an Ecash implementation based on David Wagner's variant of Chaumian blinding ([protocol specs](https://github.com/cashubtc/nuts)). Token logic based on [minicash](https://github.com/phyro/minicash) ([description](https://gist.github.com/phyro/935badc682057f418842c72961cf096c)) which implements a [Blind Diffie-Hellman Key Exchange](https://cypherpunks.venona.com/date/1996/03/msg01848.html) scheme written down [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406). The database mechanics in Cashu Nutshell and the Lightning backend uses parts from [LNbits](https://github.com/lnbits/lnbits-legend). +Cashu is an Ecash implementation based on David Wagner's variant of Chaumian blinding ([protocol specs](https://github.com/cashubtc/nuts)). Token logic based on [minicash](https://github.com/phyro/minicash) ([description](https://gist.github.com/phyro/935badc682057f418842c72961cf096c)) which implements a [Blind Diffie-Hellman Key Exchange](https://cypherpunks.venona.com/date/1996/03/msg01848.html) scheme written down [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406).

Cashu protocol ยท @@ -169,12 +169,19 @@ You can find the API docs at [http://localhost:4448/docs](http://localhost:4448/ # Running a mint This command runs the mint on your local computer. Skip this step if you want to use the [public test mint](#test-instance) instead. -Before you can run your own mint, make sure to enable a Lightning backend in `MINT_LIGHTNING_BACKEND` and set `MINT_PRIVATE_KEY` in your `.env` file. +## Docker + +``` +docker run -d -p 3338:3338 --name nutshell -e MINT_BACKEND_BOLT11_SAT=FakeWallet -e MINT_LISTEN_HOST=0.0.0.0 -e MINT_LISTEN_PORT=3338 -e MINT_PRIVATE_KEY=TEST_PRIVATE_KEY cashubtc/nutshell:0.15.2 poetry run mint +``` + +## From this repository +Before you can run your own mint, make sure to enable a Lightning backend in `MINT_BACKEND_BOLT11_SAT` and set `MINT_PRIVATE_KEY` in your `.env` file. ```bash poetry run mint ``` -For testing, you can use Nutshell without a Lightning backend by setting `MINT_LIGHTNING_BACKEND=FakeWallet` in the `.env` file. +For testing, you can use Nutshell without a Lightning backend by setting `MINT_BACKEND_BOLT11_SAT=FakeWallet` in the `.env` file. # Running tests @@ -185,7 +192,7 @@ poetry install --with dev Then, make sure to set up your mint's `.env` file to use a fake Lightning backend and disable Tor: ```bash -MINT_LIGHTNING_BACKEND=FakeWallet +MINT_BACKEND_BOLT11_SAT=FakeWallet TOR=FALSE ``` You can run the tests with diff --git a/cashu/core/settings.py b/cashu/core/settings.py index ed586315..f1f1946a 100644 --- a/cashu/core/settings.py +++ b/cashu/core/settings.py @@ -56,7 +56,7 @@ class MintSettings(CashuSettings): mint_listen_host: str = Field(default="127.0.0.1") mint_listen_port: int = Field(default=3338) - mint_lightning_backend: str = Field(default="") + mint_lightning_backend: str = Field(default="") # deprecated mint_backend_bolt11_sat: str = Field(default="") mint_backend_bolt11_usd: str = Field(default="") diff --git a/cashu/lightning/__init__.py b/cashu/lightning/__init__.py index 89e46188..521eb497 100644 --- a/cashu/lightning/__init__.py +++ b/cashu/lightning/__init__.py @@ -7,5 +7,5 @@ from .lndrest import LndRestWallet # noqa: F401 from .strike import StrikeUSDWallet # noqa: F401 -if settings.mint_lightning_backend is None: - raise Exception("MINT_LIGHTNING_BACKEND not configured") +if settings.mint_backend_bolt11_sat is None or settings.mint_backend_bolt11_usd is None: + raise Exception("MINT_BACKEND_BOLT11_SAT or MINT_BACKEND_BOLT11_USD not set") diff --git a/docker-compose.yaml b/docker-compose.yaml index 557388b7..f2695db0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,7 @@ services: ports: - "3338:3338" environment: - - MINT_LIGHTNING_BACKEND=FakeWallet + - MINT_BACKEND_BOLT11_SAT=FakeWallet - MINT_LISTEN_HOST=0.0.0.0 - MINT_LISTEN_PORT=3338 - MINT_PRIVATE_KEY=TEST_PRIVATE_KEY diff --git a/tests/helpers.py b/tests/helpers.py index 94fe729b..456ab21b 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -25,7 +25,7 @@ async def get_random_invoice_data(): wallets_module = importlib.import_module("cashu.lightning") -wallet_class = getattr(wallets_module, settings.mint_lightning_backend) +wallet_class = getattr(wallets_module, settings.mint_backend_bolt11_sat) WALLET = wallet_class() is_fake: bool = WALLET.__class__.__name__ == "FakeWallet" is_regtest: bool = not is_fake