News:

Forum Rules can be found here

Main Menu

How to setup GRSPay

Started by jackielove4u, June 24, 2018, 04:50:54 PM

Previous topic - Next topic

jackielove4u

The following were tested in Ubuntu 14.04 and Ubuntu 16.04, some dependencies can be different in other distros.
    • aptitude update -y && aptitude upgrade -y && apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y
    • dd if=/dev/zero of=/swapfile bs=1M count=4096
    • mkswap /swapfile
    • swapon /swapfile
    • echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
    • sudo apt-get install build-essential libssl-dev libboost-all-dev libdb5.3 libdb5.3-dev libdb5.3++-dev libtool automake libevent-dev bsdmainutils -y
    • sudo apt-get install git ntp make g++ gcc autoconf cpp ngrep iftop sysstat autotools-dev pkg-config libminiupnpc-dev libzmq3-dev -y
    • sudo apt-get install libgmp-dev postgresql-contrib python python3 net-tools zlib1g-dev gettext -y
    • git clone https://github.com/groestlcoin/groestlcoin
    • cd groestlcoin
    • ./autogen.sh
    • ./configure
    • make
    • strip src/groestlcoind src/groestlcoin-cli src/groestlcoin-tx src/groestlcoin-wallet src/groestlcoin-util
    • sudo mv src/groestlcoind src/groestlcoin-cli src/groestlcoin-tx src/groestlcoin-wallet src/groestlcoin-util /usr/bin
    • mkdir ~/.groestlcoin
    • nano ~/.groestlcoin/groestlcoin.conf
    • write:
      listen=1
      server=1
      maxconnections=865
      daemon=1
      txindex=1
      blockfilterindex=1
      coinstatsindex=1
      rpcuser=yourusernamehere
      rpcpassword=yourpasswordhere
      whitelist=127.0.0.1
    • Crtl+o enter, ctrl X
    • groestlcoind
    • Let it sync (can take up to 2 hours), verify with groestlcoin-cli -getinfo
    • wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    • RELEASE=$(lsb_release -cs)
    • echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list
    • sudo apt update
    • sudo apt -y install postgresql-14
    • sudo -u postgres psql
    • CREATE DATABASE grspay TEMPLATE 'template0' LC_CTYPE 'C' LC_COLLATE 'C' ENCODING 'UTF8';
    • CREATE USER grspay WITH ENCRYPTED PASSWORD 'yourpasswordhere';
    • GRANT ALL PRIVILEGES ON DATABASE grspay TO grspay;
    • CREATE DATABASE nbxplorer TEMPLATE 'template0' LC_CTYPE 'C' LC_COLLATE 'C' ENCODING 'UTF8';
    • CREATE USER nbxplorer WITH ENCRYPTED PASSWORD 'yourpasswordhere';
    • GRANT ALL PRIVILEGES ON DATABASE nbxplorer TO nbxplorer;
    • \q
    • wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    • sudo dpkg -i packages-microsoft-prod.deb
    • rm packages-microsoft-prod.deb
    • sudo apt-get install apt-transport-https python3-pyasn1 -y
    • sudo apt-get update
    • sudo apt-get install dotnet-sdk-8.0 -y
    • cd\
    • git clone https://github.com/Groestlcoin/lightning.git
    • cd lightning
    • ./configure
    • make
    • strip lightningd/lightningd cli/lightning-cli
    • mkdir ~/.lightning
    • nano ~/.lightning/config
    • write:
      alias=Groestlcoin
      network=groestlcoin
      bitcoin-rpcuser=yourusernamehere
      bitcoin-rpcpassword=yourpasswordhere
      bitcoin-rpcconnect=127.0.0.1
      bitcoin-rpcport=1441
      bind-addr=
      announce-addr=YOURIPADDRESS:9735
    • Crtl+o enter, ctrl X
    • screen -S lightning
    • ./lightningd/lightningd
    • Crtl+A, ctrl+D
    • cd\
    • git clone https://github.com/dgarage/NBXplorer
    • cd NBXplorer
    • ./build.sh
    • screen -S nbxplorer
    • ./run.sh --chains=grs --grsrpcuser yourusernamehere --grsrpcpassword yourpasswordhere --postgres="UserID=nbxplorer;Password=yourpasswordhere;Host=localhost;Port=5432;Database=nbxplorer"
    • Crtl+A, ctrl+D
    • git clone https://github.com/Groestlcoin/groestlcoin-spark
    • cd groestlcoin-spark
    • curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    • sudo apt-get install -y nodejs
    • npm install
    • npm run dist:npm --unsafe-perm
    • screen -S Spark
    • ./dist/cli.js --cookie-file ~/groestlcoin-spark/config --ln-path ~/.lightning/groestlcoin
    • Crtl+A, ctrl+D
    • git clone https://github.com/Groestlcoin/groestlcoin-lightning-charge
    • cd groestlcoin-lightning-charge
    • npm install
    • screen -S LightningCharge
    • npm start -- --cookie-file ~/groestlcoin-lightning-charge/config --ln-path ~/.lightning/groestlcoin
    • Crtl+A, ctrl+D
    • git clone https://github.com/Groestlcoin/btcpayserver
    • cd btcpayserver
    • ./build.sh
    • screen -S GRSPay
    • ./run.sh --explorerpostgres="UserID=nbxplorer;Password=yourpasswordhere;Host=localhost;Port=5432;Database=nbxplorer" --postgres="UserID=grspay;Password=yourpasswordhere;Host=localhost;Port=5432;Database=grspay" --chains=grs --btclightning="type=clightning;server=unix://root/.lightning/lightning-rpc" --btcexternalspark="server=https://grspay.com/spark/grs/;cookiefile=/root/groestlcoin-spark/config" --btcexternalcharge="server=https://grspay.com/groestlcoin-lightning-charge/grs/;cookiefilepath=/root/groestlcoin-lightning-charge/config"
    • Crtl+A, ctrl+D
    • sudo apt-get install nginx
    • nano /etc/nginx/sites-available/default
    • delete all and paste:
      # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
      # scheme used to connect to this server
      map $http_x_forwarded_proto $proxy_x_forwarded_proto {
        default $http_x_forwarded_proto;
        ''      $scheme;
      }
      # If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
      # server port the client connected to
      map $http_x_forwarded_port $proxy_x_forwarded_port {
        default $http_x_forwarded_port;
        ''      $server_port;
      }
      # If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
      # Connection header that may have been passed to this server
      map $http_upgrade $proxy_connection {
        default upgrade;
        '' close;
      }
      # Apply fix for very long server names
      server_names_hash_bucket_size 128;
      # Prevent Nginx Information Disclosure
      server_tokens off;
      # Default dhparam
      # Set appropriate X-Forwarded-Ssl header
      map $scheme $proxy_x_forwarded_ssl {
        default off;
        https on;
      }
      gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
      log_format vhost '$host $remote_addr - $remote_user [$time_local] '
                       '"$request" $status $body_bytes_sent '
                       '"$http_referer" "$http_user_agent"';
      access_log off;
      server {

          server_name grspay.com;

          location / {
              proxy_pass http://localhost:23000;
              # HTTP 1.1 support
              proxy_http_version 1.1;
              proxy_buffering off;
              proxy_set_header Host $http_host;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection $proxy_connection;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
              proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
              proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;

          }

          location /spark/grs/ {
              proxy_pass http://localhost:9737/;
          }

          location /groestlcoin-lightning-charge/grs/ {
              proxy_pass http://localhost:9112/;
          }
      }
      # Mitigate httpoxy attack (see README for details)
      proxy_set_header Proxy "";
      server {
              server_name _; # This is just an invalid value which will never trigger on a real hostname.
              listen 80;
              access_log /var/log/nginx/access.log vhost;
              return 503;
      }
    • service nginx restart
    • sudo add-apt-repository ppa:certbot/certbot
    • sudo apt-get update
    • sudo apt-get install python-certbot-nginx
    • sudo certbot --nginx -d grspay.com
    • crontab -e
    • Add end of file:
      15 3 * * * /usr/bin/certbot renew --quiet
    • Crtl+o enter, ctrl X