github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum@v0.0.0-20190121132951-92cc4225ed8e/cmd/puppeth/module_dashboard.go (about)

     1  
     2  //此源码被清华学神尹成大魔王专业翻译分析并修改
     3  //尹成QQ77025077
     4  //尹成微信18510341407
     5  //尹成所在QQ群721929980
     6  //尹成邮箱 yinc13@mails.tsinghua.edu.cn
     7  //尹成毕业于清华大学,微软区块链领域全球最有价值专家
     8  //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
     9  //版权所有2017 Go Ethereum作者
    10  //此文件是Go以太坊的一部分。
    11  //
    12  //Go以太坊是免费软件:您可以重新发布和/或修改它
    13  //根据GNU通用公共许可证的条款
    14  //自由软件基金会,或者许可证的第3版,或者
    15  //(由您选择)任何更高版本。
    16  //
    17  //Go以太坊的分布希望它会有用,
    18  //但没有任何保证;甚至没有
    19  //适销性或特定用途的适用性。见
    20  //GNU通用公共许可证了解更多详细信息。
    21  //
    22  //你应该已经收到一份GNU通用公共许可证的副本
    23  //一起去以太坊吧。如果没有,请参见<http://www.gnu.org/licenses/>。
    24  
    25  package main
    26  
    27  import (
    28  	"bytes"
    29  	"encoding/json"
    30  	"fmt"
    31  	"html/template"
    32  	"math/rand"
    33  	"path/filepath"
    34  	"strconv"
    35  	"strings"
    36  
    37  	"github.com/ethereum/go-ethereum/log"
    38  )
    39  
    40  //DashboardContent是当用户
    41  //加载仪表板网站。
    42  var dashboardContent = `
    43  <!DOCTYPE html>
    44  <html lang="en">
    45  	<head>
    46  		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    47  		<!-- Meta, title, CSS, favicons, etc. -->
    48  		<meta charset="utf-8">
    49  		<meta http-equiv="X-UA-Compatible" content="IE=edge">
    50  		<meta name="viewport" content="width=device-width, initial-scale=1">
    51  
    52  		<title>{{.NetworkTitle}}: Ethereum Testnet</title>
    53  
    54  <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter引导程序/3.3.7/css/bootstrap.min.css“rel=”stylesheet“>
    55  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awome/4.7.0/css/font-awome.min.css“rel=”stylesheet“>
    56  <link href="https://cdnjs.cloudflare.com/ajax/libs/gentelella/1.3.0/css/custom.min.css“rel=”stylesheet“>
    57  		<style>
    58  			.vertical-center {
    59  				min-height: 100%;
    60  				min-height: 95vh;
    61  				display: flex;
    62  				align-items: center;
    63  			}
    64  			.nav.side-menu li a {
    65  				font-size: 18px;
    66  			}
    67  			.nav-sm .nav.side-menu li a {
    68  				font-size: 10px;
    69  			}
    70  			pre{
    71  				white-space: pre-wrap;
    72  			}
    73  		</style>
    74  	</head>
    75  
    76  	<body class="nav-sm" style="overflow-x: hidden">
    77  		<div class="container body">
    78  			<div class="main_container">
    79  				<div class="col-md-3 left_col">
    80  					<div class="left_col scroll-view">
    81  						<div class="navbar nav_title" style="border: 0; margin-top: 8px;">
    82  							<a class="site_title"><i class="fa fa-globe" style="margin-left: 6px"></i> <span>{{.NetworkTitle}} Testnet</span></a>
    83  						</div>
    84  						<div class="clearfix"></div>
    85  						<br />
    86  						<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
    87  							<div class="menu_section">
    88  								<ul class="nav side-menu">
    89  									{{if .EthstatsPage}}<li id="stats_menu"><a onclick="load('#stats')"><i class="fa fa-tachometer"></i> Network Stats</a></li>{{end}}
    90  									{{if .ExplorerPage}}<li id="explorer_menu"><a onclick="load('#explorer')"><i class="fa fa-database"></i> Block Explorer</a></li>{{end}}
    91  									{{if .WalletPage}}<li id="wallet_menu"><a onclick="load('#wallet')"><i class="fa fa-address-book-o"></i> Browser Wallet</a></li>{{end}}
    92  									{{if .FaucetPage}}<li id="faucet_menu"><a onclick="load('#faucet')"><i class="fa fa-bath"></i> Crypto Faucet</a></li>{{end}}
    93  									<li id="connect_menu"><a><i class="fa fa-plug"></i> Connect Yourself</a>
    94  										<ul id="connect_list" class="nav child_menu">
    95  											<li><a onclick="$('#connect_menu').removeClass('active'); $('#connect_list').toggle(); load('#geth')">Go Ethereum: Geth</a></li>
    96  											<li><a onclick="$('#connect_menu').removeClass('active'); $('#connect_list').toggle(); load('#mist')">Go Ethereum: Wallet & Mist</a></li>
    97  											<li><a onclick="$('#connect_menu').removeClass('active'); $('#connect_list').toggle(); load('#mobile')">Go Ethereum: Android & iOS</a></li>{{if .Ethash}}
    98  											<li><a onclick="$('#connect_menu').removeClass('active'); $('#connect_list').toggle(); load('#other')">Other Ethereum Clients</a></li>{{end}}
    99  										</ul>
   100  									</li>
   101  									<li id="about_menu"><a onclick="load('#about')"><i class="fa fa-heartbeat"></i> About Puppeth</a></li>
   102  								</ul>
   103  							</div>
   104  						</div>
   105  					</div>
   106  				</div>
   107  				<div class="right_col" role="main" style="padding: 0 !important">
   108  					<div id="geth" hidden style="padding: 16px;">
   109  						<div class="page-title">
   110  							<div class="title_left">
   111  								<h3>Connect Yourself &ndash; Go Ethereum: Geth</h3>
   112  							</div>
   113  						</div>
   114  						<div class="clearfix"></div>
   115  						<div class="row">
   116  							<div class="col-md-6">
   117  								<div class="x_panel">
   118  									<div class="x_title">
   119  										<h2><i class="fa fa-archive" aria-hidden="true"></i> Archive node <small>Retains all historical data</small></h2>
   120  										<div class="clearfix"></div>
   121  									</div>
   122  									<div class="x_content">
   123  										<p>An archive node synchronizes the blockchain by downloading the full chain from the genesis block to the current head block, executing all the transactions contained within. As the node crunches through the transactions, all past historical state is stored on disk, and can be queried for each and every block.</p>
   124  										<p>Initial processing required to execute all transactions may require non-negligible time and disk capacity required to store all past state may be non-insignificant. High end machines with SSD storage, modern CPUs and 8GB+ RAM are recommended.</p>
   125  										<br/>
   126  										<p>To run an archive node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
   127  											<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
   128  											<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=1024 --syncmode=full{{if .Ethstats}} --ethstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesFlat}}</pre>
   129  										</p>
   130  										<br/>
   131  <p>You can download Geth from <a href="https://geth.ethereum.org/downloads/“target=”about:blank“>https://geth.ethereum.org/downloads/>a><p>
   132  									</div>
   133  								</div>
   134  							</div>
   135  							<div class="col-md-6">
   136  								<div class="x_panel">
   137  									<div class="x_title">
   138  										<h2><i class="fa fa-laptop" aria-hidden="true"></i> Full node <small>Retains recent data only</small></h2>
   139  										<div class="clearfix"></div>
   140  									</div>
   141  									<div class="x_content">
   142  										<p>A full node synchronizes the blockchain by downloading the full chain from the genesis block to the current head block, but does not execute the transactions. Instead, it downloads all the transactions receipts along with the entire recent state. As the node downloads the recent state directly, historical data can only be queried from that block onward.</p>
   143  										<p>Initial processing required to synchronize is more bandwidth intensive, but is light on the CPU and has significantly reduced disk requirements. Mid range machines with HDD storage, decent CPUs and 4GB+ RAM should be enough.</p>
   144  										<br/>
   145  										<p>To run a full node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
   146  											<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
   147  											<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=512{{if .Ethstats}} --ethstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesFlat}}</pre>
   148  										</p>
   149  										<br/>
   150  <p>You can download Geth from <a href="https://geth.ethereum.org/downloads/“target=”about:blank“>https://geth.ethereum.org/downloads/>a><p>
   151  									</div>
   152  								</div>
   153  							</div>
   154  						</div>
   155  						<div class="clearfix"></div>
   156  						<div class="row">
   157  							<div class="col-md-6">
   158  								<div class="x_panel">
   159  									<div class="x_title">
   160  										<h2><i class="fa fa-mobile" aria-hidden="true"></i> Light node <small>Retrieves data on demand</small></h2>
   161  										<div class="clearfix"></div>
   162  									</div>
   163  									<div class="x_content">
   164  										<p>A light node synchronizes the blockchain by downloading and verifying only the chain of headers from the genesis block to the current head, without executing any transactions or retrieving any associated state. As no state is available locally, any interaction with the blockchain relies on on-demand data retrievals from remote nodes.</p>
   165  										<p>Initial processing required to synchronize is light, as it only verifies the validity of the headers; similarly required disk capacity is small, tallying around 500 bytes per header. Low end machines with arbitrary storage, weak CPUs and 512MB+ RAM should cope well.</p>
   166  										<br/>
   167  										<p>To run a light node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
   168  											<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
   169  											<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --syncmode=light{{if .Ethstats}} --ethstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesFlat}}</pre>
   170  										</p>
   171  										<br/>
   172  <p>You can download Geth from <a href="https://geth.ethereum.org/downloads/“target=”about:blank“>https://geth.ethereum.org/downloads/>a><p>
   173  									</div>
   174  								</div>
   175  							</div>
   176  							<div class="col-md-6">
   177  								<div class="x_panel">
   178  									<div class="x_title">
   179  										<h2><i class="fa fa-microchip" aria-hidden="true"></i> Embedded node <small>Conserves memory vs. speed</small></h2>
   180  										<div class="clearfix"></div>
   181  									</div>
   182  									<div class="x_content">
   183  										<p>An embedded node is a variation of the light node with configuration parameters tuned towards low memory footprint. As such, it may sacrifice processing and disk IO performance to conserve memory. It should be considered an <strong>experimental</strong> direction for now without hard guarantees or bounds on the resources used.</p>
   184  										<p>Initial processing required to synchronize is light, as it only verifies the validity of the headers; similarly required disk capacity is small, tallying around 500 bytes per header. Embedded machines with arbitrary storage, low power CPUs and 128MB+ RAM may work.</p>
   185  										<br/>
   186  										<p>To run an embedded node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
   187  											<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
   188  											<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=16 --ethash.cachesinmem=1 --syncmode=light{{if .Ethstats}} --ethstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesFlat}}</pre>
   189  										</p>
   190  										<br/>
   191  <p>You can download Geth from <a href="https://geth.ethereum.org/downloads/“target=”about:blank“>https://geth.ethereum.org/downloads/>a><p>
   192  									</div>
   193  								</div>
   194  							</div>
   195  						</div>
   196  					</div>
   197  					<div id="mist" hidden style="padding: 16px;">
   198  						<div class="page-title">
   199  							<div class="title_left">
   200  								<h3>Connect Yourself &ndash; Go Ethereum: Wallet &amp; Mist</h3>
   201  							</div>
   202  						</div>
   203  						<div class="clearfix"></div>
   204  						<div class="row">
   205  							<div class="col-md-6">
   206  								<div class="x_panel">
   207  									<div class="x_title">
   208  										<h2><i class="fa fa-credit-card" aria-hidden="true"></i> Desktop wallet <small>Interacts with accounts and contracts</small></h2>
   209  										<div class="clearfix"></div>
   210  									</div>
   211  									<div class="x_content">
   212  <p>The Ethereum Wallet is an <a href="https://electron.atom.io/“target=”about:blank“>electron.>based desktop application to manage your ethereum accounts and funds.除了您希望执行的常规帐户生命周期操作外,钱包还提供了一种从您的帐户发送交易并与部署在网络上的智能合约进行交互的方法。<p>
   213  										<p>Under the hood the wallet is backed by a go-ethereum full node, meaning that a mid range machine is assumed. Similarly, synchronization is based on <strong>fast-sync</strong>, which will download all blockchain data from the network and make it available to the wallet. Light nodes cannot currently fully back the wallet, but it's a target actively pursued.</p>
   214  										<br/>
   215  										<p>To connect with the Ethereum Wallet, you'll need to initialize your private network first via Geth as the wallet does not currently support calling Geth directly. To initialize your local chain, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and run:
   216  											<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
   217  										</p>
   218  										<p>With your local chain initialized, you can start the Ethereum Wallet:
   219  											<pre>ethereumwallet --rpc $HOME/.{{.Network}}/geth.ipc --node-networkid={{.NetworkID}} --node-datadir=$HOME/.{{.Network}}{{if .Ethstats}} --node-ethstats='{{.Ethstats}}'{{end}} --node-bootnodes={{.BootnodesFlat}}</pre>
   220  										<p>
   221  										<br/>
   222  <p>You can download the Ethereum Wallet from <a href="https://github.com/ethereum/mist/releases“target=”about:blank“>https://github.com/ethereum/mist/releases</a>。
   223  									</div>
   224  								</div>
   225  							</div>
   226  							<div class="col-md-6">
   227  								<div class="x_panel">
   228  									<div class="x_title">
   229  										<h2><i class="fa fa-picture-o" aria-hidden="true"></i> Mist browser <small>Interacts with third party DApps</small></h2>
   230  										<div class="clearfix"></div>
   231  									</div>
   232  									<div class="x_content">
   233  <p>The Mist browser is an <a href="https://electron.atom.io/“target=”about:blank“>electron.>based desktop application to load and interaction with ethereum-enabled third party web dapp.除了以太坊钱包提供的所有功能外,MIST是一个扩展的Web浏览器,其中加载的页面可以通过web3.js提供商访问以太坊网络,还可以与用户自己的帐户交互(给予适当的授权和确认)。<p>
   234  										<p>Under the hood the browser is backed by a go-ethereum full node, meaning that a mid range machine is assumed. Similarly, synchronization is based on <strong>fast-sync</strong>, which will download all blockchain data from the network and make it available to the wallet. Light nodes cannot currently fully back the wallet, but it's a target actively pursued.</p>
   235  										<br/>
   236  										<p>To connect with the Mist browser, you'll need to initialize your private network first via Geth as Mist does not currently support calling Geth directly. To initialize your local chain, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and run:
   237  											<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
   238  										</p>
   239  										<p>With your local chain initialized, you can start Mist:
   240  											<pre>mist --rpc $HOME/.{{.Network}}/geth.ipc --node-networkid={{.NetworkID}} --node-datadir=$HOME/.{{.Network}}{{if .Ethstats}} --node-ethstats='{{.Ethstats}}'{{end}} --node-bootnodes={{.BootnodesFlat}}</pre>
   241  										<p>
   242  										<br/>
   243  <p>You can download the Mist browser from <a href="https://github.com/ethereum/mist/releases“target=”about:blank“>https://github.com/ethereum/mist/releases</a>。
   244  									</div>
   245  								</div>
   246  							</div>
   247  						</div>
   248  					</div>
   249  					<div id="mobile" hidden style="padding: 16px;">
   250  						<div class="page-title">
   251  							<div class="title_left">
   252  								<h3>Connect Yourself &ndash; Go Ethereum: Android &amp; iOS</h3>
   253  							</div>
   254  						</div>
   255  						<div class="clearfix"></div>
   256  						<div class="row">
   257  							<div class="col-md-6">
   258  								<div class="x_panel">
   259  									<div class="x_title">
   260  										<h2><i class="fa fa-android" aria-hidden="true"></i> Android devices <small>Accesses Ethereum via Java</small></h2>
   261  										<div class="clearfix"></div>
   262  									</div>
   263  									<div class="x_content">
   264  										<p>Starting with the 1.5 release of go-ethereum, we've transitioned away from shipping only full blown Ethereum clients and started focusing on releasing the code as reusable packages initially for Go projects, then later for Java based Android projects too. Mobile support is still evolving, hence is bound to change often and hard, but the Ethereum network can nonetheless be accessed from Android too.</p>
   265  										<p>Under the hood the Android library is backed by a go-ethereum light node, meaning that given a not-too-old Android device, you should be able to join the network without significant issues. Certain functionality is not yet available and rough edges are bound to appear here and there, please report issues if you find any.</p>
   266  										<br/>
   267  <p>The stable Android archives are distributed via Maven Central, and the develop snapshots via the Sonatype repositories. Before proceeding, please ensure you have a recent version configured in your Android project. You can find details in <a href="https://github.com/ethereum/go ethereum/wiki/mobile:-简介android archive“target=”about:blank“>mobile:introduction&ndash;android archive</a>。
   268  										<p>Before connecting to the Ethereum network, download the <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> genesis json file and either store it in your Android project as a resource file you can access, or save it as a string in a variable. You're going to need to to initialize your client.</p>
   269  										<p>Inside your Java code you can now import the geth archive and connect to Ethereum:
   270  											<pre>import org.ethereum.geth.*;</pre>
   271  <pre>
   272  Enodes bootnodes = new Enodes();{{range .Bootnodes}}
   273  bootnodes.append(new Enode("{{.}}"));{{end}}
   274  
   275  NodeConfig config = new NodeConfig();
   276  config.setBootstrapNodes(bootnodes);
   277  config.setEthereumNetworkID({{.NetworkID}});
   278  config.setEthereumGenesis(genesis);{{if .Ethstats}}
   279  config.setEthereumNetStats("{{.Ethstats}}");{{end}}
   280  
   281  Node node = new Node(getFilesDir() + "/.{{.Network}}", config);
   282  node.start();
   283  </pre>
   284  										<p>
   285  									</div>
   286  								</div>
   287  							</div>
   288  							<div class="col-md-6">
   289  								<div class="x_panel">
   290  									<div class="x_title">
   291  										<h2><i class="fa fa-apple" aria-hidden="true"></i> iOS devices <small>Accesses Ethereum via ObjC/Swift</small></h2>
   292  										<div class="clearfix"></div>
   293  									</div>
   294  									<div class="x_content">
   295  										<p>Starting with the 1.5 release of go-ethereum, we've transitioned away from shipping only full blown Ethereum clients and started focusing on releasing the code as reusable packages initially for Go projects, then later for ObjC/Swift based iOS projects too. Mobile support is still evolving, hence is bound to change often and hard, but the Ethereum network can nonetheless be accessed from iOS too.</p>
   296  										<p>Under the hood the iOS library is backed by a go-ethereum light node, meaning that given a not-too-old Apple device, you should be able to join the network without significant issues. Certain functionality is not yet available and rough edges are bound to appear here and there, please report issues if you find any.</p>
   297  										<br/>
   298  <p>Both stable and develop builds of the iOS framework are available via CocoaPods. Before proceeding, please ensure you have a recent version configured in your iOS project. You can find details in <a href="https://github.com/ethereum/go-ethereum/wiki/mobile:-简介ios framework“target=”about:blank“>mobile:introduction&ndash;ios framework</a>。
   299  										<p>Before connecting to the Ethereum network, download the <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> genesis json file and either store it in your iOS project as a resource file you can access, or save it as a string in a variable. You're going to need to to initialize your client.</p>
   300  										<p>Inside your Swift code you can now import the geth framework and connect to Ethereum (ObjC should be analogous):
   301  											<pre>import Geth</pre>
   302  <pre>
   303  var error: NSError?
   304  
   305  let bootnodes = GethNewEnodesEmpty(){{range .Bootnodes}}
   306  bootnodes?.append(GethNewEnode("{{.}}", &error)){{end}}
   307  
   308  let config = GethNewNodeConfig()
   309  config?.setBootstrapNodes(bootnodes)
   310  config?.setEthereumNetworkID({{.NetworkID}})
   311  config?.setEthereumGenesis(genesis){{if .Ethstats}}
   312  config?.setEthereumNetStats("{{.Ethstats}}"){{end}}
   313  
   314  let datadir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
   315  let node = GethNewNode(datadir + "/.{{.Network}}", config, &error);
   316  try! node?.start();
   317  </pre>
   318  										<p>
   319  									</div>
   320  								</div>
   321  							</div>
   322  						</div>
   323  					</div>{{if .Ethash}}
   324  					<div id="other" hidden style="padding: 16px;">
   325  						<div class="page-title">
   326  							<div class="title_left">
   327  								<h3>Connect Yourself &ndash; Other Ethereum Clients</h3>
   328  							</div>
   329  						</div>
   330  						<div class="clearfix"></div>
   331  						<div class="row">
   332  							<div class="col-md-6">
   333  								<div class="x_panel">
   334  									<div class="x_title">
   335  										<h2>
   336  <svg height="14px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 115 115"><path fill="#5C8DBC" d="M9.7 83.3V35.5s0-3.4 3.3-5.2c3.3-1.8 39.6-23.5 39.6-23.5s4.6-3.1 9.4 0c0 0 43.1 23.9 42.4 25.3L85.3 43.3s-3.6-8.4-13.1-13c-11.3-5.5-29.7-6.2-42.9 13.3 0 0-8.6 13.5.3 31.6l-19 10.7s-.9-.6-.9-2.6z"/><path fill="#5C8DBC" d="M71 51.3c-2.8-4.7-7.9-7.9-13.8-7.9-8.8 0-16 7.2-16 16 0 2.8.7 5.4 2 7.7L71 51.3z"/><path fill="#194674" d="M43.1 67c2.8 4.7 7.9 7.9 13.8 7.9 8.8 0 16-7.2 16-16 0-2.8-.7-5.4-2-7.7L43.1 67z"/><path fill="#1B598E" d="M104.4 32.1s1.3 52.6-.3 53.6L58 58.6l46.4-26.5z"/><path fill="#FFF" d="M90 57h-3.9v-4.1h-4.2V57h-4v4.1h4V65h4.2v-3.9H90zm13.6 0h-3.9v-4.1h-4.2V57h-4v4.1h4V65h4.2v-3.9h3.9z"/><path fill="#194674" d=“M29.5 75.1s9.2 17 28.5 16.1 27.3-16.6 27.3-16.6l104 85.4s4.1.8-41.6 25.7c0-4.9 3.3-10.2 0 0 0-41.3-23.1-41.6-25.3l18.9-10.7z”/></svg>
   337  											C++ Ethereum <small>Official C++ client from the Ethereum Foundation</small>
   338  										</h2>
   339  										<div class="clearfix"></div>
   340  									</div>
   341  									<div class="x_content">
   342  										<p>C++ Ethereum is the third most popular of the Ethereum clients, focusing on code portability to a broad range of operating systems and hardware. The client is currently a full node with transaction processing based synchronization.</p>
   343  										<br/>
   344  										<p>To run a cpp-ethereum node, download <a href="/{{.CppGenesis}}"><code>{{.CppGenesis}}</code></a> and start the node with:
   345  											<pre>eth --config {{.CppGenesis}} --datadir $HOME/.{{.Network}} --peerset "{{.CppBootnodes}}"</pre>
   346  										</p>
   347  										<br/>
   348  <p>You can find cpp-ethereum at <a href="https://github.com/ethereum/cpp ethereum/“target=”about:blank“>https://github.com/ethereum/cpp ethereum/>
   349  									</div>
   350  								</div>
   351  							</div>
   352  							<div class="col-md-6">
   353  								<div class="x_panel">
   354  									<div class="x_title">
   355  										<h2>
   356  <svg height="14px" version="1.1" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M46.42,13.07S24.51,18.54,35,30.6c3.09,3.55-.81,6.75-0.81,6.75s7.84-4,4.24-9.11C35,23.51,32.46,21.17,46.42,13.07ZM32.1,16.88C45.05,6.65,38.4,0,38.4,0c2.68,10.57-9.46,13.76-13.84,20.34-3,4.48,1.46,9.3,7.53,14.77C29.73,29.77,21.71,25.09,32.1,16.88Z" transform="translate(-8.4)" fill="#e57125"/><path d="M23.6,49.49c-9.84,2.75,6,8.43,18.51,3.06a23.06,23.06,0,0,1-3.52-1.72,36.62,36.62,0,0,1-13.25.56C21.16,50.92,23.6,49.49,23.6,49.49Zm17-5.36a51.7,51.7,0,0,1-17.1.82c-4.19-.43-1.45-2.46-1.45-2.46-10.84,3.6,6,7.68,21.18,3.25A7.59,7.59,0,0,1,40.62,44.13ZM51.55,54.68s1.81,1.49-2,2.64c-7.23,2.19-30.1,2.85-36.45.09-2.28-1,2-2.37,3.35-2.66a8.69,8.69,0,0,1,2.21-.25c-2.54-1.79-16.41,3.51-7,5C37.15,63.67,58.17,57.67,51.55,54.68ZM42.77,39.12a20.42,20.42,0,0,1,2.93-1.57s-4.83.86-9.65,1.27A87.37,87.37,0,0,1,20.66,39c-7.51-1,4.12-3.77,4.12-3.77A22,22,0,0,0,14.7,37.61C8.14,40.79,31,42.23,42.77,39.12Zm2.88,7.77a1,1,0,0,1-.24.31C61.44,43,55.54,32.35,47.88,35a2.19,2.19,0,0,0-1,.79,9,9,0,0,1,1.37-.37C52.1,34.66,57.65,40.65,45.64,46.89zm0.43,14.75a94.76,94.76,0,0,1-29.17.45s1.47,1.22,9,1.7c11.53,0.74,29.22-.41,29.64-5.86c55.6,57.94,54.79,60,46.08,61.65z“transform=“translate(-8.4)”fill=“5482a2”/></svg>
   357  											Ethereum Harmony<small>Third party Java client from EtherCamp</small>
   358  										</h2>
   359  										<div class="clearfix"></div>
   360  									</div>
   361  									<div class="x_content">
   362  										<p>Ethereum Harmony is a web user-interface based graphical Ethereum client built on top of the EthereumJ Java implementation of the Ethereum protocol. The client currently is a full node with state download based synchronization.</p>
   363  										<br/>
   364  										<p>To run an Ethereum Harmony node, download <a href="/{{.HarmonyGenesis}}"><code>{{.HarmonyGenesis}}</code></a> and start the node with:
   365  											<pre>./gradlew runCustom -DgenesisFile={{.HarmonyGenesis}} -Dpeer.networkId={{.NetworkID}} -Ddatabase.dir=$HOME/.harmony/{{.Network}} {{.HarmonyBootnodes}} </pre>
   366  										</p>
   367  										<br/>
   368  <p>You can find Ethereum Harmony at <a href="https://github.com/ether-camp/ethereum-harmony/“target=”about:blank“>https://github.com/ether-camp/ethereum-harmony/<a>。
   369  									</div>
   370  								</div>
   371  							</div>
   372  						</div>
   373  						<div class="clearfix"></div>
   374  						<div class="row">
   375  							<div class="col-md-6">
   376  								<div class="x_panel">
   377  									<div class="x_title">
   378  										<h2>
   379  <svg height="14px" xmlns:dc="http://purl.org/dc/elements/1.1/“xmlns:cc=“http://creatvecommons.org/ns \35;”xmlns:rdf=“http://www.w3.org/1999/02/22/22 rdf sy语法ns \35;”xmlns:svg=“http://www.w3.org/2000/svg”xmlns=“http://www.w3.org/2000/svg”viewbox=“0 0 0 104.104.56749 104.56675”versi=“1.1”viewbox=“0 0 144 144 144 144 144”y=“0px”x=“0px”x“><metadata id=“metaetid=“metaeta id=“metaeta id=“metaeta id=“eta id=“metaeta.id data10“><rdf:rdf><cc:work rdf:about><dc:format>image/SVG+XML</dc:forma><dc:type RDf:resohttp://purl.org/dc/dcmittype/stillimage”/>-<cc:Work><RDf:RDf><元数据><defs id=“DefS8”/><路径style=“Filt:\35;676767;“id=“path2”d=“m 49.0125,12.3195 a 3.108 3.108,3.108 0 0 0 0 0 0 0 0/SVG+XML<DC:格式><DC:格式><DC:type RDf:type RDf:resohttp://www:resohttp://purl.org/drl.org/dc/dcmittype/ststill图像>MatMatMatMatMatMatMatMatMatMatMatMatMatMatMatMatMatMatMatMat0 1 6.216,0 3.108,3.108 0 0 1-6.216,0 m 74.153,0.145 a 3.108,3.108 0 0 1 6.216,0 3.108,3.108 0 0 1 -6.216,0 m -65.156,4.258 c 1.43,-0.635 2.076,-2.311 1.441,-3.744 l -1.379,-3.118 h 5.423 v 24.444 h -10.941 a 38.265,38.265 0 0 1 -1.239,-14.607 z m 22.685,0.601 v -7.205 h 12.914 c 0.667,0 4.71,0.771 4.71,3.794 0,2.51 -3.101,3.41 -5.651,3.41 z m -17.631,38.793 a 3.108,3.108 0 0 1 6.216,0 3.108,3.108 0 0 1 -6.216,0 m 46.051,0.145 a 3.108,3.108 0 0 1 6.216,0 3.108,3.108 0 0 1 -6.216,0 m 0.961,-7.048 c -1.531,-0.328 -3.037,0.646 -3.365,2.18 l -1.56,7.28 a 38.265,38.265 0 0 1 -31.911,-0.153 l -1.559,-7.28 c -0.328,-1.532 -1.834,-2.508 -3.364,-2.179 l -6.427,1.38 a 38.265,38.265 0 0 1 -3.323,-3.917 h 31.272 c 0.354,0 0.59,-0.064 0.59,-0.386 v -11.062 c 0,-0.322 -0.236,-0.386 -0.59,-0.386 h -9.146 v -7.012 h 9.892 c 0.903,0 4.828,0.258 6.083,5.275 0.393,1.543 1.256,6.562 1.846,8.169 0.588,1.802 2.982,5.402 5.533,5.402 h 16.146 a 38.265,38.265 0 0 1 -3.544,4.102 z m 17.365,-29.207 a 38.265,38.265 0 0 1 0.081,6.643 h -3.926 c -0.393,0 -0.551,0.258 -0.551,0.643 v 1.803 c 0,4.244 -2.393,5.167 -4.49,5.402 -1.997,0.225 -4.211,-0.836 -4.484,-2.058 -1.178,-6.626 -3.141,-8.041 -6.241,-10.486 3.847,-2.443 7.85,-6.047 7.85,-10.871 0,-5.209 -3.571,-8.49 -6.005,-10.099 -3.415,-2.251 -7.196,-2.702 -8.216,-2.702 h -40.603 a 38.265,38.265 0 0 1 21.408,-12.082 l 4.786,5.021 c 1.082,1.133 2.874,1.175 4.006,0.092 l 5.355,-5.122 a 38.265,38.265 0 0 1 26.196,18.657 l -3.666,8.28 c -0.633,1.433 0.013,3.109 1.442,3.744 z m 9.143,0.134 -0.125,-1.28 3.776,-3.522 c 0.768,-0.716 0.481,-2.157 -0.501,-2.523 l -4.827,-1.805 -0.378,-1.246 3.011,-4.182 c 0.614,-0.85 0.05,-2.207 -0.984,-2.377 l -5.09,-0.828 -0.612,-1.143 2.139,-4.695 c 0.438,-0.956 -0.376,-2.179 -1.428,-2.139 l -5.166,0.18 -0.816,-0.99 1.187,-5.032 c 0.24,-1.022 -0.797,-2.06 -1.819,-1.82 l -5.031,1.186 -0.992,-0.816 0.181,-5.166 c 0.04,-1.046 -1.184,-1.863 -2.138,-1.429 l -4.694,2.14 -1.143,-0.613 -0.83,-5.091 c -0.168,-1.032 -1.526,-1.596 -2.376,-0.984 l -4.185,3.011 -1.244,-0.377 -1.805,-4.828 c -0.366,-0.984 -1.808,-1.267 -2.522,-0.503 l -3.522,3.779 -1.28,-0.125 -2.72,-4.395 c -0.55,-0.89 -2.023,-0.89 -2.571,0 l -2.72,4.395 -1.281,0.125 -3.523,-3.779 c -0.714,-0.764 -2.156,-0.481 -2.522,0.503 l -1.805,4.828 -1.245,0.377 -4.184,-3.011 c -0.85,-0.614 -2.209,-0.048 -2.377,0.984 l -0.83,5.091 -1.143,0.613 -4.694,-2.14 c -0.954,-0.436 -2.178,0.383 -2.138,1.429 l 0.18,5.166 -0.992,0.816 -5.031,-1.186 c -1.022,-0.238 -2.06,0.798 -1.82,1.82 l 1.185,5.032 -0.814,0.99 -5.166,-0.18 c -1.042,-0.03 -1.863,1.183 -1.429,2.139 l 2.14,4.695 -0.613,1.143 -5.09,0.828 c -1.034,0.168 -1.594,1.527 -0.984,2.377 l 3.011,4.182 -0.378,1.246 -4.828,1.805 c -0.98,0.366 -1.267,1.807 -0.501,2.523 l 3.777,3.522 -0.125,1.28 -4.394,2.72 c -0.89,0.55 -0.89,2.023 0,2.571 l 4.394,2.72 0.125,1.28 -3.777,3.523 c -0.766,0.714 -0.479,2.154 0.501,2.522 l 4.828,1.805 0.378,1.246 -3.011,4.183 c -0.612,0.852 -0.049,2.21 0.985,2.376 l 5.089,0.828 0.613,1.145 -2.14,4.693 c -0.436,0.954 0.387,2.181 1.429,2.139 l 5.164,-0.181 0.816,0.992 -1.185,5.033 c -0.24,1.02 0.798,2.056 1.82,1.816 l 5.031,-1.185 0.992,0.814 -0.18,5.167 c -0.04,1.046 1.184,1.864 2.138,1.428 l 4.694,-2.139 1.143,0.613 0.83,5.088 c 0.168,1.036 1.527,1.596 2.377,0.986 l 4.182,-3.013 1.246,0.379 1.805,4.826 c 0.366,0.98 1.808,1.269 2.522,0.501 l 3.523,-3.777 1.281,0.128 2.72,4.394 c 0.548,0.886 2.021,0.888 2.571,0 l 2.72,-4.394 1.28,-0.128 3.522,3.777 c 0.714,0.768 2.156,0.479 2.522,-0.501 l 1.805,-4.826 1.246,-0.379 4.183,3.013 c 0.85,0.61 2.208,0.048 2.376,-0.986 l 0.83,-5.088 1.143,-0.613 4.694,2.139 c 0.954,0.436 2.176,-0.38 2.138,-1.428 l -0.18,-5.167 0.991,-0.814 5.031,1.185 c 1.022,0.24 2.059,-0.796 1.819,-1.816 l -1.185,-5.033 0.814,-0.992 5.166,0.181 c 1.042,0.042 1.866,-1.185 1.428,-2.139 l -2.139,-4.693 0.612,-1.145 5.09,-0.828 c 1.036,-0.166 1.598,-1.524 0.984,-2.376 L-3.011,-4.183 0.378,-1.246 4.827,-1.805 C 0.982,-0.368 1.269,-1.808 0.501,-2.522 L-3.776,-3.523 0.125,-1.28 4.394,-2.72 C 0.89,-0.548 0.891,-2.021 10E-4,-2.571 Z“/><svg>
   380  											Parity<small>Third party Rust client from Parity Technologies</small>
   381  										</h2>
   382  										<div class="clearfix"></div>
   383  									</div>
   384  									<div class="x_content">
   385  										<p>Parity is a fast, light and secure Ethereum client, supporting both headless mode of operation as well as a web user interface for direct manual interaction. The client is currently a full node with transaction processing based synchronization and state pruning enabled.</p>
   386  										<br/>
   387  										<p>To run a Parity node, download <a href="/{{.ParityGenesis}}"><code>{{.ParityGenesis}}</code></a> and start the node with:
   388  											<pre>parity --chain={{.ParityGenesis}}</pre>
   389  										</p>
   390  										<br/>
   391  <p>You can find Parity at <a href="https://parity.io/“target=”about:blank“>https://parity.io/<a><p>
   392  									</div>
   393  								</div>
   394  							</div>
   395  							<div class="col-md-6">
   396  								<div class="x_panel">
   397  									<div class="x_title">
   398  										<h2>
   399  <svg height="14px" version="1.1" role="img" xmlns="http://www.w3.org/2000/svg”viewbox=“0 0 64 64“><defs><lineargragenid id=“a”x1=“13.79”y1=“38.21”x2=“75.87”Y2=“-15.2”dididinttrans=“矩阵(0.56,0,0,-0.57,-8.96,23.53)”didientunits=“用户spaceONuse”><停止offs=“0 0 0 0 64 64 64 64 64“><Defs><Defs><lineargragragraradid id id id id id id id id id id id<lineargragragragragraradid id id id id id id id id id id=“38.28.21”x2=“75.21”Y2=“-15.2”didididididi半径id=“b”x1=“99.87”y1=“-47.53”x2="77.7" y2="-16.16" gradientTransform="matrix(0.56, 0, 0, -0.57, -8.96, 23.53)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffd43d"/><stop offset="1" stop-color="#fee875"/></linearGradient></defs><g><path d="M31.62,0a43.6,43.6,0,0,0-7.3.62c-6.46,1.14-7.63,3.53-7.63,7.94v5.82H32v1.94H11a9.53,9.53,0,0,0-9.54,7.74,28.54,28.54,0,0,0,0,15.52c1.09,4.52,3.68,7.74,8.11,7.74h5.25v-7a9.7,9.7,0,0,1,9.54-9.48H39.58a7.69,7.69,0,0,0,7.63-7.76V8.56c0-4.14-3.49-7.25-7.63-7.94A47.62,47.62,0,0,0,31.62,0ZM23.37,4.68A2.91,2.91,0,1,1,20.5,7.6,2.9,2.9,0,0,1,23.37,4.68Z" transform="translate(-0.35)" fill="url(#a)"/><path d="M49.12,16.32V23.1a9.79,9.79,0,0,1-9.54,9.68H24.33a7.79,7.79,0,0,0-7.63,7.76V55.08c0,4.14,3.6,6.57,7.63,7.76a25.55,25.55,0,0,0,15.25,0c3.84-1.11,7.63-3.35,7.63-7.76V49.26H32V47.32H54.85c4.44,0,6.09-3.1,7.63-7.74s1.53-9.38,0-15.52c-1.1-4.42-3.19-7.74-7.63-7.74H49.12ZM40.54,53.14A2.91,2.91,0,1,1,37.67,56,2.88,2.88,0,0,1,40.54,53.14Z" transform="translate(-0.35)" fill="url(#b)"/></g></svg>
   400  											PyEthApp<small>Official Python client from the Ethereum Foundation</small>
   401  										</h2>
   402  										<div class="clearfix"></div>
   403  									</div>
   404  									<div class="x_content">
   405  										<p>Pyethapp is the Ethereum Foundation's research client, aiming to provide an easily hackable and extendable codebase. The client is currently a full node with transaction processing based synchronization and state pruning enabled.</p>
   406  										<br/>
   407  										<p>To run a pyethapp node, download <a href="/{{.PythonGenesis}}"><code>{{.PythonGenesis}}</code></a> and start the node with:
   408  											<pre>mkdir -p $HOME/.config/pyethapp/{{.Network}}</pre>
   409  											<pre>pyethapp -c eth.genesis="$(cat {{.PythonGenesis}})" -c eth.network_id={{.NetworkID}} -c data_dir=$HOME/.config/pyethapp/{{.Network}} -c discovery.bootstrap_nodes="[{{.PythonBootnodes}}]" -c eth.block.HOMESTEAD_FORK_BLKNUM={{.Homestead}} -c eth.block.ANTI_DOS_FORK_BLKNUM={{.Tangerine}} -c eth.block.SPURIOUS_DRAGON_FORK_BLKNUM={{.Spurious}} -c eth.block.METROPOLIS_FORK_BLKNUM={{.Byzantium}} -c eth.block.DAO_FORK_BLKNUM=18446744073709551615 run --console</pre>
   410  										</p>
   411  										<br/>
   412  <p>You can find pyethapp at <a href="https://github.com/ethereum/pyethapp/“target=”about:blank“>https://github.com/ethereum/pyethapp/>
   413  									</div>
   414  								</div>
   415  							</div>
   416  						</div>
   417  					</div>{{end}}
   418  					<div id="about" hidden>
   419  						<div class="row vertical-center">
   420  							<div style="margin: 0 auto;">
   421  								<div class="x_panel">
   422  									<div class="x_title">
   423  										<h3>Puppeth &ndash; Your Ethereum private network manager</h3>
   424  										<div class="clearfix"></div>
   425  									</div>
   426  									<div style="display: inline-block; vertical-align: bottom; width: 623px; margin-top: 16px;">
   427  										<p>Puppeth is a tool to aid you in creating a new Ethereum network down to the genesis block, bootnodes, signers, ethstats server, crypto faucet, wallet browsers, block explorer, dashboard and more; without the hassle that it would normally entail to manually configure all these services one by one.</p>
   428  										<p>Puppeth uses ssh to dial in to remote servers, and builds its network components out of docker containers using docker-compose. The user is guided through the process via a command line wizard that does the heavy lifting and topology configuration automatically behind the scenes.</p>
   429  										<br/>
   430  <p>Puppeth is distributed as part of the <a href="https://geth.ethereum.org/downloads/“target=”about:blank“>geth&amp;tools</a>bundles,but can also be installed separally via:<pre>go get github.com/ethereum/go ethereum/cmd/puppeth</pre><p>
   431  										<br/>
   432  										<p><em>Copyright 2017. The go-ethereum Authors.</em></p>
   433  									</div>
   434  									<div style="display: inline-block; vertical-align: bottom; width: 217px;">
   435  										<img src="puppeth.png" style="height: 256px; margin: 16px 16px 16px 16px"></img>
   436  									</div>
   437  								</div>
   438  							</div>
   439  						</div>
   440  					</div>
   441  					<div id="frame-wrapper" hidden style="position: absolute; height: 100%;">
   442  						<iframe id="frame" style="position: absolute; width: 1920px; height: 100%; border: none;" onload="if ($(this).attr('src') != '') { resize(); $('#frame-wrapper').fadeIn(300); }"></iframe>
   443  					</div>
   444  				</div>
   445  			</div>
   446  		</div>
   447  
   448  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.0/jquery.min.js“>.<script>
   449  <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter bootstrap/3.3.7/js/bootstrap.min.js“><script>
   450  <script src="https://cdnjs.cloudflare.com/ajax/libs/gentelella/1.3.0/js/custom.min.js“>.<script>
   451  		<script>
   452  			var load = function(hash) {
   453  				window.location.hash = hash;
   454  
   455  //淡出所有可能的页面(是,难看,不,不在乎)
   456  				$("#geth").fadeOut(300)
   457  				$("#mist").fadeOut(300)
   458  				$("#mobile").fadeOut(300)
   459  				$("#other").fadeOut(300)
   460  				$("#about").fadeOut(300)
   461  				$("#frame-wrapper").fadeOut(300);
   462  
   463  //根据哈希值,将其解析为本地或远程URL
   464  				var url = hash;
   465  				switch (hash) {
   466  					case "#stats":
   467  url = "//.ethstattspage“;
   468  						break;
   469  					case "#explorer":
   470  url = "//.探险家页面“;
   471  						break;
   472  					case "#wallet":
   473  url = "//.walletpage“;
   474  						break;
   475  					case "#faucet":
   476  url = "//.水龙头页“;
   477  						break;
   478  				}
   479  				setTimeout(function() {
   480  					if (url.substring(0, 1) == "#") {
   481  						$('.body').css({overflowY: 'auto'});
   482  						$("#frame").attr("src", "");
   483  						$(url).fadeIn(300);
   484  					} else {
   485  						$('.body').css({overflowY: 'hidden'});
   486  						$("#frame").attr("src", url);
   487  					}
   488  				}, 300);
   489  			}
   490  			var resize = function() {
   491  				var sidebar = $($(".navbar")[0]).width();
   492  				var limit   = document.body.clientWidth - sidebar;
   493  				var scale   = limit / 1920;
   494  
   495  				$("#frame-wrapper").width(limit);
   496  				$("#frame-wrapper").height(document.body.clientHeight / scale);
   497  				$("#frame-wrapper").css({
   498  					transform: 'scale(' + (scale) + ')',
   499  					transformOrigin: "0 0"
   500  				});
   501  			};
   502  			$(window).resize(resize);
   503  
   504  			if (window.location.hash == "") {
   505  				var item = $(".side-menu").children()[0];
   506  				$(item).children()[0].click();
   507  				$(item).addClass("active");
   508  			} else {
   509  				load(window.location.hash);
   510  				var menu = $(window.location.hash + "_menu");
   511  				if (menu !== undefined) {
   512  					$(menu).addClass("active");
   513  				}
   514  			}
   515  		</script>
   516  	</body>
   517  </html>
   518  `
   519  
   520  //DashboardMascot是要在Dashboard About页面上显示的吉祥物的PNG转储。
   521  //诺林:拼写错误
   522  /*
   523  
   524  //DashboardDockerfile是构建仪表板容器所需的Dockerfile
   525  //在一个易于访问的页面下聚合各种专用网络服务。
   526  var dashboardDockerfile=`
   527  来自mhart/alpine节点:最新
   528  
   529  运行
   530   NPM安装连接服务静态
   531   \
   532   echo'var connect=require(“connect”);'>server.js&&\
   533   echo'var serve static=require(“服务静态”);'>>server.js&&\
   534   echo'connect()。使用(servestatic(“/dashboard”)).listen(80,function()'>>server.js&&\
   535   echo'console.log(“服务器运行于80…”);'>>server.js&&\
   536   echo')';'>>server.js
   537  
   538  添加.network.json/dashboard/.network.json
   539  添加.network-cpp.json/dashboard/.network-cpp.json
   540  添加.network-harmony.json/dashboard/.network-harmony.json
   541  添加.network-parity.json/dashboard/.network-parity.json
   542  添加.network-python.json/dashboard/.network-python.json
   543  添加index.html/dashboard/index.html
   544  添加puppeth.png/dashboard/puppeth.png
   545  
   546  揭发80
   547  
   548  命令[“node”,“/server.js”]
   549  `
   550  
   551  //DashboardComposeFile是部署和
   552  //维护服务聚合仪表板。
   553  var DashboardComposeFile=`
   554  版本:“2”
   555  服务:
   556    仪表板:
   557      建筑:
   558      图片:.network/dashboard如果不是.vhost
   559      端口:
   560        -“.端口:80”结束
   561      环境:
   562        -ethstats_page=.ethstats page
   563        -资源管理器页面=.资源管理器页面
   564        -钱包.钱包
   565        -水龙头页面.水龙头页面如果.vhost
   566        -虚拟主机=.vhost结束
   567      登录中:
   568        驱动程序:“json文件”
   569        选项:
   570          最大尺寸:“1m”
   571          MAX文件:“10”
   572      重新启动:总是
   573  `
   574  
   575  //deploydashboard通过ssh将新的仪表板容器部署到远程计算机,
   576  //docker和docker compose。如果具有指定网络名称的实例
   577  //已经存在,将被覆盖!
   578  func deploydashboard(client*sshclient,network string,conf*config,config*dashboardinfos,nocache bool)([]字节,错误)
   579   //生成上传到服务器的内容
   580   工作目录:=fmt.sprintf(“%d”,rand.int63())
   581   文件:=make(map[string][]byte)
   582  
   583   dockerfile:=新建(bytes.buffer)
   584   template.must(template.new(“”).parse(dashboardDockerfile)).execute(dockerfile,map[string]接口
   585    
   586   })
   587   files[filepath.join(workdir,“dockerfile”)]=dockerfile.bytes())
   588  
   589   composeFile:=新建(bytes.buffer)
   590   template.must(template.new(“”).parse(dashboardcomposefile)).execute(composefile,map[string]接口
   591    “Network”:网络,
   592    “端口”:配置端口,
   593    “vhost”:配置主机,
   594    “ethstatspage”:config.ethstats,
   595    “Explorer页面”:config.explorer,
   596    “walletpage”:config.wallet,
   597    “水龙头页面”:配置水龙头,
   598   })
   599   files[filepath.join(workdir,“docker compose.yaml”)]=composefile.bytes()
   600  
   601   statsLogin:=fmt.sprintf(“yournode:%s”,conf.ethstats)
   602   如果!config.trusted_
   603    状态标语=“”
   604   }
   605   索引文件:=新建(bytes.buffer)
   606   bootcpp:=make([]string,len(conf.bootnodes))。
   607   对于i,boot:=range conf.bootnodes_
   608    bootcpp[i]=“必需:”+strings.trimPrefix(boot,“enode://”)
   609   }
   610   bootsharmony:=make([]string,len(conf.bootnodes))。
   611   对于i,boot:=range conf.bootnodes_
   612    bootsharmony[i]=fmt.sprintf(“-dpeer.active.%d.url=%s”,i,boot)
   613   }
   614   bootphython:=make([]string,len(conf.bootnodes))。
   615   对于i,boot:=range conf.bootnodes_
   616    bootphython[i]=“'”+boot+“'”
   617   }
   618   template.must(template.new(“”).parse(dashboardContent)).execute(indexfile,map[string]接口
   619    “Network”:网络,
   620    “networkid”:conf.genesis.config.chainid,
   621    “NetworkTitle”:strings.title(网络),
   622    “ethstatspage”:config.ethstats,
   623    “Explorer页面”:config.explorer,
   624    “walletpage”:config.wallet,
   625    “水龙头页面”:配置水龙头,
   626    “gethgenesis”:网络+“.json”,
   627    “bootnodes”:conf.bootnodes,
   628    “bootnodesflat”:strings.join(conf.bootnodes,”,“),
   629    “ethstats”:状态登录,
   630    “ethash”:conf.genesis.config.ethash!=零,
   631    “cppGenesis”:network+“-cpp.json”,
   632    “cppbootnodes”:strings.join(bootcp,”“),
   633    “伤害发生”:network+“-harmony.json”,
   634    “harmonybootnodes”:strings.join(bootcharmony,”“),
   635    “paritygenesis”:network+“-parity.json”,
   636    “pythongenesis”:network+“-python.json”,
   637    “pythonbootnodes”:strings.join(bootphython,”,“),
   638    “宅基地”:conf.genesis.config.homesteadblock,
   639    “橘子”:conf.genesis.config.eip150 block,
   640    “假”:conf.genesis.config.eip155block,
   641    “拜占庭”:conf.genesis.config.byzantiumblock,
   642    “君士坦丁堡”:conf.genesis.config.constantinopleblock,
   643   })
   644   文件[filepath.join(workdir,“index.html”)]=indexfile.bytes()
   645  
   646   //为go-ethereum和所有其他客户机整理genesis spec文件
   647   Genesis,=conf.genesis.marshaljson()。
   648   文件[filepath.join(workdir,network+“.json”)]=genesis
   649  
   650   如果是conf.genesis.config.ethash!= nIL{
   651    cppspec,err:=newcppetereumgeneisspec(网络,conf.genesis)
   652    如果犯错!= nIL{
   653     返回零
   654    }
   655    cppspec json,:=json.marshal(cppspec)
   656    文件[filepath.join(workdir,network+“-cpp.json”)]=cppspecjson
   657  
   658    harmonyspecjson,:=conf.genesis.marshaljson()。
   659    文件[filepath.join(workdir,network+“-harmony.json”)]=harmonyspecjson
   660  
   661    parityspec,err:=newparitychainspec(网络,conf.genesis,conf.bootnodes)
   662    如果犯错!= nIL{
   663     返回零
   664    }
   665    parityspec json,:=json.marshal(parityspec)
   666    文件[filepath.join(workdir,network+“-parity.json”)]=parityspecjson
   667  
   668    pyethspec,err:=newpyethereumgeneisspec(网络,conf.genesis)
   669    如果犯错!= nIL{
   670     返回零
   671    }
   672    pyethspec json,:=json.marshal(pyethspec)
   673    文件[filepath.join(workdir,network+“-python.json”)]=pyethspejson
   674   }否则{
   675    对于u,客户机:=range[]string“cpp”、“harmony”、“parity”、“python”
   676     文件[filepath.join(workdir,network+“-”+client+“.json”)]=[]byte
   677    }
   678   }
   679   files[filepath.join(workdir,“puppeth.png”)]=仪表板吉祥物
   680  
   681   //将部署文件上传到远程服务器(然后清理)
   682   如果退出,则错误:=client.upload(文件);错误!= nIL{
   683    返回,错误
   684   }
   685   延迟client.run(“rm-rf”+workdir)
   686  
   687   //构建和部署仪表板服务
   688   如果NoCy缓存{
   689    返回nil,client.stream(fmt.sprintf(“cd%s&&docker compose-p%s build--pull--无缓存和docker compose-p%s up-d--强制重新创建--超时60”,workdir,network,network)
   690   }
   691   返回nil,client.stream(fmt.sprintf(“cd%s&&docker compose-p%s up-d--build--force recreate--timeout 60”,workdir,network))。
   692  }
   693  
   694  //仪表板信息从仪表板状态检查返回以允许报告
   695  //各种配置参数。
   696  类型仪表盘信息结构
   697   主机字符串
   698   端口int
   699   可信布尔
   700  
   701   埃斯塔斯弦
   702   资源管理器字符串
   703   钱包串
   704   水龙头串
   705  }
   706  
   707  //报表将类型化结构转换为纯字符串->字符串映射,其中包含
   708  //大多数(但不是全部)字段用于向用户报告。
   709  func(info*dashboardinfos)report()映射[string]string_
   710   返回映射[string]string_
   711    “网址”:info.host,
   712    “网站侦听器端口”:strconv.itoa(info.port),
   713    “ethstats服务”:info.ethstats,
   714    “资源管理器服务”:info.explorer,
   715    “钱包服务”:info.wallet,
   716    “水龙头服务”:信息水龙头,
   717   }
   718  }
   719  
   720  //checkDashboard对Dashboard容器执行运行状况检查,以验证
   721  //正在运行,如果是,则收集有关它的有用信息集合。
   722  func checkdashboard(客户端*sshclient,网络字符串)(*仪表盘信息,错误)
   723   //检查主机上可能的ethstats容器
   724   
   725   如果犯错!= nIL{
   726    返回零
   727   }
   728   如果!信息运行
   729    返回nil,errserviceOffline
   730   }
   731   //从主机或反向代理解析端口
   732   端口:=infos.portmap[“80/tcp”]
   733   如果端口=0 {
   734    如果是proxy,:=checknginx(客户机、网络);proxy!= nIL{
   735     端口=proxy.port
   736    }
   737   }
   738   如果端口=0 {
   739    返回零,errnotexposed
   740   }
   741   //从反向代理解析主机并配置连接字符串
   742   主机:=infos.envvars[“虚拟主机”]
   743   如果主机= =“”{
   744    主机=client.server
   745   }
   746   //运行健全性检查以查看端口是否可访问
   747   如果err=checkport(主机、端口);err!= nIL{
   748    log.warn(“仪表板服务似乎无法访问”,“服务器”,“主机”,“端口”,“端口”,“错误”,err)
   749   }
   750   //容器可用,组装并返回有用的信息
   751   退货和仪表盘信息
   752    宿主:宿主,
   753    端口:
   754    ethstats:infos.envvars[“ethstats_page”],
   755    explorer:infos.envvars[“explorer_page”],
   756    电子钱包:infos.envvars[“电子钱包页面”],
   757    水龙头:infos.envvars[“水龙头页面”],
   758   },nIL
   759  }