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'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.
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
Webpack offers handy tools for visualizing the bundle's dependency tree and space usage.
webpack --profile --json > stats.json
stats.json
stats.json
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。