README.md (9687B)
1 # SatSale 2 3 <!---Existing self-custody Bitcoin payment processors are bloated, difficult to install, and not easily customisable.---> 4 5 SatSale is a lightweight Bitcoin payment processor that connects to your own Bitcoin node or Lightning network node. 6 7 | Donation Button -----> | Bitcoin Payment Gateway | 8 | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | 9 | [![Donate demo](https://user-images.githubusercontent.com/24557779/140633603-bc79de2d-741d-4dc2-8138-2615af53b0a3.png)](https://try.satsale.org/) <br />(Click for donation page demo)<br /> Initiates payment -----> | [![Store demo](https://user-images.githubusercontent.com/24557779/140633619-1110dc2f-62ac-4fc4-8c08-869cdec273b3.png)](https://store.btcpyment.com/) <br />(Click for WordPress store payments demo) | 10 11 - [Purpose](#purpose) 12 - [Features](#features) 13 - [Installation (short!)](#installation--short--) 14 - [Install](#install) 15 - [Connect to your Bitcoin Node](#connect-to-your-bitcoin-node) 16 - [Run SatSale](#run-satsale) 17 - [Embed a Donation Button](#embed-a-donation-button) 18 - [Using HTTPS & Domains](#using-https---domains) 19 - [Lightning Address](#lightning-address) 20 - [Security](#security) 21 - [Payment Gateway (Woocommerce)](#payment-gateway--woocommerce-) 22 - [Updating](#Updating) 23 - [Docs](#Docs) 24 - [Contributions welcomed](#contributions-welcomed) 25 - [Coming soon](#coming-soon) 26 - [Disclaimer](#disclaimer) 27 - [Support](#support) 28 29 ![logo](static/logo.svg) 30 31 # Purpose 32 33 SatSale currently serves as a 34 35 1. Donation page and button for your website that you can easily embed/link to anywhere. 36 2. Bitcoin payment gateway, including a Woocommerce plugin that easily turns any Wordpress site into a Bitcoin accepting store. 37 3. Versatile API and payments platform for both on-chain and lightning payments (supporting both clightning and lnd). 38 39 While other Bitcoin payment processors are known for being difficult to install and self-host, SatSale is easy to modify and build upon. 40 41 SatSale makes donation buttons simple - an easy copy and paste of the one line HTML iframe into your site. With a simple Python backend to talk to your own Bitcoin node, SatSale uses RPC to generate new addresses, and monitors the payment status with your own copy of the blockchain. 42 43 Our objective is to share the power of self-custody bitcoin payments with the world. 44 45 # Features 46 47 - Process payments with your own Bitcoin node via RPC and SSH using Bitcoin core, or any other node software that supports RPC calls. 48 - Direct peer-to-peer payments without any middleman. No KYC, and greater privacy than donation systems where Bitcoin addresses are reused multiple times. 49 - [Lightning Address](https://lightningaddress.com) support (e.g. me@mydomain.com) 50 - Supports both clightning and lnd, or you can just use on-chain! 51 - **Lightweight and highly extendable**, with basic html and css styling and a modular Python backend. Take a [look at the code](satsale.py) or [lnd.py](/node/lnd.py)! 52 - Reusable and extendable [API](https://satsale.org/docs.html). 53 - No shitcoins. Bitcoin only. 54 55 # Installation (short!) 56 57 You require a Bitcoin node; if you don't have one you should [install one](https://bitcoincore.org/en/download/) preferably on a [Raspberry Pi](https://github.com/kdmukai/raspi4_bitcoin_node_tutorial) / server (VPS). While you can run SatSale on the same machine, a separate VPS is recommended. 58 59 ### Install 60 61 Clone and install dependencies 62 63 ``` 64 git clone https://github.com/nickfarrow/SatSale 65 cd SatSale/ 66 pip3 install -r requirements.txt 67 ``` 68 69 ### Connect to your Bitcoin Node 70 71 Edit the `config.toml` configuration and point to your Bitcoin node: 72 73 ```toml 74 [bitcoind] 75 host = "127.0.0.1" 76 username = "bitcoinrpc" 77 password = "rpcpassword" 78 rpcport = "8332" 79 wallet = "" 80 ``` 81 82 (You can find these in `~/.bitcoin/bitcoin.conf`). 83 84 When connecting to a remote node, also edit either the SSH `tunnel_host` to a node like `"pi@IP"`, ensuring you have SSH keys in `~/.ssh/authorized_keys` and `ufw allow 8332` the appropriate ports to connect to your node. Or alternatively, see [tor hidden service](/docs/tor.md). 85 86 If you have a lightning node (lnd or clightning) and want to use lightning network payments, see [Lightning instructions](docs/lightning.md). More [example configs](docs/). 87 88 ### Run SatSale 89 90 Run SatSale with 91 92 ``` 93 gunicorn -w 1 -b 0.0.0.0:8000 satsale:app 94 ``` 95 96 Gunicorn is a lightweight python HTTP server. Alternatively, you can run using just `python satsale.py`, though this is not recommended for production. 97 98 That's it! You should now be able to view your SatSale server at `http://YOUR_SERVER_IP:8000/`. If running locally, this will be `127.0.0.1:8000`. 99 100 If running on a Raspberry Pi, you will want to [forward port 8000 in your router settings](https://user-images.githubusercontent.com/24557779/105681219-f0f5fd80-5f44-11eb-942d-b574367a161f.png) so that SatSale is also visible at your external IP address. You might have to allow gunicorn through your firewall with `sudo ufw allow 8000`. 101 102 You will want to run gunicorn with nohup so it continues serving in the background: 103 104 ``` 105 nohup gunicorn -w 1 0.0.0.0:8000 satsale:app > log.txt 2>&1 & 106 tail -f log.txt 107 ``` 108 109 ### Embed a Donation Button 110 111 Now embed the donation button into your website HTML: 112 113 ```html 114 <iframe 115 src="http://YOUR_SERVER_IP:8000/" 116 style="margin: 0 auto;display:block;width:420px;height:460px;border:none;overflow:hidden;" 117 scrolling="no" 118 ></iframe> 119 ``` 120 121 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. 122 123 ### Using HTTPS & Domains 124 125 Point a domain to your VPS. You can run SatSale or use NGINX/apache to point to the service. See [HTTPS instructions](docs/HTTPS.md). 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). 126 127 ### Lightning Address 128 129 Once you have an HTTPS domain pointed at SatSale, in the configuration under a lightning node you can specify a lightning address: 130 131 ``` 132 # Lightning Address e.g. name@you.satsale.domain (think this requires https url) 133 lightning_address = name@ur.domain.com 134 lightning_address_comment = "Thank you for your support <3" 135 ``` 136 137 ### Security 138 139 Run SatSale on a separate machine to your node, ensuring your node IP is not exposed. 140 When possible, host on a machine where your node only has access to a **watch-only** wallet. 141 Similarly, for lightning, use an `invoice.macaroon` not `admin.macaroon` unless required. 142 143 ### Payment Gateway (Woocommerce) 144 145 Currently we have a plugin for Woocommerce in Wordpress that makes Bitcoin webstores extremely easy, [please click here for installation instructions](docs/woocommerce.md). SatSale acts as a custom payment gateway for Woocommerce via the php plugin found in `/gateways`. We have plans to extend to other web stores in the future. 146 147 # Updating 148 149 When updating we recommend to first backup your config: 150 151 ``` 152 cp config.toml bk_config.toml 153 154 # (previously) 155 cp config.py bk_config.py 156 ``` 157 158 then stash your changes: 159 160 ``` 161 git stash 162 git pull origin master 163 git stash pop 164 ``` 165 166 We're still in early development, so things are changing a lot. You may have to resolve changes or manually migrate to the `.toml` (if you used an earlier version of SatSale with the `.py` config). 167 168 You can also just make commits to your modified fork. 169 170 # Docs 171 172 - Basic [API docs](https://satsale.org/docs.html) 173 - Example [configs, Tor, HTTPS, nginx, etc](docs/) 174 175 # Contributions welcomed 176 177 ### You only need a little python! 178 179 The main code can be found in [satsale.py](satsale.py). The client-side logic for initiating the payment and querying the API sits in [static/satsale.js](static/satsale.js), button appearance in [templates/index.html](templates/index.html), and Woocommerce plugin in [gateways/woo_satsale.php](gateways/woo_satsale.php). Please have ago at implementing some of the things below or in the issues! 180 181 ![docs/diagram.png](docs/diagram.png) 182 183 # Coming soon 184 185 - **Better UI** with more variety of size and theme. 186 - Currency toggle between BTC/USD on donation html. 187 - Late payment recourse. 188 - A more readily customisable donation button (text/color/QR code) 189 - Different price feeds with various currencies 190 191 # Disclaimer 192 193 SatSale is in early development. As such, we are not responsible for any loss of funds, vulnerabilities with software, or any other grievances which may arise. Always confirm large payments manually and use cold storage as much as possible. 194 195 # Support 196 197 Please consider [supporting me](https://btcpyment.nickfarrow.com) via my own instance of SatSale :). This is my first FOSS project, any support would greatly assist my ability to prioritise SatSale and other areas of Bitcoin. And most importantly, **help us bring non-custodial bitcoin payments to the world**. Please email `baseddepartment@nickfarrow.com`.