commit 6be787c2ef2dbda944262bcd841749892af0f7ac
parent 9284da0d9fa9d1cc5029cb1287e12f749c1b9ac6
Author: NicholasFarrow <nicholas.w.farrow@gmail.com>
Date: Sun, 27 Dec 2020 12:47:04 +1100
Installation instructions and connectivity test for bitcoind
Diffstat:
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
@@ -28,9 +28,13 @@ password = "RPCPASSWORD"
### Run BTCPyment
Run BTCPyment with
```
-gunicorn --worker-class eventlet -w 1 server:app
+gunicorn --worker-class eventlet -w 1 -b 0.0.0.0:8000 server:app
+```
+That's it! You should now be able to view your BTCPyment server at http://YOUR_SERVER_IP:8000/. If running locally, this will be `127.0.0.1:8000`. You might have to allow gunicorn through your firewall with `sudo ufw allow 8000`. You will want to run with nohup so it continues serving in the background:
+```
+nohup gunicorn --worker-class eventlet -w 1 -b 0.0.0.0:8000 server:app > log.txt &
+tail -f log.txt
```
-That's it! You should now be able to view your BTCPyment server at http://YOUR_SERVER_IP:8000/. If running locally, this will be `127.0.0.1:8000`.
## Embed Donation Button
Now embed the donation button into your website
@@ -38,6 +42,9 @@ Now embed the donation button into your website
<iframe src="http://YOUR_SERVER_IP:8000/" style="margin: 0 auto;display:block;height:300px;border:none;overflow:hidden;" scrolling="no"></iframe>
```
+### HTTPS
+If you can see your donation button at `http://YOUR_SERVER_IP:8000/` but not in the embeded iframe, you need to provide gunicorn your website's https certificate with the flags `--certfile=cert.pem --keyfile=key.key`. If you use certbot for SSL, your keys are probably in `/etc/letsencrypt/live/`.
+
# Features
* Lightweight, Python and Javascript talk to your own bitcoin node via websockets and ssh.
* Direct peer-to-peer payments without any middleman. No KYC, and greater privacy than donation systems with reused Bitcoin addresses.
diff --git a/server.py b/server.py
@@ -8,12 +8,6 @@ import config
import invoice
from pay import bitcoind
-# Begin websocket
-async_mode = None
-app = Flask(__name__)
-app.config['SECRET_KEY'] = 'secret!'
-socket_ = SocketIO(app, async_mode=async_mode)
-
# Render html
@app.route('/')
def index():
@@ -131,5 +125,17 @@ def process_payment(payment):
return
+# Begin websocket
+async_mode = None
+app = Flask(__name__)
+app.config['SECRET_KEY'] = 'secret!'
+socket_ = SocketIO(app, async_mode=async_mode)
+
+# Test Bitcoind connection on startup:
+print("Checking node connectivity...")
+bitcoind.btcd('1', 'USD', 'Init test.')
+print("Connection successful.")
+
+
if __name__ == '__main__':
socket_.run(app, debug=True)