forked from Electron-Cash/Electron-Cash
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SLP] Added contrib for setting up a proxy SLP validation service
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# SLP Token Validation Proxy Server | ||
|
||
Electron-Cash-SLP can be run in daemon mode to serve token validation requests using JSON RPC interface. The following instructions explain how to set this up using an Ubuntu server with nginx reverse proxy server. | ||
|
||
## Initial Server Config Steps | ||
|
||
1) Setup an Ubuntu server | ||
|
||
2) Clone this project into your home directory (i.e. `~/`) & cd into the `Electron-Cash-SLP` directory. | ||
|
||
3) Run the proper Electron Cash installation commands as described in the readme for this project. | ||
|
||
4) Run `./elctron-cash create` to create a new wallet file. This wallet shouldn't be used to store any funds, it is only used to store SLP validation data for cache purposes. | ||
|
||
## Creating a persistent service with systemd | ||
|
||
1) Copy the file named `slpvalidate.service` into `/lib/systemd/system/` directory. Make sure the paths within the `slpvalidate.serice` file match the location of your Electron-Cash-SLP directory. | ||
|
||
2) Run `sudo systemctl start slpvalidate` | ||
|
||
3) Check that the service is running via `sudo systemctl status slpvalidate` | ||
|
||
## Setting up the reverse proxy server for this validation service. | ||
|
||
1) Setup an nginx server per these instructions: https://linuxize.com/post/how-to-install-nginx-on-ubuntu-18-04/ | ||
|
||
2) Do an initial Setup for SSL via "Let's Enctypy" using these instructions but for your desired domain: https://linuxize.com/post/secure-nginx-with-let-s-encrypt-on-ubuntu-18-04/ | ||
|
||
3) Use the Nginx Server block file named `simpleledger.info`. Update the contents of the file to reflect your specific domain / sub-domain. Rename the file to reflect your specific domain / sub-domain. Then copy this file into your `/etc/nginx/sites-available/` directory. | ||
|
||
4) Run `sudo ln -s /etc/nginx/sites-available/<your-domain> /etc/nginx/sites-enabled/` | ||
|
||
5) Check that the syntax is all good: `sudo nginx -t` | ||
|
||
6) Restart Nginx: `sudo systemctl restart nginx` | ||
|
||
7) Test that the service is working via: `curl --data-binary '{"jsonrpc": "2.0", "id":"testing", "method": "slpvalidate", "params": ["2504b5b6a6ec42b040a71abce1acd71592f7e2a3e33ffa9c415f91a6b76deb45", false, false] }' -H 'content-type: text/plain;' https://validate.simpleledger.info`. Replace `validate.simpleledger.info` with your own domain. | ||
|
||
## Other notes | ||
|
||
You can speed up your SLP validation server by also installing ElectrumX side-by-side and connecting to it directly. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
|
||
server_name validate.simpleledger.info; | ||
|
||
include snippets/letsencrypt.conf; | ||
return 301 https://$host$request_uri; | ||
} | ||
|
||
log_format my_tracking $request_body; | ||
|
||
server { | ||
listen 443 ssl http2; | ||
server_name validate.simpleledger.info; | ||
|
||
ssl_certificate /etc/letsencrypt/live/validate.simpleledger.info/fullchain.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/validate.simpleledger.info/privkey.pem; | ||
ssl_trusted_certificate /etc/letsencrypt/live/validate.simpleledger.info/chain.pem; | ||
include snippets/ssl.conf; | ||
include snippets/letsencrypt.conf; | ||
|
||
location / { | ||
if ($request_method != POST) { | ||
return 405; | ||
} | ||
|
||
proxy_pass http://127.0.0.1:5111; | ||
|
||
add_header X-Frame-Options ""; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
|
||
access_log /var/log/nginx/simpleledger.info.access.log my_tracking; | ||
error_log /var/log/nginx/simpleledger.info.error.log; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=SLP Token Validation Service | ||
After=network.target | ||
|
||
[Service] | ||
User=ubuntu | ||
ExecStartPre=/bin/sleep 2.0 | ||
ExecStart=/home/ubuntu/Electron-Cash-SLP/electron-cash daemon -v | ||
ExecStartPost=/bin/sleep 2.0 | ||
ExecStartPost=/home/ubuntu/Electron-Cash-SLP/electron-cash daemon load_wallet | ||
|
||
[Install] | ||
WantedBy=multi-user.target |