News:

Are you new to Groestlcoin and have questions you are afraid to ask?
Check out the New Users board and post there.
Welcome to all newcomers.

Main Menu

How to setup Groestlcoin Esplora for testnet

Started by jackielove4u, March 23, 2020, 12:26:39 PM

Previous topic - Next topic

jackielove4u

The following were tested in Ubuntu 16.04 and Ubuntu 18.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 libsqlite3-dev python python3 net-tools zlib1g-dev gettext jq -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=863
      daemon=1
      txindex=1
      blockfilterindex=1
      coinstatsindex=1
      rpcuser=yourusernamehere
      rpcpassword=yourpasswordhere
      whitelist=127.0.0.1
    • Crtl+o enter, ctrl X
    • groestlcoind -testnet
    • Let it sync (can take up to 2 hours), verify with groestlcoin-cli -testnet -getinfo
    • curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    • sudo apt install clang cmake -y
    • apt install cargo -y
    • git clone https://github.com/Groestlcoin/electrs/
    • cd electrs
    • git checkout blockstream
    • cargo build --release
    • screen
    • cargo run --release --bin electrs -- -vvvv --timestamp --jsonrpc-import --electrum-rpc-addr="127.0.0.1:51001" --cookie="yourusernamehere:yourpasswordhere" --cors '*' --network testnet
    • Crtl+A, ctrl+D
    • cd ..
    • curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
    • sudo apt-get install -y nodejs
    • git clone https://github.com/Groestlcoin/esplora && cd esplora
    • npm install --unsafe-perm
    • npm run postinstall
    • SITE_TITLE='Groestlcoin Testnet Esplora' HOME_TITLE='Groestlcoin Testnet Esplora' NATIVE_ASSET_LABEL=tGRS MENU_ACTIVE='Groestlcoin Testnet' CUSTOM_ASSETS="$CUSTOM_ASSETS flavors/bitcoin-testnet/www/*" CUSTOM_CSS="$CUSTOM_CSS flavors/bitcoin-testnet/extras.css" NAVBAR_HTML=1 MENU_ITEMS='{ "Groestlcoin": "https://esplora.groestlcoin.org/", "Groestlcoin Testnet": "https://esplora-test.groestlcoin.org/", "Groestlcoin Signet": "https://esplora-signet.groestlcoin.org/"}' NOSCRIPT_REDIR=1 CORS_ALLOW=* API_URL=https://esplora-test.groestlcoin.org/api/ DEST=/var/www/html npm run dist
    • screen
    • SITE_TITLE='Groestlcoin Testnet Esplora' HOME_TITLE='Groestlcoin Testnet Esplora' NATIVE_ASSET_LABEL=tGRS MENU_ACTIVE='Groestlcoin Testnet' CUSTOM_ASSETS="$CUSTOM_ASSETS flavors/bitcoin-testnet/www/*" CUSTOM_CSS="$CUSTOM_CSS flavors/bitcoin-testnet/extras.css" NAVBAR_HTML=1 MENU_ITEMS='{ "Groestlcoin": "https://esplora.groestlcoin.org/", "Groestlcoin Testnet": "https://esplora-test.groestlcoin.org/", "Groestlcoin Signet": "https://esplora-signet.groestlcoin.org/"}' BASE_HREF=/nojs/ STATIC_ROOT=/ API_URL=http://127.0.0.1:3001/ npm run prerender-server
    • Crtl+A, ctrl+D
    • apt-get install nginx
    • nano /etc/nginx/sites-available/default
    • delete all and paste:
      upstream backend {
          server 127.0.0.1:3001;
          keepalive 300;
      }

      upstream prerenderer {
          server 127.0.0.1:5001;
          keepalive 300;
      }

      server {
          listen 80;
          server_name esplora-test.groestlcoin.org;
          keepalive_requests 100000;
          gzip on;
          gzip_types application/json text/plain application/xml application/javascript;
          gzip_proxied any;
          sendfile on;
          tcp_nopush on;
          tcp_nodelay on;
          keepalive_timeout 15;
          access_log off;
          root /var/www/html;
          server_tokens off;
          add_header X-Frame-Options SAMEORIGIN always;
          add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; object-src 'none'" always;
          add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
          add_header X-XSS-Protection "1; mode=block" always;
          add_header X-Content-Type-Options "nosniff" always;
          add_header Referrer-Policy "no-referrer" always;

          location /api/ {
              proxy_pass http://backend/;
              proxy_set_header Access-Control-Allow-Origin '*';
          }
          location /nojs/ {
              proxy_pass http://prerenderer/;
          }
          location = /nojs {
              return 301 " /nojs/";
          }
          location  ~ ^/((tx|block|block-height|address|assets?)/|[a-zA-Z0-9]+$) {
              expires 60m;
              if ($args = "nojs") {
              return 301 " /nojs$uri";
              }
              try_files $uri /index.html;
          }
          location = /"unused" {
              return 301 " /";
          }
          error_page 404 /notfound.html;
          location = /notfound.html {
              internal;
          }
      }
    • service nginx restart
    • sudo add-apt-repository ppa:certbot/certbot
    • sudo apt-get update
    • sudo apt-get install certbot python-certbot-nginx -y
    • certbot --nginx -d esplora-test.groestlcoin.org
    • crontab -e
    • Add end of file:
      15 3 * * * /usr/bin/certbot renew --quiet --nginx
    • Crtl+o enter, ctrl X