- Frontend, An angular application, compile and served by nginx
- Backend, A nodejs express api and websocket server.
git clone https://github.com/hyle-team/block_explorer.git && cd block_explorer
npm install
Angular application is compiled into a set of minified js files that reside the build directory, these file should be transfered to your nginx directory for serving.
The following files source/environments.ts and source/environments.prod.ts
are configuration file for debug and production builds
export const environment = {
production: false,
backend: 'http://10.0.0.13:8008',
documentionApi: 'https://docs.zano.org',
decimalPlaces: 2,
initialChartLoadDelayMs: 5000,
frequencyOfChartRefreshingMs: 3600000,
enableVisibilityInfo: true
};
backend
FQDN of your backend with thefrontEnd_api
documentationApi
Address used to build documentation explanationsdecimalPlaces
how many decimal places to use when displaying currencyinitialChartLoadDelayMs
how many milliseconds to wait after the app loads before attempting to fill the chart cachefrequencyOfChartRefreshingMs
how often the chart cache should be refresh, currently 1 hourenableVisibilityInfo
show the dev fund wallet information
Once you have adjusted the configuration files to your needs, issue the following command to build the minified js files.
npm run 'build prod'
ng serve -o
The following file contains all the configuration setting required to run your Backend, Edit config.json
{
"api":"http://10.0.0.13:12111",
"frontEnd_api": "http://localhost:4200",
"server_port": "8008",
"auditable_wallet": {
"api": "http://10.0.0.13:12233"
},
"enableVisibilityInfo": true,
"database": {
"user": "zano",
"host": "10.0.0.13",
"port": 5432,
"database": "db",
"password": "123456"
}
"api"
The address of your zano node."frontEnd_api"
The address of the angular uses for CORS. seems to not like 127.0.0.1"server_port"
Port of backend API used by angular to obtain data."auditable_wallet"
FDQN of your auditable wallet running as a service."database"
credentials and location of a postgresql databaseenableVisibilityInfo
stop/start websocket emitting dev fund wallet information
Once the postgresql database is installed, schema, tables, stored procedures and permissions configurated on the database, you should begin to synchronize zano node information to the database. this process takes around 10hrs
node server-pg.js
./zanod
./simplewallet --generate-new-wallet my_new_wallet
./simplewallet --wallet-file my_new_wallet --password 123456 --rpc-bind-ip 10.0.0.13 --rpc-bind-port 12233 --daemon-address 10.0.0.13:12111
sudo -u createuser zano
sudo usermod -aG sudo zano
\q
quit the psql shell\l
list available databases\c [database]
connect to a database\dt
list available tables in the database after you connected\c [database]
sudo apt update && sudo apt install postgresql postgresql-contrib \
sudo systemctl start postgresql
sudo -u postgres psql
CREATE ROLE zano LOGIN SUPERUSER;
CREATE DATABASE db;
Run the database.sql
script to create the tables, stored procedures and grant permissions to these database objects for the zano
user
psql -f database.sql
If you intend to run Backend and postgresql on different servers you will need to configure postgresql for remote access. Once configured for remote access you will also need to install pgAdmin4 to administer your database remotely.
sudo nano /etc/postgresql/13/main/postgresql.config
locate the entry #list_address = 'localhost'
uncomment and change to listen_address = '*'
. This will configure postgresql to listen on all ports.
# TYPE DATABASE USER ADDRESS METHOD
host all all 10.0.0.15/24 md5
sudo ufw allow 5432/tcp
- Restart Postgresql Service
sudo systemctl restart postgresql
$ curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
$ sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
sudo apt install pgadmin4
- create a connection to your server, provide a master password
- connect to your server with the role created previously
username: zano
password: 123456
- Right click
Database
and select create Database - From the toolbar select
query tool
- In the query editor open file and select
database.sql
- Run the query to create the
db
tables, stored procedures and permissions necessary to run block_explorer
sudo apt update && sudo apt install nginx certbot
- Start Nginx
sudo systemctl nginx start
sudo nano /etc/nginx/sites-available/zano.smartcoinpool.net
server {
server_name zano.smartcoinpool.net;
gzip on;
gzip_types *;
gzip_min_length 1000;
# Set files location
root /var/www/block-explorer/dist/;
index index.html;
location ~ ^/(.*) {
proxy_pass http://127.0.0.1:8008/$1$is_args$args;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#wss requires nginx 1.4
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80;
server_name zano.smartcoinpool.net;
}