BitGo Express Node

This guide is designed to guide your through the installation of BitGo Express node.

BitGo Express is designed and written by BitGo for their BitGo website wallet.

IMPORTANT: you will be exposing your BitGo wallet's private keys on this server. This is a substantial security risk. Your funds will be exposed without adequate safeguards. If you proceed, you are doing so at your own risk.

BitGo holds and secures your cryptocurrency keys.

BitGo Wallet is a hot wallet option in the Crypto Application Server (CAS).

BitGo Express is used to interface with BitGo. CAS does not interact with BitGo directly. 


This article presumes you have a bare installation of Ubuntu 16.04 LTS running on a VPS with a publicly exposed IP.

1. Install Node.js and NPM.

BitGo Express relies upon Node.js to function.

Update your Ubuntu installation, install Node.js (and NPM):

1 2 3 sudo apt update && sudo apt install curl curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt install -y nodejs

Test your installation by typing:

  • 1 2 nodejs -v npm -v
  • You should receive version numbers if everything is installed OK.

  • Node.js version 10 is supported until April 2021

More info: 


2. Install Bitgo Express:

Clone the source code, and navigate to the program executable:

1 2 git clone -b bitgo@9.0.0 https://github.com/bitgo/bitgojs cd ~/bitgojs/modules/express

Initialize the NPM installer:

1 2 npm config set production false npm install

Build the BitGo Express package:

1 npm ci
  • If installing as the root user, then use this line instead:

1 npm ci --unsafe-perm

Test the installation:

1 npm run start
  • This is an example of a successful start:

    • Press Ctrl-C to exit Bitgo Express.

  • If you aren't successful, carefully review your steps, and then finally - open a support ticket to notify us that the BitGo software and/or node.js software is no longer functioning as expected. 

    • We will investigate - but ultimately we have no control or influence over their software.


3. Start BitGo Express:

  • In this example, we'll use the default port 3080 on localhost.

First, change the Node.js working environment to "production":

1 npm config set production true

Now, verify that BitGo Express still works in production mode:

1 2 cd ~/bitgojs/modules/express npm run start -- --env prod
  • If already configured (from below), then you will see messages from the interaction of CAS and the BitGo Express node as they occur.

BitGo Express MUST be running at all times to be available as a Hot Wallet for CAS.

Configure BitGo Express to run continuously:

Use the "&" command suffix to run the program in the background:

1 npm run start -- --env prod &
  • This is an example of BitGo Express being successfully started in the background:

  • Unless you installed BitGo Express as root, the program will self-terminate when you close the terminal window. To prevent BitGo Express from terminating this way, install nohup (if necessary) and start it as so:

    • 1 nohup npm run start -- --env prod &
  • See: "Running BitGo Express as a service" (at the bottom) for yet another option.


Instructions for terminating BitGo when running as a background process:

If BitGo Express is running in the background, and you wish to shut it down - do so by locating it's process ID (PID) and "killing" the PID:

1 pgrep node
  • returns a <PID>

1 kill <PID>
  • terminates BitGo Express

Example:

  • If you see more than a single PID listed, do NOT kill any of them unless you know exactly what you're killing. The best suggestion in this case is to just restart your server.


4. Install the GB Tunnel (if used) now.

Click this link to open instructions.

Requires CAS version 20200323 or newer.

Required when using the GB Cloud as your CAS server.


5. Create a new Crypto Setting for use with this node.


RUNNING BITGO EXPRESS AS A SERVICE (optional)

BitGo Express can be run as an unattended service.  This requires a little tinkering after BitGo Express has been successfully installed & tested. Installing it as a service enables the node to function after restarts or reboots.

  • Please consult a professional if you're uncomfortable with any aspect of this.

  • This procedure assumes all default settings have been implemented.

Modify the Bitgo Express Javascript file:

1 nano $HOME/bitgojs/modules/express/bin/bitgo-express

Add the following 2 lines of text (in red) at this precise location:

1 2 3 4 5 #!/usr/bin/env node const { init } = require('../dist/src/expressApp'); process.env.BITGO_ENV = 'prod'; process.env.NODE_ENV = 'production';
  • Do not delete anything! The remainder of the file has been omitted for brevity.

  • Save the file (Ctrl-X)

Create a service file:

1 nano $HOME/bitgojs/modules/express/bin/bitgo-express.service

Add this text to the new service file:

1 2 3 4 5 6 7 8 9 10 11 12 13 [Unit] Description=Bitgo Express 9.0.0 [Service] ExecStart=/usr/bin/node "$HOME/bitgojs/modules/express/bin/bitgo-express" Restart=always User=your-user-name Group=your-group-name Environment="PATH=/usr/bin:/usr/local/bin" WorkingDirectory=$HOME/bitgojs/modules/express/bin [Install] WantedBy=multi-user.target
  • REPLACE $HOME with your actual home directory.      

    • Use "echo $HOME" to quickly see this value.

  • REPLACE "your-user-name" with your actual username.

  • REPLACE "your-group-name" with your actual group name          

    • usually the group name is the same as your username.

  • Save it when finished (Ctrl-X).

Now install the service, enable and test it:

Shutdown BitGo Express before proceeding.

1 2 3 4 sudo cp $HOME/bitgojs/modules/express/bin/bitgo-express.service /lib/systemd/system/bitgo-express.service sudo systemctl enable bitgo-express sudo systemctl start bitgo-express sudo systemctl status bitgo-express

BitGo Express should now work as a normal Ubuntu service: