How To Deploy a Glitch Node

This guidance includes how to deploy, run and make RPC calls.

Get Glitch Node

There are at least 4 ways to get a Glitch node, you can choose any way:

  1. Download the binaries

    The easiest way to get glitchd, download the latest binaries on the Glitch website. Currently it supports Linux, Window, OSX.

    (Note: the version number you see might be different, here is v0.1.1, but other key words except for version are the same.)

    • For Mac user:Glitch-0.1.1-osx64.tar.gz
    • For Linux users: Glitch-0.1.1-i686-pc-linux-gnu.tar.gz(32bit) or Glitch-0.1.1-x86_64-linux-gnu.tar.gz(64bit)
    • For Windows users:Glitch-0.1.1-win32.zip(32bit) or Glitch-0.1.1-win64.zip(64bit)
  2. Decompress after downloading, then you will get glitchd and glitch-cli under the path <your path>/bin.

  3. apt install for Linux users

    Please refer to “Download URL” Current support Ubuntu,Debian and Mint.

    After installation, you should be able to run glitchdand glitch-clidirectly in the terminal

  4. Compiler from source code
  5. If you want to compile Glitch from source code, please clone the latest code from github : https://github URL

    sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev libgmp3-dev
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:bitcoin/bitcoin
    sudo apt-get update
    sudo apt-get install libdb4.8-dev libdb4.8++-dev

# If you want to build the Qt GUI:

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler qrencode

# Note autogen will prompt to install some more dependencies if needed

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler qrencode

Currently we recommand to compile on Linux or OSX, while other platforms might need more configuration.

After compilation, you also get glitchd and glitch-cli under the path <your path>/src/

Deploy Glitch Node

Deployment methods for node setup is almost same for all OS, here we take Ubuntu as an example. The commands in Mac and windows are exactly the same.

Run Glitch fullnode with ./glitchd:

./glitchd -daemon

Above command will launch a glitchd daemon.

More options can be found:List to configure glitch node

./glitchd -help

To stop running:

./glitch-cli stop

The default data path for different platforms:

  • Linux:~/.Glitch/
  • Mac OSX:~/Library/Application Support/Glitch
  • Windows:%APPDATA%\Glitch

If you want to save custom folder for save chain use -datadir to set your own data path

After start of glitchd, Glitch node will sync all blocks from 0 to till, and saves to datadir. It might take some time. Then log for the node can be found under the data path ~/.Glitch/debug.log.

Local RPC call

When the Glitch node is running, we can use Glitch command line interface glitch-cli to interact with glitchd, and make local RPC calls.

eg:

[email protected]:~/Glitch-0.14.3/bin$ ./glitch-cli getinfo
{
"version": 010000,
"protocolversion": 70016,
"walletversion": 100000,
"balance": 0.00000000,
"stake": 0.00000000,
"blocks": 121,
"timeoffset": 0,
"connections": 8,
"proxy": "",
"difficulty": {
"proof-of-work": 1.52587890e-05,
"proof-of-stake": 8817.5868738915
},
"testnet": false,
"moneysupply": 100020104,
"keypoololdest": 1505006997,
"keypoolsize": 100,
"paytxfee": 0.00000000,
"relayfee": 0.00400000,
"errors": ""
}


To get all RPC command list:

./glitch-cli help

To get help for specific RPC command, use ./glitch-cli help <RPCcmd<,

eg

./glitch-cli help getinfo

JsonRPC Settings

You can get the jsonrpc example by using (here we use getinfo as an example): ./glitch-cli help getinfo

Example :

> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;'

http://127.0.0.1:4002/

The example shows detailed format for jsonrpc content. However, it can only be called after setting rpcuser and rpcpassword.

There are two ways to set the parameters, you can choose either.

Method 1:Create config file ~/.Glitch/Glitch.conf,which should include:

rpcuser=test #rpc user name, (necessary)

rpcpassword=test1234 #rpc password, (necessary)


# By default, only local jsonrpc is allowed

# Remote connection is allowed only when setting rpcallowip as following:

# both ipv4 and ipv6 can be set, e.g.:

#rpcallowip=192.168.99.51/255.255.255.0
#rpcallowip=1.2.3.4/24
#rpcallowip=2001:db8:85a3:0:0:8a12:370:7364/96


After creating the config file, please restart the node to finish settings.

Methode 2 : Restart Glitch node with following options:

./glitchd -daemon -rpcuser=test -rpcpassword=test1234 -rpcallowip=192.168.77.51/255.255.255.0

The meaning of options rpcuser, rpcpassword and rpcallowip are all the same with the config file above.

RPC call example

You can make remote RPC calls after the settings above. Here is an example: Suppose the Glitch node is running on an Ubuntu machine, whose ip is 192.168.56.180, default port=4002. Now we try to make jsonrpc call in a remote macbook:

$ curl --user test:test1234 --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;'

http://192.168.56.180:4002/

{"result":{ "version":100000,"protocolversion":70016,"walletversion":100000,"balance":0.00000000,"stake":0.00000000,"blocks":12197,"timeoffset":0,"connections":8,"proxy":"","difficulty":{"proof-of-work":1.52587890e-05,"proof-of-stake":650787.7561123729},"testnet":false,"moneysupply":100021788,"keypoololdest":1505186997,"keypoolsize":100,"paytxfee":0.00000000,"relayfee":0.00400000,"errors":""},"error":null,"id":"curltest"}

The result is identical with local call.

You can also use tools like postman to get the same result:

Useful commands and documents

If you have any questions during node deployment and RPC calls, here are some useful documents to refer to:

  • Command to check all glitchd options:./glitchd -help
  • Command to get all RPC list: ./glitch-cli help
  • Get RPC help(like getinfo): ./glitch-cli help getinfo