mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-23 11:44:19 +01:00
update
This commit is contained in:
15
.env.example
15
.env.example
@@ -1,15 +1,16 @@
|
||||
DEBUG = true
|
||||
|
||||
MINT_PRIVATE_KEY=supersecretprivatekey
|
||||
# WALLET
|
||||
|
||||
# for the mint
|
||||
MINT_SERVER_HOST=127.0.0.1
|
||||
MINT_SERVER_PORT=3338
|
||||
|
||||
# for the wallet
|
||||
MINT_HOST=127.0.0.1
|
||||
MINT_PORT=3338
|
||||
|
||||
# LnbitsWallet
|
||||
# MINT
|
||||
|
||||
MINT_PRIVATE_KEY=supersecretprivatekey
|
||||
|
||||
MINT_SERVER_HOST=127.0.0.1
|
||||
MINT_SERVER_PORT=3338
|
||||
|
||||
LNBITS_ENDPOINT=https://legend.lnbits.com
|
||||
LNBITS_KEY=yourkeyasdasdasd
|
||||
11
README.md
11
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
**The author is NOT a cryptographer and has not tested the libraries used or the code nor has anyone reviewed the work. This means it's very likely a fatal flaw somewhere. This is meant only as educational and is not production ready.**
|
||||
|
||||
Ecash implementation based on David Wagner's variant of Chaumian blinding. 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 by Ruben Somsen [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406). The database mechanics and the Lightning backend is inspired by [LNbits](https://github.com/lnbits/lnbits-legend).
|
||||
Ecash implementation based on David Wagner's variant of Chaumian blinding. 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 by Ruben Somsen [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406). The database mechanics and the Lightning backend uses parts from [LNbits](https://github.com/lnbits/lnbits-legend).
|
||||
|
||||
Big thanks to [phyro](https://github.com/phyro) for their work and further discussions and improvements.
|
||||
|
||||
@@ -53,5 +53,14 @@ poetry run uvicorn mint.app:app --port 3338
|
||||
poetry run ./cashu --wallet=wallet --mint=420
|
||||
```
|
||||
|
||||
## Test instance
|
||||
*Warning: this instance is just for demonstrations only. Currently, only Lightning deposits work but not withdrawals. The server could vanish at any moment so consider any Satoshis you deposit a donation.*
|
||||
|
||||
Change the appropriate `.env` file settings to
|
||||
```bash
|
||||
MINT_HOST=8333.space
|
||||
MINT_PORT=3338
|
||||
```
|
||||
|
||||
## Screenshot
|
||||

|
||||
|
||||
5
cashu
5
cashu
@@ -10,7 +10,7 @@ from bech32 import bech32_decode, bech32_encode, convertbits
|
||||
|
||||
from wallet.migrations import m001_initial
|
||||
from wallet.wallet import Wallet as Wallet
|
||||
|
||||
from core.settings import MINT_URL
|
||||
|
||||
# https://github.com/pallets/click/issues/85#issuecomment-503464628
|
||||
def coro(f):
|
||||
@@ -22,7 +22,7 @@ def coro(f):
|
||||
|
||||
|
||||
@click.command("mint")
|
||||
@click.option("--host", default="http://localhost:3338", help="Mint hostname.")
|
||||
@click.option("--host", default=MINT_URL, help="Mint hostname.")
|
||||
@click.option("--wallet", default="wallet", help="Wallet to use.")
|
||||
@click.option("--mint", default=0, help="Mint tokens.")
|
||||
@click.option("--hash", default="", help="Hash of the paid invoice.")
|
||||
@@ -31,6 +31,7 @@ def coro(f):
|
||||
@click.option("--invalidate", default="", help="Invalidate tokens.")
|
||||
@coro
|
||||
async def main(host, wallet, mint, hash, send, receive, invalidate):
|
||||
print(host)
|
||||
wallet = Wallet(host, f"data/{wallet}", wallet)
|
||||
await m001_initial(db=wallet.db)
|
||||
await wallet.load_proofs()
|
||||
|
||||
@@ -13,6 +13,11 @@ MINT_SERVER_PORT = env.int("MINT_SERVER_PORT", default=3338)
|
||||
MINT_HOST = env.str("MINT_HOST", default="127.0.0.1")
|
||||
MINT_PORT = env.int("MINT_PORT", default=3338)
|
||||
|
||||
if MINT_HOST == "127.0.0.1":
|
||||
MINT_URL = f"http://{MINT_HOST}:{MINT_PORT}"
|
||||
else:
|
||||
MINT_URL = f"https://{MINT_HOST}:{MINT_PORT}"
|
||||
|
||||
LNBITS_ENDPOINT = env.str("LNBITS_ENDPOINT", default=None)
|
||||
LNBITS_KEY = env.str("LNBITS_KEY", default=None)
|
||||
|
||||
|
||||
13
poetry.lock
generated
13
poetry.lock
generated
@@ -589,15 +589,14 @@ python-versions = ">=3.7"
|
||||
|
||||
[[package]]
|
||||
name = "urllib3"
|
||||
version = "1.26.9"
|
||||
version = "1.23"
|
||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4"
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"]
|
||||
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
|
||||
secure = ["pyOpenSSL (>=0.14,<18.0.0)", "pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
|
||||
[[package]]
|
||||
@@ -655,7 +654,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "6c846ea3f88e2a806b202709a65d5e825cd2e5c8ea42892b1731fdeb7c718124"
|
||||
content-hash = "d45268f8d5612bc589a73025d9191d26eee50ebf335d836b4ad3c10e6c72b95c"
|
||||
|
||||
[metadata.files]
|
||||
anyio = [
|
||||
@@ -1025,8 +1024,8 @@ typing-extensions = [
|
||||
{file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"},
|
||||
]
|
||||
urllib3 = [
|
||||
{file = "urllib3-1.26.9-py2.py3-none-any.whl", hash = "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14"},
|
||||
{file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"},
|
||||
{file = "urllib3-1.23-py2.py3-none-any.whl", hash = "sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"},
|
||||
{file = "urllib3-1.23.tar.gz", hash = "sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf"},
|
||||
]
|
||||
uvicorn = [
|
||||
{file = "uvicorn-0.18.3-py3-none-any.whl", hash = "sha256:0abd429ebb41e604ed8d2be6c60530de3408f250e8d2d84967d85ba9e86fe3af"},
|
||||
|
||||
@@ -20,7 +20,7 @@ idna = "3.3"
|
||||
itsdangerous = "2.1.1"
|
||||
Jinja2 = "3.0.3"
|
||||
MarkupSafe = "2.1.1"
|
||||
urllib3 = "1.26.9"
|
||||
urllib3 = "1.23"
|
||||
Werkzeug = "2.2.2"
|
||||
ecc-pycrypto = {git = "https://github.com/lc6chang/ecc-pycrypto.git", rev = "v1.0.1"}
|
||||
asgiref = "^3.5.2"
|
||||
|
||||
Reference in New Issue
Block a user