Skip to content

Latest commit

 

History

History
75 lines (63 loc) · 2.57 KB

README.md

File metadata and controls

75 lines (63 loc) · 2.57 KB

Build Status License: MIT

giant-cli-integration-demo

Overview

Spring Boot application wich integrates with Giant-cli tool v1.2.2.1 and every 5 minutes reloads page and shows actual values for last block number in blockchain and its complexity

Available API:

  1. giant-cli getblockcount - last block number
  2. giant-cli getblockhash :height - block hash by number
  3. giant-cli getblock :hash - get block info by hash

Preparations for running Giant client and daemon

Install dependencies (if not found)

$ mkdir -p ~/tmp/boost
$ wget http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz -P ~/tmp/boost
$ cd ~/tmp/boost
$ tar -xf boost_1_58_0.tar.gz; cd boost_1_58_0
$ ./bootstrap.sh --with-python-version=2.7 
$ sudo ./b2 install 
$ rm -rf ~/tmp 
$ # update shared libraries configuration
$ sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/giant.conf # boost-libs
$ sudo ldconfig
  • miniupnpc 1.0
$ sudo ln -s /usr/lib/libminiupnpc.so.17 /usr/lib/libminiupnpc.so.10

Other dependecies may be installed from official repo or downgraded

Setup credentials

$ mkdir ~/.giant -p
$ echo -e "rpcuser=user\nrpcpassword=password" > ~/.giant/giant.conf

Run Giant client and daemon

$ wget https://github.com/GiantPay/GiantCore/releases/download/1.2.2.1/giant-1.2.2.1-linux64.zip -P /tmp
$ cd /tmp; unzip giant-1.2.2.1-linux64.zip -d giant-1.2.2.1-linux64; cd giant-1.2.2.1-linux64
$ # test all dependencies provided
$ ./giantd -testnet & 2>/dev/null # daemon
$ ./giant-cli                     # client
$ # test all works good - retrieve last block number and complexity in blockchain
$ ./giant-cli -testnet getblock  \
        $(./giant-cli -testnet  getblockhash \
        $(./giant-cli -testnet  getblockcount)) \
        |  jq '. | {number: .height, complexity: .difficulty}'
{
  "number": 0,
  "complexity": 0.00024414
}  

Run integration demo

$ git -C /tmp clone https://github.com/gzheyts/giant-cli-integration-demo
$ mvn -f /tmp/giant-cli-integration-demo/pom.xml clean test spring-boot:run 

Then navigate to localhost:8080

Copyright and license

The code is released under the MIT license