Compile and run the explorer

Once the Blur is compiled, the explorer can be downloaded and compiled
as follows:

# go to home folder if still in ~/blurcd~# download the source code
git clone https://github.com/blur-network/blur-explorer.git
# enter the downloaded sourced code foldercd blur-explorer
# make a build folder and enter it
mkdir build &&cd build
# create the makefile
cmake ..
# altearnatively can use: cmake -DMONERO_DIR=/path/to/blur_folder ..# if blur is not in ~/blur## also can build with ASAN (sanitizers), for example# cmake -DSANITIZE_ADDRESS=On ..# compile
make

When compilation finishes executable xmrblocks should be created. Before running
please make sure that ~/Downloads folder exists and is writable.
Time zone library that explorer is using, puts there
its database of time zone offsets

To run it:

./xmrblocks

By default it will look for blockchain in its default location i.e., ~/.blurnet/lmdb.
You can use --bc-path option if its in different location.
Example output:

Enable Blur emission

Obtaining current Blur emission amount is not straight forward. Thus, by default it is
disabled. To enable it use --enable-emission-monitor flag, e.g.,

xmrblocks --enable-emission-monitor

This flag will enable emission monitoring thread. When started, the thread
will initially scan the entire blockchain, and calculate the cumulative emission based on each block.
Since it is a separate thread, the explorer will work as usual during this time.
Every 10000 blocks, the thread will save current emission in a file, by default,
in ~/.blurnet/lmdb/emission_amount.txt. For testnet or stagenet networks,
it is ~/.blurnet/testnet/lmdb/emission_amount.txt or ~/.blurnet/stagenet/lmdb/emission_amount.txt. This file is used so that we don't
need to rescan entire blockchain whenever the explorer is restarted. When the
explorer restarts, the thread will first check if ~/.blurnet/lmdb/emission_amount.txt
is present, read its values, and continue from there if possible. Subsequently, only the initial
use of the tread is time consuming. Once the thread scans the entire blockchain, it updates
the emission amount using new blocks as they come. Since the explorer writes this file, there can
be only one instance of it running for mainnet, testnet and stagenet. Thus, for example, you cant have
two explorers for mainnet
running at the same time, as they will be trying to write and read the same file at the same time,
leading to unexpected results. Off course having one instance for mainnet and one instance for testnet
is fine, as they write to different files.

When the emission monitor is enabled, information about current emission of coinbase and fees is
displayed on the front page, e.g., :

BLUR emission (fees) is 14485540.430 (52545.373) as of 1313448 block

The values given, can be checked using Blur daemon's print_coinbase_tx_sum command.
For example, for the above example: print_coinbase_tx_sum 0 1313449.

To disable the monitor, simply restart the explorer without --enable-emission-monitor flag.

Enable JavaScript for decoding proving transactions

By default, decoding and proving tx's outputs are done on the server side. To do this on the client side
(private view and tx keys are not send to the server) JavaScript-based decoding can be enabled:

xmrblocks --enable-js

Enable SSL (https)

By default, the explorer does not use ssl. But it has such a functionality.

Note: Because we generated our own certificate, modern browsers will complain
about it as they cant verify the signatures against any third party. So probably
for any practical use need to have properly issued ssl certificates.

JSON API

The explorer has JSON api. For the API, it uses conventions defined by JSend.
By default the api is disabled. To enable it, use --enable-json-api flag, e.g.,

api/outputs?txhash=<tx_hash>&address=&viewkey=&txprove=<0|1>

For txprove=0 we check which outputs belong to given address and corresponding viewkey.
For txprove=1 we use to prove to the recipient that we sent them founds.
For this, we use recipient's address and our tx private key as a viewkey value,
i.e., viewkey=<tx_private_key>

Checking outputs:

# we use here official Monero project's donation address as an example
curl -w "\n" -X GET "http://127.0.0.1:8081/api/outputs?txhash=17049bc5f2d9fbca1ce8dae443bbbbed2fc02f1ee003ffdd0571996905faa831&address=44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A&viewkey=f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501&txprove=0"

We use recipient's address (i.e. not our address from which we sent xmr to recipient).
For the viewkey, we use tx_private_key (although the GET variable is still called viewkey) that we obtained by sending this txs.

# this is for testnet transaction
curl -w "\n" -X GET "http://127.0.0.1:8082/api/outputs?txhash=94782a8c0aa8d8768afa0c040ef0544b63eb5148ca971a024ac402cad313d3b3&address=9wUf8UcPUtb2huK7RphBw5PFCyKosKxqtGxbcKBDnzTCPrdNfJjLjtuht87zhTgsffCB21qmjxjj18Pw7cBnRctcKHrUB7N&viewkey=e94b5bfc599d2f741d6f07e3ab2a83f915e96fb374dfb2cd3dbe730e34ecb40b&txprove=1"