ipld-eth-server/vendor/github.com/ethereum/go-ethereum/dashboard
Matt K 293dd2e848 Add vendor dir (#16) (#4)
* Add vendor dir so builds dont require dep

* Pin specific version go-eth version
2018-01-29 13:44:18 -06:00
..
assets Add vendor dir (#16) (#4) 2018-01-29 13:44:18 -06:00
assets.go Add vendor dir (#16) (#4) 2018-01-29 13:44:18 -06:00
config.go Add vendor dir (#16) (#4) 2018-01-29 13:44:18 -06:00
dashboard.go Add vendor dir (#16) (#4) 2018-01-29 13:44:18 -06:00
README.md Add vendor dir (#16) (#4) 2018-01-29 13:44:18 -06:00

Go Ethereum Dashboard

The dashboard is a data visualizer integrated into geth, intended to collect and visualize useful information of an Ethereum node. It consists of two parts:

  • The client visualizes the collected data.
  • The server collects the data, and updates the clients.

The client's UI uses React with JSX syntax, which is validated by the ESLint linter mostly according to the Airbnb React/JSX Style Guide. The style is defined in the .eslintrc configuration file. The resources are bundled into a single bundle.js file using Webpack, which relies on the webpack.config.js. The bundled file is referenced from dashboard.html and takes part in the assets.go too. The necessary dependencies for the module bundler are gathered by Node.js.

Development and bundling

As the dashboard depends on certain NPM packages (which are not included in the go-ethereum repo), these need to be installed first:

$ (cd dashboard/assets && npm install)

Normally the dashboard assets are bundled into Geth via go-bindata to avoid external dependencies. Rebuilding Geth after each UI modification however is not feasible from a developer perspective. Instead, we can run webpack in watch mode to automatically rebundle the UI, and ask geth to use external assets to not rely on compiled resources:

$ (cd dashboard/assets && ./node_modules/.bin/webpack --watch)
$ geth --dashboard --dashboard.assets=dashboard/assets/public --vmodule=dashboard=5

To bundle up the final UI into Geth, run webpack and go generate:

$ (cd dashboard/assets && ./node_modules/.bin/webpack)
$ go generate ./dashboard

Have fun

Webpack offers handy tools for visualizing the bundle's dependency tree and space usage.

  • Generate the bundle's profile running webpack --profile --json > stats.json
  • For the dependency tree go to Webpack Analyze, and import stats.json
  • For the space usage go to Webpack Visualizer, and import stats.json