SatSale

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 2e3353ab7929014c9f046e5aeaeeb43773800bc7
parent e15e04ed1b162b873cc11ea377c4ced4fc7a6481
Author: nickfarrow <nick@nickfarrow.com>
Date:   Tue, 18 May 2021 01:53:15 +1000

Add example configs

Diffstat:
M.gitignore | 2+-
MREADME.md | 5++---
Adocs/config_lightning.py | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adocs/config_remote_node.py | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdocs/lightning.md | 10+++-------
5 files changed, 119 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -5,4 +5,4 @@ __pycache__/ gateways/__pycache__/ invoice/__pycache__/ pay/__pycache__/ -BTCPyment_API_key +SatSale_API_key diff --git a/README.md b/README.md @@ -38,7 +38,7 @@ rpcport = "8332" username = "bitcoinrpc" password = "RPCPASSWORD" ``` -(You can find these in `~/.bitcoin/bitcoin.conf`). If your node is remote to your server, you can specify an SSH `tunnel_host = "pi@192.168.0.252"` that will forward `rpcport`. You may also need to set `rpcallowip=YOUR_SERVER_IP` in your `~/.bitcoin/bitcoin.conf`. If you want to use lightning network payments, see [Lightning instructions](docs/lightning.md)]. +(You can find these in `~/.bitcoin/bitcoin.conf`). Example configs, for enabling lightning or hosting SatSale on a remote machine can be found in [docs/](docs/). If you want to use lightning network payments, see [Lightning instructions](docs/lightning.md)]. ### Run SatSale Run SatSale with @@ -62,8 +62,7 @@ Now embed the donation button into your website HTML: ```html <iframe src="http://YOUR_SERVER_IP:8000/" style="margin: 0 auto;display:block;width:420px;height:240px;border:none;overflow:hidden;" scrolling="no"></iframe> ``` -(change height to 380 if using LND to account for longer addresses) -Changing `YOUR_SERVER_IP` to the IP address of the machine you're running SatSale on. Optionally, you can redirect a domain to that IP and use that instead. +Changing `YOUR_SERVER_IP` to the IP address of the machine you're running SatSale on, node or otherwise. Additionally, you could redirect a domain to that IP and use that instead. ### Using HTTPS & Domains Embedded iframes are easy if your site only uses HTTP. But if your site uses HTTPS, then you can see your donation button at `http://YOUR_SERVER_IP:8000/` but will not be able to in an embedded iframe. See [HTTPS instructions](docs/HTTPS.md). diff --git a/docs/config_lightning.py b/docs/config_lightning.py @@ -0,0 +1,55 @@ +# In this example config, we enable lightning payments +# On-chain payments will still be an option for users + +# We will be hosting SatSale on the same machine as our node. +# SatSale & Bitcoin Lightning Node 1.1.1.1 8332, 10009 (bitcoind, lnd) + +# As we are running SatSale on our node, +# it can directly talk to our node at localhost 127.0.0.1 +host = "127.0.0.1" +rpcport = "8332" + +# From ~/.bitcoin/bitcoin.conf +username = "bitcoinrpc" +password = "RPAPASSWORD" + +# Wallet ("" if single-wallet node, OR wallet name/path as shown in `biitcoin-cli listwallets`) +wallet = "" + +# File in which API key will be stored +api_key_path = "BTCPyment_API_key" + +# As we are running SatSale on our node +# we do not require any remote tunnel +tunnel_host = None + +# Check for payment every xx seconds +pollrate = 15 + +# Payment expires after xx seconds +payment_timeout = 60*60 + +# Required confirmations for a payment +required_confirmations = 2 + +# Global connection attempts +connection_attempts = 3 + +# Redirect url after payment +redirect = "https://github.com/nickfarrow/satsale" + +# Payment method has been switched to lnd +#pay_method = "bitcoind" +pay_method = "lnd" + +# Specify lightning directory and port +lnd_dir = "~/.lnd/" +lnd_rpcport = "10009" + +# Login certificates automatically pulled from ~/.lnd/ and ~/.lnd/data/chain/bitcoin/mainnet/ +lnd_macaroon = "invoice.macaroon" +lnd_cert = "tls.cert" + +# DO NOT CHANGE THIS TO TRUE UNLESS YOU WANT ALL PAYMENTS TO AUTOMATICALLY +# BE CONSIDERED AS PAID. +free_mode = False diff --git a/docs/config_remote_node.py b/docs/config_remote_node.py @@ -0,0 +1,58 @@ +# In this example config, we have two machines +# The first machine is our bitcoin node +# and the second remote machine hosts SatSale (perhaps same server you host your website on) + +# Bitcoin Lightning Node 1.1.1.1 8332, 10009, 22 (bitcoind, lnd, SSH) +# SatSale 2.2.2.2 + +# In this config we will tell SatSale to connect to our node +# and tunnel the required ports over SSH. +# SatSale can then talk to our node on localhost 127.0.0.1 +host = "127.0.0.1" +rpcport = "8332" +# If connections get kicked back, you may also need to set `rpcallowip=YOUR_SERVER_IP` in your `~/.bitcoin/bitcoin.conf`. + +# From ~/.bitcoin/bitcoin.conf +username = "bitcoinrpc" +password = "RPAPASSWORD" + +# Wallet ("" if single-wallet node, OR wallet name/path as shown in `biitcoin-cli listwallets`) +wallet = "" + +# File in which API key will be stored +api_key_path = "BTCPyment_API_key" + +# Telling SatSale to use SSH to tunnel the required ports +# Make sure SSHing into your node via command line works +tunnel_host = "pi@1.1.1.1" + +# Check for payment every xx seconds +pollrate = 15 + +# Payment expires after xx seconds +payment_timeout = 60*60 + +# Required confirmations for a payment +required_confirmations = 2 + +# Global connection attempts +connection_attempts = 3 + +# Redirect url after payment +redirect = "https://github.com/nickfarrow/satsale" + +# Payment method has been switched to lnd +#pay_method = "bitcoind" +pay_method = "lnd" + +# Specify lightning directory and port +lnd_dir = "~/.lnd/" +lnd_rpcport = "10009" + +# Login certificates automatically pulled from ~/.lnd/ and ~/.lnd/data/chain/bitcoin/mainnet/ +lnd_macaroon = "invoice.macaroon" +lnd_cert = "tls.cert" + +# DO NOT CHANGE THIS TO TRUE UNLESS YOU WANT ALL PAYMENTS TO AUTOMATICALLY +# BE CONSIDERED AS PAID. +free_mode = False diff --git a/docs/lightning.md b/docs/lightning.md @@ -1,11 +1,7 @@ # Lightning Support -Recently we have added support for Lightning Network Daemon, with plans to extend support to clightning in the near future. +Recently we have added support for Lightning Network Daemon, with plans to extend support to clightning in the near future. An example config can be found in [/docs/config_lightning.py](/docs/config_lightning.py). -You will need to install the additional dependency lndgrpc: -``` -pip3 install lndgrpc==0.2.0 -``` -If it fails to build or is taking a while, see this [solution](https://stackoverflow.com/questions/56357794/unable-to-install-grpcio-using-pip-install-grpcio#comment113013007_62500932). +If installing the python library lndgrpc requirement failed, see this [solution](https://stackoverflow.com/questions/56357794/unable-to-install-grpcio-using-pip-install-grpcio#comment113013007_62500932). To use lightning, you need to change your `pay_method` in `config.py`, and set your lightning directory on your node. ```python @@ -20,5 +16,5 @@ Your node will require sufficient liquidity and connection to receive payments. You may also need a taller iframe for the longer address: ``` -<iframe src="http://YOUR_SERVER_IP:8000/" style="margin: 0 auto;display:block;width:420px;height:360px;border:none;overflow:hidden;" scrolling="no"></iframe> +<iframe src="http://YOUR_SERVER_IP:8000/" style="margin: 0 auto;display:block;width:420px;height:380px;border:none;overflow:hidden;" scrolling="no"></iframe> ```