Running your own Insight explorer

From DigiByte Wiki
Jump to navigation Jump to search

Here are some quick and dirty instructions on how to run your own Insight explorer, similar to and now including support for DigiAssets

This is useful if you want the API's to be able to access for integrating external products in to the blockchain.

If you want to run this within a Docker container, you can start here instead.


System requirements

You will need a Linux server with at least 4GB of RAM (6GB preferred) and a 50GB HDD (as of early 2019).

You obviously need to be mildly familiar with the command line and setting these things up.

While this will work on CentOS etc, this presumes a Debian / Ubuntu server


Getting started

Start with the following as root

apt-get install python curl build-essential screen git nginx software-properties-common

This will give you some basic tools needed including Python-2.7

Installing certbot for ssl

We are going to install the basics now for certbot so you will be running a free SSL certificate

add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install certbot python-certbot-nginx
certbot --nginx

Follow the Certbot instructions for your domain.


User account preparation

If you don't already have one, create a DigiByte user for this to be run as:

useradd digibyte -m -s /bin/bash
su - digibyte

Now that you are the DigiByte user, you'll want to run the following to setup some environment variables:

cat <<EOF >> ~/.profile
export INSIGHT_NETWORK='livenet'
export BITCOIND_DATADIR=~/.digibyte/
export BITCOIND_USER=user
export BITCOIND_PASS=pass

This allows the Insight service to run on mainnet (It presumes testnet otherwise), with the right directory etc

These changes won't take effect right away,that's fine

curl -o- | bash

After you've run this, run the following to load the variables we set for Insight earlier.

source ~/.profile



DigiByte Core

Before we download DigiByte Core, you're going to want to run the following to setup your digibyte.conf: 

mkdir -vp ~/.digibyte

cat <<EOF > ~/.digibyte/digibyte.conf

We do this first and foremost because we want to ensure that DigiByte gets started up with the right settings first time around. We want the rpcuser/pass to match what we had earlier

Get the latest DigiByte Core from GitHub, 7.17.2 at the time of writing:

tar xvzf digibyte-7.17.2-x86_64-linux-gnu.tar.gz

This should start the DigiByte Core wallet in the background, you can check the progress by running:

tail -f ~/.digibyte/debug.log

You can stop looking at the logs with Ctrl + C, and it won't stop the DigiByte Core service.

Allow DigiByte to fully sync up, it may take a couple of hours depending on your CPU / connection etc



Insight installation

Now we install a specific version of node, as this is the last supported LTS version in that generation:

nvm install v10.17.0

Now we grab the Insight server:

git clone && cd insight

Now that we have it downloaded, we want to install the other prerequisites:

npm install

Then we're going to sync insight with DigiByte Core. This should sync using the .blk files to begin with and then change to using RPC later


This process will likely take 4-5 hours, depending on your CPU etc (As of November 2019)

Once completed, you should still be in ~/insight, and so can simply re-run the same command as previous to restart in RPC mode

npm start

You may also want to run this inside a screen session, or use pm2 to monitor it.

As soon as you've run this you can load up http://server.ip:3000 (Or 3001 if you're using testnet) and should be greeted with your Insight server. You can follow along at http://server.ip:3000/status and see the sync progress


Finishing the nginx reverse-proxy

So we're installed and running, but we don't want to keep having to use Port 3000. You also likely want to be using HTTPS, so we'll setup nginx to handle the rest. Time to edit your nginx config:

nano -w /etc/nginx/sites-enabled/default

Under the Default Server configuration you'll see server_name, set this to be your URL, such as:


You also want to add:

        location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

If you already have a "location /" then you can comment it out with a # at the start of the line.

Also, be sure to comment out:

#try_files $uri $uri/ =404;

If it's still in there and uncommented.

Once saved you can then run:

/etc/init.d/nginx restart

This will restart your nginx server and you should be able to browse to https://server/ and have it display your Insight explorer

You can also test the API's by browsing to: https://server/api/addr/DD2GiYVo3uL7SBmg5jtXDxfYZhdzGt3kRx?noTxList=1

For reference it should look like: