github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/cmd/smc/misccmd.go (about) 1 // Copyright 2016 The Spectrum Authors 2 // This file is part of Spectrum. 3 // 4 // Spectrum 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 // Spectrum 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 Spectrum. If not, see <http://www.gnu.org/licenses/>. 16 17 package main 18 19 import ( 20 "fmt" 21 "os" 22 "runtime" 23 "strings" 24 25 "github.com/SmartMeshFoundation/Spectrum/cmd/utils" 26 "github.com/SmartMeshFoundation/Spectrum/eth" 27 "github.com/SmartMeshFoundation/Spectrum/params" 28 "gopkg.in/urfave/cli.v1" 29 ) 30 31 var ( 32 /* makecacheCommand = cli.Command{ 33 Action: utils.MigrateFlags(makecache), 34 Name: "makecache", 35 Usage: "Generate ethash verification cache (for testing)", 36 ArgsUsage: "<blockNum> <outputDir>", 37 Category: "MISCELLANEOUS COMMANDS", 38 Description: ` 39 The makecache command generates an ethash cache in <outputDir>. 40 41 This command exists to support the system testing project. 42 Regular users do not need to execute it. 43 `, 44 }*/ 45 /* makedagCommand = cli.Command{ 46 Action: utils.MigrateFlags(makedag), 47 Name: "makedag", 48 Usage: "Generate ethash mining DAG (for testing)", 49 ArgsUsage: "<blockNum> <outputDir>", 50 Category: "MISCELLANEOUS COMMANDS", 51 Description: ` 52 The makedag command generates an ethash DAG in <outputDir>. 53 54 This command exists to support the system testing project. 55 Regular users do not need to execute it. 56 `, 57 }*/ 58 versionCommand = cli.Command{ 59 Action: utils.MigrateFlags(version), 60 Name: "version", 61 Usage: "Print version numbers", 62 ArgsUsage: " ", 63 Category: "MISCELLANEOUS COMMANDS", 64 Description: ` 65 The output of this command is supposed to be machine-readable. 66 `, 67 } 68 licenseCommand = cli.Command{ 69 Action: utils.MigrateFlags(license), 70 Name: "license", 71 Usage: "Display license information", 72 ArgsUsage: " ", 73 Category: "MISCELLANEOUS COMMANDS", 74 } 75 ) 76 77 // makecache generates an ethash verification cache into the provided folder. 78 /*func makecache(ctx *cli.Context) error { 79 args := ctx.Args() 80 if len(args) != 2 { 81 utils.Fatalf(`Usage: geth makecache <block number> <outputdir>`) 82 } 83 block, err := strconv.ParseUint(args[0], 0, 64) 84 if err != nil { 85 utils.Fatalf("Invalid block number: %v", err) 86 } 87 ethash.MakeCache(block, args[1]) 88 89 return nil 90 }*/ 91 92 // makedag generates an ethash mining DAG into the provided folder. 93 /*func makedag(ctx *cli.Context) error { 94 args := ctx.Args() 95 if len(args) != 2 { 96 utils.Fatalf(`Usage: geth makedag <block number> <outputdir>`) 97 } 98 block, err := strconv.ParseUint(args[0], 0, 64) 99 if err != nil { 100 utils.Fatalf("Invalid block number: %v", err) 101 } 102 ethash.MakeDataset(block, args[1]) 103 104 return nil 105 }*/ 106 107 func version(ctx *cli.Context) error { 108 fmt.Println("======================================================") 109 fmt.Println(strings.Title(clientIdentifier)) 110 fmt.Println("Version:", params.Version) 111 if gitCommit != "" { 112 fmt.Println("Git Commit:", gitCommit) 113 } 114 fmt.Println("======================================================") 115 fmt.Println("Architecture:", runtime.GOARCH) 116 fmt.Println("Protocol Versions:", eth.ProtocolVersions) 117 fmt.Println("Network Id:", eth.DefaultConfig.NetworkId) 118 fmt.Println("Go Version:", runtime.Version()) 119 fmt.Println("Operating System:", runtime.GOOS) 120 fmt.Printf("GOPATH=%s\n", os.Getenv("GOPATH")) 121 fmt.Printf("GOROOT=%s\n", runtime.GOROOT()) 122 fmt.Println("Based On:", "Spectrum") 123 fmt.Println("Email:", "cc14514@icloud.com") 124 return nil 125 } 126 127 func license(_ *cli.Context) error { 128 fmt.Println(`Spectrum (Ethereum-based) is free software: you can redistribute it and/or modify 129 it under the terms of the GNU General Public License as published by 130 the Free Software Foundation, either version 3 of the License, or 131 (at your option) any later version. 132 133 Spectrum is distributed in the hope that it will be useful, 134 but WITHOUT ANY WARRANTY; without even the implied warranty of 135 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 136 GNU General Public License for more details. 137 138 You should have received a copy of the GNU General Public License 139 along with Spectrum. If not, see <http://www.gnu.org/licenses/>. 140 `) 141 return nil 142 }