Запускаем IQUIDUS

Запускаем IQUIDUS

В основнов всё тоже самое, что и в этих гайдах:
https://www.reddit.com/r/BiblePay/comments/7elm7r/iquidus_block_explorer_guide/
https://gist.github.com/zeronug/5c66207c426a1d4d5c73cc872255c572
https://github.com/iquidus/explorer1. Устанавливаем TTChttps://ss-iqrw.blogspot.ru/2018/01/ttc-08-ubuntu.html
(не забываем про безопасность – везде используем свои пароли)2. Устанавливаем MongoDBhttps://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5


echo “deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list


sudo apt-get update


sudo apt-get install -y mongodb-org


sudo service mongod start

2. Создаём базу данных MongoDB

mongo

use explorerdb

db.createUser( { user: “TTC”, pwd: “RWcq7y*3*Xq!H^8”, roles: [ “readWrite” ] } )

exit

3. Устанавливаем Node.js

sudo apt-get update

sudo apt-get install nodejs nodejs-legacy -y

sudo apt-get install npm

4. Клонируем блокэксплорер IQUIDUS в Домашнюю папку (Home)

git clone https://github.com/iquidus/explorer explorer

cd explorer && npm install –production

cp ./settings.json.template ./settings.json

Если появятся такие ошибки – https://github.com/nodejs/node-gyp/issues/809
sudo apt-get install libkrb5-dev

5. Редактируем конфигурационный файл settings.json

“coin”: “TTcoin”,

“symbol”: “TTC”,

“dbsettings”: {
“user”: “TTC”,
“password”: “RWcq7y*3*Xq!H^8”,
“database”: “explorerdb”,
“address”: “localhost”,
“port”: 27017
},

“wallet”: {
“host”: “localhost”,
“port”: 17510,
“user”: “ttcoinrpc”,
“pass”: “3JNQ7cJ6LB4UqsSgsr4KZTfW55vcLLGmGUGQptUjRMX1”
},

“api”: {
“blockindex”: 5972,
“blockhash”: “000000216a1f9406461adef5296dfb81f83262d06ccd1cc3a49c4b79f662184d”,
“txhash”: “834d65d55bb109b43414b9924d071a47d830fb308f7941c4fa08be17fcc251ce”,
“address”: “TGW9x4XvQvgJZL1MBTJR3RgverWijTCg7D”
},

“genesis_tx”: “6fe8289b644faf01b5abadde67a0855cb81ecb9d08b8805874fa9f7ad232c075”,
“genesis_block”: “00000009efba3f88db6f03373c7ff6f6be1b6f9ad21306b4eb26f65dfdffac8d”,

