Skip to content

iquidus/explorer

Repository files navigation

Iquidus Explorer - 1.7.4

An open source block explorer written in node.js.

See it in action

Note: If you would like your instance mentioned here contact me

Requires

  • node.js >= 8.17.0 (12.14.0 is advised for updated dependencies)
  • mongodb 4.2.x
  • *coind

Create database

Enter MongoDB cli:

$ mongo

Create databse:

> use explorerdb

Create user with read/write access:

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

*Note: If you're using mongo shell 4.2.x, use the following to create your user:

> db.addUser( { user: "username", pwd: "password", roles: [ "readWrite"] })

Get the source

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

Install node modules

cd explorer && npm install --production

Configure

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

Make required changes in settings.json

Start Explorer

npm start

Note: mongod must be running to start the explorer

As of version 1.4.0 the explorer defaults to cluster mode, forking an instance of its process to each cpu core. This results in increased performance and stability. Load balancing gets automatically taken care of and any instances that for some reason die, will be restarted automatically. For testing/development (or if you just wish to) a single instance can be launched with

node --stack-size=10000 bin/instance

To stop the cluster you can use

npm stop

Syncing databases with the blockchain

sync.js (located in scripts/) is used for updating the local databases. This script must be called from the explorers root directory.

Usage: node scripts/sync.js [database] [mode]

database: (required)
index [mode] Main index: coin info/stats, transactions & addresses
market       Market data: summaries, orderbooks, trade history & chartdata

mode: (required for index database only)
update       Updates index from last sync to current block
check        checks index for (and adds) any missing transactions/addresses
reindex      Clears index then resyncs from genesis to current block

notes:
* 'current block' is the latest created block when script is executed.
* The market database only supports (& defaults to) reindex mode.
* If check mode finds missing data(ignoring new data since last sync),
  index_timeout in settings.json is set too low.

It is recommended to have this script launched via a cronjob at 1+ min intervals.

crontab

Example crontab; update index every minute and market data every 2 minutes

*/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

Wallet

Iquidus Explorer is intended to be generic, so it can be used with any wallet following the usual standards. The wallet must be running with atleast the following flags

-daemon -txindex