github.com/carter-ya/go-ethereum@v0.0.0-20230628080049-d2309be3983b/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/ethereum/go-ethereum/common/fdlimit" 26 "github.com/ethereum/go-ethereum/internal/flags" 27 "github.com/ethereum/go-ethereum/log" 28 "github.com/urfave/cli/v2" 29 ) 30 31 var app = flags.NewApp("ethereum checkpoint helper tool") 32 33 func init() { 34 app.Commands = []*cli.Command{ 35 commandStatus, 36 commandDeploy, 37 commandSign, 38 commandPublish, 39 } 40 app.Flags = []cli.Flag{ 41 oracleFlag, 42 nodeURLFlag, 43 } 44 } 45 46 // Commonly used command line flags. 47 var ( 48 indexFlag = &cli.Int64Flag{ 49 Name: "index", 50 Usage: "Checkpoint index (query latest from remote node if not specified)", 51 } 52 hashFlag = &cli.StringFlag{ 53 Name: "hash", 54 Usage: "Checkpoint hash (query latest from remote node if not specified)", 55 } 56 oracleFlag = &cli.StringFlag{ 57 Name: "oracle", 58 Usage: "Checkpoint oracle address (query from remote node if not specified)", 59 } 60 thresholdFlag = &cli.Int64Flag{ 61 Name: "threshold", 62 Usage: "Minimal number of signatures required to approve a checkpoint", 63 } 64 nodeURLFlag = &cli.StringFlag{ 65 Name: "rpc", 66 Value: "http://localhost:8545", 67 Usage: "The rpc endpoint of a local or remote geth node", 68 } 69 clefURLFlag = &cli.StringFlag{ 70 Name: "clef", 71 Value: "http://localhost:8550", 72 Usage: "The rpc endpoint of clef", 73 } 74 signerFlag = &cli.StringFlag{ 75 Name: "signer", 76 Usage: "Signer address for clef signing", 77 } 78 signersFlag = &cli.StringFlag{ 79 Name: "signers", 80 Usage: "Comma separated accounts of trusted checkpoint signers", 81 } 82 signaturesFlag = &cli.StringFlag{ 83 Name: "signatures", 84 Usage: "Comma separated checkpoint signatures to submit", 85 } 86 ) 87 88 func main() { 89 log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) 90 fdlimit.Raise(2048) 91 92 if err := app.Run(os.Args); err != nil { 93 fmt.Fprintln(os.Stderr, err) 94 os.Exit(1) 95 } 96 }