“labels”: {
“TVVVjcdyVJF67hSXMg7aDGbHsx7mGoJgz7”: {“label”: “neiros”, “type”:”primary”, “url”:”https://bitcointalk.org/index.php?topic=2254304.0″},
“TYw4sTfrcA5Bk8nh5Rx2bwTTSqDPgKZUqK”: {“label”: “Developers address”, “type”:”primary”, “url”:”http://ss-iqr.blogspot.ru/2017/09/ttc.html”},
},

6. Запуск IQUIDUS

В каталоге explorer выполняем команду
npm start

С этого момента можно открыть браузер и на локальном компьютере по этому адресу http://127.0.0.1:3001/ должен заработать IQUIDUS

При начальном запуске в другой консоли выполняем
sudo node scripts/sync.js index update
или
sudo node scripts/sync.js index reindex

7. Добавляем задания в Crontab

sudo crontab -e

При первом запуске выбираем для Crontab редактор nano. По умолчанию он под номером 2.
Записываем эти две строчки:

*/1 * * * * cd /path/to/explorer && /usr/bin/nodejs scripts/sync.js index update > /dev/null 2>&1
*/5 * * * * cd /path/to/explorer && /usr/bin/nodejs scripts/peers.js > /dev/null 2>&1

Где /path/to место нахождения каталога explorer(узнать можно, например /home/neiros, правой кнопкой мыши в свойствах или командой pwd)

8. Для последующих запусков

sudo service mongod start

cd ttc/src && ./ttcoind

cd ../../explorer && npm start

Остановка работы блокэксплорера – сочетание клавиш Ctrl + С (остановка TTC – cd ../ttc/src && ./ttcoind stop)

Если перестанет обновляться список транзакций в браузере, следует удалить файл index.pid в каталоге tmp

rm tmp/index.pid

Безконсольная работа: forever start bin/cluster

Для этого нужно установить:
sudo npm install forever -g
sudo npm install forever-monitor


IQUIDUS долго индексирует транзакции блокчейна, что не очень подходит для больших объёмов


Что бы блокэксплорер показывал комиссии транзакций нужно немного подправить эти файлы:

lib/database.js


var inTotal = 0;
function save_tx(txid, cb) {

update_address(nvin[i].addresses, txid, nvin[i].amount, ‘vin’, function(){
inTotal += nvin[i].amount;
loop.next();
});

lib.calculate_total(vout, function(total){
var f = 0;
                    if (inTotal){
                      f = inTotal – total;
                    }
var newTx = new Tx({
txid: tx.txid,
vin: nvin,
vout: vout,
total: total.toFixed(8),
timestamp: tx.time,
blockhash: tx.blockhash,
blockindex: block.height,
fee: f.toFixed(8)
});
inTotal = 0;
newTx.save(function(err) {

models/tx.js


var TxSchema = new Schema({
txid: { type: String, lowercase: true, unique: true, index: true},
vin: { type: Array, default: [] },
vout: { type: Array, default: [] },
total: { type: Number, default: 0 },
timestamp: { type: Number, default: 0 },
blockhash: { type: String },
blockindex: {type: Number, default: 0},
fee: {type: Number, default: 0}
}, {id: false});

views/tx.jade


.col-md-6
.panel.panel-default
.panel-heading
– var txFee = tx.fee / 100000000
strong #{settings.locale.tx_recipients} (fee: #{txFee.toFixed(8)})
table.table.table-bordered.table-striped.summary-table


 

Iquidus Block Explorer Guide

 

Pre-requisites:

  • Rent Server

  • Connect with SSH/PuTTY


==
Iquidus
“An open source block explorer”
https://github.com/iquidus/explorer

==

Node and Iquidus Explorer Setup for Dummies
https://gist.github.com/zeronug/5c66207c426a1d4d5c73cc872255c572

==

1. Install & Configure BiblePay https://www.reddit.com/r/BiblePay/comments/6ummuj/how_to_mine_biblepay_on_linux/

After Installing the coin, Add RPC & Server settings:

vi biblepay.conf

rpcuser=XXXX
rpcpassword=XXXX
rpcport=XXXX
listen=1
server=1
daemon=1
txindex=1

==
2. Install MongoDB
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

sudo apt-get update

sudo apt-get install -y mongodb-org

sudo service mongod start

cd /var/log/mongodb
tail mongod.log
# [initandlisten] waiting for connections on port <port>
# Port 27017 by default

3. Setup MongoDB

mongo
use explorerdb
db.createUser( { user: "iquidus", pwd: "3xp!0reR", roles: [ "readWrite" ] } )
exit

4. Install Node.js

sudo apt-get update
sudo apt-get install nodejs nodejs-legacy -y
sudo apt-get install npm

5. Install Iquidis Block Explorer

cd home/username
git clone https://github.com/iquidus/explorer explorer

# gyp build errors
# https://github.com/nodejs/node-gyp/issues/809
sudo apt-get install libkrb5-dev

cd explorer && npm install --production

cp ./settings.json.template ./settings.json

6. Configure Iquidis

vi settings.json

a. Name, Symbol, Theme

b. Port (and Open for Firewall)

c. MongoDB Credentials

d. RPC Wallet Credentials

e. Genesis Block (showblock 0, hash=block, tx=tx)
https://en.bitcoin.it/wiki/Genesis_block

f. CCEX Market
https://support.coinigy.com/hc/en-us/articles/360001143574-How-do-I-find-my-API-key-on-the-C-Cex-Exchange-

e. Icon and Logo
/images/logo.png 128×128
/public/favicon.ico 16×16
Upload files online and use “wget URL” command to download
http://digitalagencyrankings.com/iconogen/


7. Sync Initial Database

cd home/username/biblepay/src  
./biblepayd -daemon -txindex  

cd home/username/explorer
npm start

Open a 2nd SSH/Putty session and connect, in 2nd window run:

cd home/username/explorer
sudo node scripts/sync.js index update 

Open web browser and enter in your servers address: IPAddress:Port


8. Troubleshooting

Ctrl + C to stop npm process

__

If Settings/Config is wrong:
Edit explorer/settings.json

__

If Database is corrupt:

mongo  
use explorerdb  
show collections  

Examples: db.collectionName.find()
db.collectionName.remove({}) db.collectionName.drop()

Reset all Database Data:

db.addresses.remove({})
db.addresses.drop()
db.coinstats.remove({})
db.coinstats.drop()
db.markets.remove({})
db.markets.drop()
db.peers.remove({})
db.peers.drop()
db.richlists.remove({})
db.richlists.drop()
db.txes.remove({})
db.txes.drop()
exit

__

“Trying to reindex and getting error Script already running”
https://github.com/iquidus/explorer/issues/11

rm tmp/index.pid  

__

Stop Everything:

sudo service mongod stop
sudo killall nodejs
#Comment out crontab -e

__

Run npm start in explorer folder to start explorer again


9. Add Crontab and Run!

sudo crontab -e

Add lines:

*/1 * * * * cd /path/to/explorer && /usr/bin/nodejs scripts/sync.js index update > /dev/null 2>&1  
*/2 * * * * cd /path/to/explorer && /usr/bin/nodejs scripts/sync.js market > /dev/null 2>&1  
*/5 * * * * cd /path/to/explorer && /usr/bin/nodejs scripts/peers.js > /dev/null 2>&1  

If the BiblePay isnt already running, run it

cd home/username/biblepay/src  
./biblepayd -daemon -txindex  

If Explorer isnt already running, run it

cd home/username/explorer
npm start

Recommendation:*

Add these parameters to biblepay.conf file

daemon=1
txindex=1

Extra:
This Iquidis for Dummides guide also adds:
https://gist.github.com/zeronug/5c66207c426a1d4d5c73cc872255c572

Upstart, to have MongoDB auto start after reboots

Forever, to make sure Explorer is always running

Install Forever to keep the js running
# sudo npm install forever -g
# sudo npm install forever-monitor

Start the Explorer
# forever start bin/cluster

Nginx – Reverse Proxy Port 3001 to 80
https://eladnava.com/binding-nodejs-port-80-using-nginx/


BiblePay Daemon set to run Every 2 Minutes with Cron

sudo crontab -e  
*/2 * * * * /home/biblepay/src/biblepayd > /dev/null 2>&1  

Note: In ~/.biblepaycore/biblepay.conf add daemon=1 and txindex=1
Note: > /dev/null 2>&1 will capture both STDOUT (1) and STDERR (2) and send them to /dev/null


Auto Remove index.pid if indexing is complete

#!/bin/bash
fname="/home/biblepay/explorer/tmp/index.pid"
if [[ -f "$fname" ]];
then
        pid=$(</home/biblepay/explorer/tmp/index.pid)
        echo $pid
        ps -p $pid > /dev/null
        r=$?
        echo $r
        if [ $r -eq 0 ]; then
                exit 1
        else
                rm $fname
        fi
fi

-f is checking if the file exists
index.pid is the indexing lock file with its process ID number inside of it
ps -p checks if the process is running
$? is the value of the last output that ran and since the previous value is going to dev/null, its the exit code status
“0 for successful executions and 1 or higher for failed executions.”
and so if the process is still running, the bash script just exits, otherwise the process is done and the index.pid file gets removed
the file doesnt need a .sh extension, if you have “#!/bin/bash” at the top then linux knows its a bash script chmod +x to set it as executable


Github Source Code Files:

https://github.com/togoshigekata/biblepay-files/blob/master/explorer-settings-togo.json

https://github.com/togoshigekata/biblepay-files/blob/master/explorer-index-resetter-togo.sh


My Crontab:

*/2 * * * * cd /home/explorer && /usr/bin/nodejs --stack-size=15000 scripts/sync.js index update > /dev/null 2>&1
*/6 * * * * cd /home/explorer && /usr/bin/nodejs scripts/sync.js market > /dev/null 2>&1
*/11 * * * * cd /home/explorer && /usr/bin/nodejs scripts/peers.js > /dev/null 2>&1

*/5 * * * * /home/biblepay/src/biblepayd > /dev/null 2>&1
*/4 * * * * /home/explorer-index-resetter-togo.sh > /dev/null 2>&1
0 */3 * * * /usr/sbin/service mongod start > /dev/null 2>&1

Experimental:
https://github.com/iquidus/explorer/issues/236

  1. 5
  2. 4
  3. 3
  4. 2
  5. 1
(1 голос, в среднем: 5 из 5)

Комментарии:

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *