github.com/ethxdao/go-ethereum@v0.0.0-20221218102228-5ae34a9cc189/cmd/checkpoint-admin/main.go (about) 1 // Copyright 2019 The go-ethereum Authors 2 // This file is part of go-ethereum. 3 // 4 // go-ethereum is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // go-ethereum is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. 16 17 // checkpoint-admin is a utility that can be used to query checkpoint information 18 // and register stable checkpoints into an oracle contract. 19 package main 20 21 import ( 22 "fmt" 23 "os" 24 25 "github.com/ethxdao/go-ethereum/common/fdlimit" 26 "github.com/ethxdao/go-ethereum/internal/flags" 27 "github.com/ethxdao/go-ethereum/log" 28 ) 29 30 var ( 31 // Git SHA1 commit hash of the release (set via linker flags) 32 gitCommit = "" 33 gitDate = "" 34 35 app *cli.App 36 ) 37 38 func init() { 39 app = flags.NewApp(gitCommit, gitDate, "ethereum checkpoint helper tool") 40 app.Commands = []*cli.Command{ 41 commandStatus, 42 commandDeploy, 43 commandSign, 44 commandPublish, 45 } 46 app.Flags = []cli.Flag{ 47 oracleFlag, 48 nodeURLFlag, 49 } 50 } 51 52 // Commonly used command line flags. 53 var ( 54 indexFlag = &cli.Int64Flag{ 55 Name: "index", 56 Usage: "Checkpoint index (query latest from remote node if not specified)", 57 } 58 hashFlag = &cli.StringFlag{ 59 Name: "hash", 60 Usage: "Checkpoint hash (query latest from remote node if not specified)", 61 } 62 oracleFlag = &cli.StringFlag{ 63 Name: "oracle", 64 Usage: "Checkpoint oracle address (query from remote node if not specified)", 65 } 66 thresholdFlag = &cli.Int64Flag{ 67 Name: "threshold", 68 Usage: "Minimal number of signatures required to approve a checkpoint", 69 } 70 nodeURLFlag = &cli.StringFlag{ 71 Name: "rpc", 72 Value: "http://localhost:8545", 73 Usage: "The rpc endpoint of a local or remote geth node", 74 } 75 clefURLFlag = &cli.StringFlag{ 76 Name: "clef", 77 Value: "http://localhost:8550", 78 Usage: "The rpc endpoint of clef", 79 } 80 signerFlag = &cli.StringFlag{ 81 Name: "signer", 82 Usage: "Signer address for clef signing", 83 } 84 signersFlag = &cli.StringFlag{ 85 Name: "signers", 86 Usage: "Comma separated accounts of trusted checkpoint signers", 87 } 88 signaturesFlag = &cli.StringFlag{ 89 Name: "signatures", 90 Usage: "Comma separated checkpoint signatures to submit", 91 } 92 ) 93 94 func main() { 95 log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) 96 fdlimit.Raise(2048) 97 98 if err := app.Run(os.Args); err != nil { 99 fmt.Fprintln(os.Stderr, err) 100 os.Exit(1) 101 } 102 }