A block explorer for Doichain, in Le-Space branding and in two languages.
Forked from Doichain/explorer, which in turn forks iquidus/explorer 1.7.4. The original README follows below and still describes how to install and run it.
Branding. Palette, logo, favicons and fonts come from the Le-Space brand
package (docs/le-space-brand in Le-Space/landing): Deep Space #0B0E15 as
the ground, Signal Coral #FF6B5B as the accent, Sync Cyan #58C7F3 for links,
Inter for the interface and JetBrains Mono wherever an identifier is read
character by character -- hashes, addresses, names. The theme lives in
public/themes/le-space/, where everything below the marked line is ours and
the part above is the untouched dark base, so the base can be replaced wholesale
when Bootswatch moves on.
Two languages, chosen per visitor. The upstream explorer serves one language
per instance. Here every locale/<code>.json that parses is offered, and the
language of a request is decided in this order:
?lang=de-- explicit, and therefore shareable: a link can carry the language, which a cookie never can. This choice is remembered in a cookie.- the cookie, from an earlier explicit choice.
Accept-Language, i.e. what the browser asks for, by quality -- so a German browser gets German without doing anything.settings.locale, the instance default.
Adding a language means adding one file: drop locale/fr.json next to the
others and it appears in the switcher.
The templates were not touched for this. Express exposes its app settings to
views as settings, which is where settings.locale.* comes from; the
middleware in app.js puts a per-request copy on res.locals, and that shadows
the global one for exactly that response. See lib/i18n.js.
Doichain features inherited from the parent fork: Core 31 support, name
search through ElectrumX, a name page at /name/<name> with expiry and history,
and a share button.
This project is BSD-3-Clause, Copyright (c) 2015 Iquidus Technology and
Luke Williams. LICENSE carries the text verbatim and the original README
reproduces it below; neither has been altered by this fork.
Changes made in this fork are offered under the same licence.
Third-party components keep their own notices where they sit: the Bootswatch
themes under public/themes/ are MIT (Copyright 2012-2020 Thomas Park), as is
the Bootstrap they build on, and public/javascripts/ and public/vendor/
carry Chart.js, jQuery and jqplot with the headers their authors wrote. None of
them were stripped: of the 84 files upstream that carry a copyright notice, all
84 still carry it here.
Two notes on what the licence does not ask for, since both are commonly assumed. It requires no record of changes -- that is Apache 2.0 -- and running a public instance is not redistribution, so the clause about binary form does not apply to the hosted explorer.
One thing it does ask for: clause 3 forbids using the Iquidus name to endorse or promote derived work. The footer therefore names the upstream as plain attribution and not as a "Powered by" badge.
An open source block explorer written in node.js.
Note: If you would like your instance mentioned here contact me
- node.js >= 8.17.0 (12.14.0 is advised for updated dependencies)
- mongodb 4.2.x
- *coind
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"] })
git clone https://github.com/iquidus/explorer explorer
cd explorer && npm install --production
cp ./settings.json.template ./settings.json
Make required changes in settings.json
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
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
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
Ensure mongodb is not exposed to the outside world via your mongo config or a firewall to prevent outside tampering of the indexed chain data.
script is already running.
If you receive this message when launching the sync script either a) a sync is currently in progress, or b) a previous sync was killed before it completed. If you are certian a sync is not in progress remove the index.pid and db_index.pid from the tmp folder in the explorer root directory.
rm tmp/index.pid
rm tmp/db_index.pid
exceeding stack size
RangeError: Maximum call stack size exceeded
Nodes default stack size may be too small to index addresses with many tx's. If you experience the above error while running sync.js the stack size needs to be increased.
To determine the default setting run
node --v8-options | grep -B0 -A1 stack_size
To run sync.js with a larger stack size launch with
node --stack-size=[SIZE] scripts/sync.js index update
Where [SIZE] is an integer higher than the default.
note: SIZE will depend on which blockchain you are using, you may need to play around a bit to find an optimal setting
Copyright (c) 2015, Iquidus Technology
Copyright (c) 2015, Luke Williams
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of Iquidus Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.