Skip to content

skycoin/skycoin-explorer

Repository files navigation

skycoin explorer logo

Skycoin Explorer

Build Status

https://explorer.skycoin.com

Skycoin Explorer is a tool for checking the contents fo the Skycoin blockchain.

You can check the state of blocks, transactions and more.

https://explorer.skycoin.com

Table of Contents

Architecture

The explorer is divided in 2 parts: the frontend and the optional server.

The frontend is an Angular application that can be viewed in a web browser. When compiled, it is saved in the /dist fonder, inside the root of this repository.

The server is a small program written in Go (Golang) which two functions: serve the contents of the /dist folder in http://127.0.0.1:8001 (making it is possible to open the frontend in a web browser) and provide an API for getting data from the blockchain. The API provided by the server is just a proxy that gets the data from a Skycoin node, so it needs a Skycoin node to be running to work.

If you don't want to use the included server, the frontend is able to get the data directly from a Skycoin node. For that, you must open the {explorerUrl}/node/{url} address, replacing the {url} part with the URL for accessing the API of the local node, URL encoded. For example, if the local node is running in 127.0.0.1:6420 you must use http://127.0.0.1:6420/api/, which is http:%2F%2F127.0.0.1:6420%2Fapi%2F when URL encoded.

If you want to make the app use the included server again, just open {explorerUrl}/node/null.

Installation

When the explorer is being hosted in a server, you only need the URL to access it. However, to be able to compile the explorer and run it locally, you must install the minimum software requirements and follow some initial configuration steps.

Software requirements

For the server to work, you must install Go (Golang) v18.x or newer. You also need a Skycoin node v0.26 or newer (normally the node included with the desktop wallets does not work, as it must be running on the default port: 6420).

For compiling the frontend or starting it in development mode, you need Node.js v14.20 or newer and a compatible version of the NPM package manager. If the frontend has already been compiled and will be opened through the included server (via http://127.0.0.1:8001), these requirements are not necessary.

Initial configuration steps

After cloning the project, you must open a terminal window in the repository root and run npm install. That will install the javascript dependencies needed by the frontend.

Docker images

If you want to run Explorer on Docker refer to Docker instructions.

API documentation

The API provided by the server is similar to the Skycoin node API, but there are differences. You can find documentation about it in HTML format in http://explorer.skycoin.com/api.html and in JSON format in http://explorer.skycoin.com/api/docs.

If you are running the server locally, you can access the documentation in http://127.0.0.1:8001/api.html and http://127.0.0.1:8001/api/docs.

Running the explorer

For running the explorer, you need 3 things:

  1. A compiled version of the frontend (the application that will be shown in the browser).
  2. A Skycoin node running (for getting the blockchain data).
  3. A server running (for being able to access the frontend and for it to be able to get the blockchain data).

The frontend will not work if it is not opened with the server, unless you follow the steps to run a test version with the Angular test server.

Build the explorer frontend

You can compile the frontend by running this command in the root of the repository:

make build-ng

Note: if you do not want to install NPM or build the frontend, you can use a docker image to run the explorer.

Run a skycoin node

You can clone the code of the Skycoin node in your $GOPATH folder and start a node instance by running the following commands:

go get github.com/skycoin/skycoin/cmd/...
cd $GOPATH/src/github.com/skycoin/skycoin
make run-client

If you already have a copy of the Skycoin node code, you can skip the first line.

For more information, go to https://github.com/skycoin/skycoin.

Start the server

To start the server, run this command in the repository root:

make run

The intermediate Go server assumes that the Skycoin node is running on localhost:6420 (the default location of the Skycoin node). If the node is running in a different URL (even a remote one), then run this command instead:

SKYCOIN_ADDR={NODE_URL} make run

Replace the {NODE_URL} part with the URL of the node, including the http:// or https:// part.

If you want to run the server in api-only mode (it will respond to API calls but will not serve the frontend), replace the make run with make run-api.

You can also configure the node and server addresses with CLI flags, run go run explorer.go -h to see the options.

Open the frontend

If the Skycoin node and the server are already running, simply open http://127.0.0.1:8001 in a web browser.

Development

DEVELOPMENT.md

Customization

CUSTOMIZATION.md

Translations

You can find information about how to work with translation files in the Translations README.

named addresses

It is possible to assign names to specific addresses, so the explorer shows the name every time the address is shown. For editing the named addresses list, just add, remove or modify entries from the namedAddresses array in the [src/app/app.config.ts) file.

Deployment

Compile explorer.go to a binary:

make build-go

Allow it to bind to port 80 using setcap:

sudo setcap 'cap_net_bind_service=+ep' ./explorer

Run it on port 80:

EXPLORER_HOST=:80 ./explorer

If you want to install the linters in a local development enviroment, use:

make install-linters-local

For running the linter, run

make lint