Giter Club home page Giter Club logo

skycoin-explorer's Introduction

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

skycoin-explorer's People

Contributors

0pcom avatar alexey-belous avatar alexsugak avatar angular-cli avatar berli96 avatar dependabot[bot] avatar efosao avatar gz-c avatar iketheadore avatar ivanpayan avatar kzviagina avatar mlopezqc avatar montycrypto avatar olemis avatar pautena avatar samuelvisscher avatar senyoret1 avatar skycoinsynth avatar snyk-bot avatar stdevnorge avatar stdevrob avatar therealssj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skycoin-explorer's Issues

Popdown menu does not work in explorer

  • when clicking the upper left, there should be a pop down menu with a list of options (similar to the skycoin wallet)
  • one of the tabs needs to be "unconfirmed transactions" and display the unconfirmed transactions in the pool and number of seconds since the transaction was first seen

Unconfired Transaction Pool Page

Need page for "unconfirmed transactions" and display the unconfirmed transactions in the pool

  • display number of seconds since the transaction was first seen

unconfirmed transaction pool page needs to be reachable from the upper left pop-down menu button.

Cache coinSupply response in case skycoin node is unavailable

/api/coinSupply updates infrequently, we should cache the last successful response and use that if the backend skycoin node in unreachable.

Recently the skycoin node crashed, which caused our rank to collapse on CMC because our circulating supply was unavailable. Caching /api/coinSupply would help prevent this situation from occuring.

RKT Containers for Explorer

  • Need container that launches a Skycoin node and an explorer node
  • Skycoin explorer should be reachable from local host

ng build fails - explorer.service is missing

ng build fails
I tried to run the new build on master, but ran into build errors during the angular compile step. Details are as follows:

./src/app/services/explorer/explorer.service is missing from repo, but reference in /src/app/app.module.ts.

// ./src/app/app.module.ts
import { AddressDetailComponent } from './components/pages/address-detail/address-detail.component';
import { TransactionsValuePipe } from './pipes/transactions-value.pipe';
import { ExplorerService } from './services/explorer/explorer.service'; // MISSING FOLDER
import { QrCodeComponent } from './components/layout/qr-code/qr-code.component';
import { FormsModule } from '@angular/forms';
...

build error msg

ERROR in Error: Error encountered resolving symbol values statically. Could not resolve ./services/explorer/explorer.service relative to /Users/efosaoyegun/Projects/skycoin/skycoin-explorer/src/app/app.module.ts., resolving symbol AppModule in /Users/efosaoyegun/Projects/skycoin/skycoin-explorer/src/app/app.module.ts, resolving symbol AppModule in /Users/efosaoyegun/Projects/skycoin/skycoin-explorer/src/app/app.module.ts
    at syntaxError (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
    at simplifyInContext (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24979:23)
    at StaticReflector.simplify (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24991:13)
    at StaticReflector.annotations (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24418:41)
    at NgModuleResolver.resolve (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:14750:70)
    at CompileMetadataResolver.getNgModuleMetadata (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:15402:60)
    at addNgModule (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24268:58)
    at /Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24279:14
    at Array.forEach (<anonymous>)
    at _createNgModules (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24278:26)
    at analyzeNgModules (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24153:14)
    at analyzeAndValidateNgModules (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:24163:35)
    at AotCompiler.analyzeModulesAsync (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler/bundles/compiler.umd.js:23797:46)
    at CodeGenerator.codegen (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@angular/compiler-cli/src/ngtools_api.js:73:30)
    at _donePromise.Promise.resolve.then (/Users/efosaoyegun/Projects/skycoin/skycoin-explorer/node_modules/@ngtools/webpack/src/plugin.js:386:44)

Info button on address page's inputs has odd behavior

Example:

http://127.0.0.1:8001/app/address/2GgFvqoyk9RjwVzj8tqfcXVXB4orBwoc9qv

On the left side are inputs. Each input address has a small (i) info button. Several problems:

  • The button is not aligned with the address
  • There is no indication of what kind of info
  • Apparently this retrieves the uxid
  • The uxid is displayed in a modal
  • The text in the uxid modal does not highlight when copied
  • The text in the uxid modal seemingly flickers between different values

This feature should be redesigned and reimplemented

Richlist API

Proxy /richlist from the skycoin node

Cap max n at 20 addresses before proxying
Default n to 20

Update docs

Header revisions

  • Remove FAQs from header
  • Add link back to skycoin.net
  • Change name of primary left-most header button from "Skycoin" to "Skycoin Explorer"

/transaction page formatting

  • Use a nice box for the header information like on the /block page
  • Fix the formatting of the inputs/outputs/value

screen shot 2017-12-12 at 12 45 59 pm

Show how many coins are entering o leaving on the address details page

#74 changed the address screen for showing if the coins entered or exited in a transaction. The change does not shows exactly how many coins entered or exited because it is not possible to do it in an optimal way. At this time, /api/address (explorer's api) and /explorer/address (node's api) return the amount of coins in the outputs, but not in the inputs, so it is not possible to know how many coins went out of the address.

Para que se muestre cuantas monedas entraron o salieron hay dos opciones, cada una con sus ventajas y desventajas.

To show how many coins entered or exited there are 2 options, each with its advantages and disadvantages.

Option 1:

/address_uxouts (api of the node) could be added to explorer.go, so that after calling /api/address to obtain all the transactions of an address /address_uxouts could be called to get all the values of all the inputs and outputs of the address. In this way, it would be possible to do the calculation.

The problem is that the client would then be making 2 calls and, taking into account that /address_uxouts returns a significant amount of data and a separate query, it would require unnecesary work from the server and more bandwidth.

If this option is used, the problems could be minimized by modifing explorer.go to remove all the not necessary data that is being returned (something that would help to improve the overall performance of the system).

Option 2:

The other option is to add the amount of coins of each input in the response of /explorer/address (in the Skycoin node). The response is currently as follows:

"inputs": [
    {
        "uxid": "8b64d9b058e10472b9457fd2d05a1d89cbbbd78ce1d97b16587d43379271bed1",
        "owner": "c9zyTYwgR4n89KyzknpmGaaDarUCPEs9mV"
    }
]

After the modification, it should look similar to the following:

"inputs": [
    {
        "uxid": "8b64d9b058e10472b9457fd2d05a1d89cbbbd78ce1d97b16587d43379271bed1",
        "owner": "c9zyTYwgR4n89KyzknpmGaaDarUCPEs9mV",
        "coins": "2.000000"
     }
]

With this change, it would be possible to calculate how many coins entered and exited during the transaction.

Next step: please share your opinions about which option should be used.

Small line at the end just to notify @gz-c and @samuelvisscher

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.