hashgraph / hedera-mirror-node-explorer

Hedera Mirror Node Explorer for the Hedera Hashgraph DLT.
Apache License 2.0
34 stars 15 forks source link
hacktoberfest

License

hashgraph/hedera-mirror-node-explorer

Visual Explorer for the Hedera Hashgraph DLT.

Project setup

npm install

Build

Compile and hot-reload for development

npm run dev

Compile and minify for production

npm run build

Lint files (find and fix problems)

npm run lint

Test

Run unit tests (based on Jest)

npm run test:unit

Run end-to-end tests (based on Cypress)

# Run the tests interactively
npm run test:e2e:dev 
# Or run the tests in headless browser mode
npm run test:e2e

Configuration

The configuration of the explorer is based on these 2 files, which need to be found at the root of the app in order for the Explorer to start:

Details for these configuration files can be found in CONFIGURATION.md.

Run in Docker

# Build the Docker image locally
npm run docker:build

# Copy and adjust configuration of Hedera networks as needed
cp networks-config-http-example.json networks-config.json

# Start the Docker container
# (if not built locally, this will fetch a pre-built image from Google Container Registry)
npm run docker:start
open http://127.0.0.1:8080

# Stop the Docker container
npm run docker:stop

# then open http://localhost:8080 in your web browser

Run in Kubernetes

To run in Kubernetes the hedera-explorer Helm chart can be used. First, obtain access to a Kubernetes cluster running version 1.23 or greater. Minikube can be used for a local Kubernetes cluster.

helm upgrade --install hedera-explorer chart/

Configure custom networks

Core configuration and network configuration need to be provided to the Explorer in the values.yaml file (see CONFIGURATION.md for details on configuration parameters).

If the network configuration is empty, by default the Explorer will support MAINNET, PREVIEWNET and TESTNET. But a custom list of network can be provided, to either extend or completely replace the list of networks supported.

An example:

 config: |
  [
    {
      "name": "testnet",
      "displayName": "TESTNET",
      "url": "https://testnet.mirrornode.hedera.com/",
      "ledgerID": "01"
    }
  ]

Run local sourcify instance (for smart contract verification)

This set-up uses an nginx reverse proxy in front of the 3 sourcify services (ui, server, repository) in order to support HTTPS. The SSL set-up is based on a self-signed certificate obtained per the instructions at: https://letsencrypt.org/docs/certificates-for-localhost/

The design of the repository (itself based on an nginx reverse proxy) is such that it requires to be on a distinct host, so it cannot be accessed by localhost like ui and server. To this effect you need to define a hostname locally (see below)

# Define the domain repository.local` used by the repository
bash -c 'echo "127.0.0.1       repository.local" >> /etc/hosts'

# Start sourcify services
# in sourcify-setup directory do:
docker-compose up -d

# Invoke the server API once to make sure your browser accepts the self-signed certificate
open https://localhost/server/chains

# To open the sourcify UI
open https://localhost

# To open the sourcify repository UI
open https://repository.local

# Stop sourcify services
# in sourcify-setup directory do:
docker-compose down

Contributing

Contributions are welcome. Please see the contributing guide to see how you can get involved.

Code of Conduct

This project is governed by the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to oss@hedera.com.

License

Apache License 2.0