Blockscout Explorer Deployment
Blockchain explorer for examining and inspecting EVM chains.
A. Introduction
Blockscout is a fully-featured open-source blockchain explorer which can be used by any Ethereum virtual machine (EVM) chain. Blockscout provide access to essential on-chain data, the ability to interact with smart contracts, and tools to analyse any transactions at ease. The major features of blockscout are multichain, highly configurable, and open source. The explorer allows the user to search blocks, transaction, addresses and also connect & interact with smart contract, application, bridges, wallets, etc.,
B. Hardware Requirements
The hardware requirement details to install the explorer for Peerplays2.0 is provided below.
1. Recommended Base Hardware (Provided by Blockscout)
EVM chains can differ in size and requirements, these are the recommendations for optimal performance.
RAM
128GB
2. Currently Deployed Hardware For Peerplays2
RAM
16GB
Disk
160GB SSD
3. Current Hardware Utilized Connected To Peerplays2
RAM
16GB
Disk
15GB
CPU Average (1, 5, 15 Minutes)
0.25, 0.11, 0.10
RAM Usage
5.95GB
Disk Usage
25GB
C. Software Requirements
Before installing the Blockscout explorer, the user must ensure that the below required software are installed in their machine. Follow the CLI below to install the desired software,
1. Docker
Docker is an open software platform that enables the user to build, deploy, test, and update applications swiftly. Docker uses containers for all the execution. A container is a total software package of an application's code, its libraries and other dependencies. The main advantage of using container is that, our application is portable and the same code can be executed on any device. The cli to install docker is provided below:
2. Erlang
Erlang is used to build massive scalable soft real-time system with requirements on high availability. Install using the below command:
3. Elixir
Elixir is a dynamic, functional language for building scalable and maintainable applications. Elixir runs on the Erlang VM, known for creating low-latency, distributed, and fault-tolerant systems. Install the Elixir using the below command:
4. PostgreSQL 14
PostgreSQL is an open source relational database management system emphasizing extensibility and SQL compliance. It is the primary primary datastore or data warehouse for many web, mobile, geospatial, and analytics application. Install PostgreSQL 14 using the below CLI:
5. Node 18.x
Node 18 execute the JavaScript using the updated version to boost the performance of web applications. It allows to create and execute tests without intervention from any third party package before adding code to action. Its the build-in node. Install latest Node 18 version using the below commands:
6. Apt dependencies
The apt dependencies are the supporting packages required to run the application in Linux without interruption. Install the necessary package using below command:
D. Setting up the application
In the terminal, follow the step-by-step procedure given below to setup the application
Grab the repository Clone the repository from the GitHub.
Ensure connectivity to PostgreSQL Login the PSQL using the correct database user.
Export PostgreSQL database URL Export the database to blockscout.
Install Mix dependencies and compile them
Generate a new secret_key_base for the DB Using the below command, generate the key for database:
Export the secret key
Set the following environment variables specific to Peerplays2.0 The below environment details are specific to Peerplays2.0 application:
Start Smart contract verification micro-service with docker Use below command to start the docker:
Compile the application compile using the below command:
Create and migrate database
Installing node.js dependencies Install the required modules using below commands:
Build static assets (if any)
Generate self signed certs for running locally (use certbot if deploying production) The required certificate can be generated using below commands:
Start the server with tmux To have multiple sessions and to switch between, start the application with tmux.
E. Restoring from a PostgreSQL backup
First, create blockscout
database dump using a proper database user. It's important because the application can be restored only using this data. Follow the below steps,
Create a dump of the
blockscout
database using below command:
Drop the database and recreate an empty database from
~/blockscout/
Restarting blockscout from the above location will result in error, as the database has not been migrated - Follow next step to restore the database.
Restore the database using the dump taken earlier using below command:
The Application has to be restarted from here and it starts the indexing again from where it left off last in the database dump.
Last updated