This commit is contained in:
callebtc
2022-09-15 01:02:37 +03:00
parent 35174b5e4a
commit b2f8a9824d

View File

@@ -7,16 +7,14 @@ Ecash implementation based on David Wagner's variant of Chaumian blinding. Token
Big thanks to [phyro](https://github.com/phyro) for their work and further discussions and improvements.
## Install
### Prerequisites
```bash
git clone https://github.com/callebtc/cashu.git
sudo apt install -y build-essential pkg-config libffi-dev libpq-dev zlib1g-dev libssl-dev python3-dev
# on mac: brew install postgres
# install python using pyenv
curl https://pyenv.run | bash
# put this in your ~/.bashrc
echo export PYENV_ROOT=\"$HOME/.pyenv\" >> ~/.bashrc
echo command -v pyenv >/dev/null || export PATH=\"$PYENV_ROOT/bin:$PATH\" >> ~/.bashrc
source ~/.bashrc
@@ -29,8 +27,11 @@ pyenv install 3.9.13
curl -sSL https://install.python-poetry.org | python3 -
echo export PATH=\"$HOME/.local/bin:$PATH\" >> ~/.bashrc
source ~/.bashrc
```
### Install Cashu
```bash
# install cashu
git clone https://github.com/callebtc/cashu.git
cd cashu
pyenv local 3.9.13
poetry install
@@ -43,15 +44,19 @@ mv .env.example .env
vim .env
```
## Run mint
To use the wallet with the [public test mint](#test-instance), you need to change the appropriate entries in the `.env` file.
## Run a mint yourself
This runs the mint on your local computer. Skip this step if you want to use the [public test mint](#test-instance) instead.
```bash
poetry run uvicorn mint.app:app --port 3338
```
## Run wallet
## Use wallet
#### Request a mint
This command will return a Lightning invoice and a payment hash. You have to pay the invoice before you can receive the tokens. Note: Minting tokens involves two separate steps: requesting a mint, and actually minting tokens (see below).
This command will return a Lightning invoice and a payment hash. You have to pay the invoice before you can receive the tokens. Note: Minting tokens involves two steps: requesting a mint, and actually minting tokens (see below).
```bash
poetry run ./cashu --wallet=wallet --mint=420
@@ -77,12 +82,13 @@ Balance: 420
```
#### Send tokens
To send tokens to another user, enter
```bash
poetry run ./cashu --send=69
```
You should see the encoded tokens that you can send via text to another person. Copy them and send them via any means.
You should see the encoded token. Copy the token and send it to another user such as via email or a messenger. The token looks like this:
```bash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MTQxMDY3Mzg1MDg5MjA2MTU2NjQxMjM4Nzg5MDE4NzAzODg0NjAwNDUzNTAwNzY3...
```
#### Receive tokens
@@ -90,7 +96,7 @@ To receive tokens, another user enters:
```bash
poetry run ./cashu --receive=W3siYW1vdW50IjogMSwgIkMiOi...
```
Returns:
You should see the balance increase:
```bash
wallet balance: 0
wallet balance: 69
@@ -112,7 +118,6 @@ wallet balance: 351
*Warning: this instance is just for demonstration only. Currently, only Lightning deposits work but not withdrawals. The server could vanish at any moment so consider any Satoshis you deposit a donation. I will add Lightning withdrawals soon so unless someone comes up with a huge inflation bug, you might be able to claim them back at a later point in time.*
Change the appropriate `.env` file settings to
```bash
MINT_HOST=8333.space