github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum@v0.0.0-20190121132951-92cc4225ed8e/cmd/evm/main.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 //版权所有2014 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 //EVM执行EVM代码段。 26 package main 27 28 import ( 29 "fmt" 30 "math/big" 31 "os" 32 33 "github.com/ethereum/go-ethereum/cmd/utils" 34 "gopkg.in/urfave/cli.v1" 35 ) 36 37 var gitCommit = "" //git sha1提交发布的哈希(通过链接器标志设置) 38 39 var ( 40 app = utils.NewApp(gitCommit, "the evm command line interface") 41 42 DebugFlag = cli.BoolFlag{ 43 Name: "debug", 44 Usage: "output full trace logs", 45 } 46 MemProfileFlag = cli.StringFlag{ 47 Name: "memprofile", 48 Usage: "creates a memory profile at the given path", 49 } 50 CPUProfileFlag = cli.StringFlag{ 51 Name: "cpuprofile", 52 Usage: "creates a CPU profile at the given path", 53 } 54 StatDumpFlag = cli.BoolFlag{ 55 Name: "statdump", 56 Usage: "displays stack and heap memory information", 57 } 58 CodeFlag = cli.StringFlag{ 59 Name: "code", 60 Usage: "EVM code", 61 } 62 CodeFileFlag = cli.StringFlag{ 63 Name: "codefile", 64 Usage: "File containing EVM code. If '-' is specified, code is read from stdin ", 65 } 66 GasFlag = cli.Uint64Flag{ 67 Name: "gas", 68 Usage: "gas limit for the evm", 69 Value: 10000000000, 70 } 71 PriceFlag = utils.BigFlag{ 72 Name: "price", 73 Usage: "price set for the evm", 74 Value: new(big.Int), 75 } 76 ValueFlag = utils.BigFlag{ 77 Name: "value", 78 Usage: "value set for the evm", 79 Value: new(big.Int), 80 } 81 DumpFlag = cli.BoolFlag{ 82 Name: "dump", 83 Usage: "dumps the state after the run", 84 } 85 InputFlag = cli.StringFlag{ 86 Name: "input", 87 Usage: "input for the EVM", 88 } 89 VerbosityFlag = cli.IntFlag{ 90 Name: "verbosity", 91 Usage: "sets the verbosity level", 92 } 93 CreateFlag = cli.BoolFlag{ 94 Name: "create", 95 Usage: "indicates the action should be create rather than call", 96 } 97 GenesisFlag = cli.StringFlag{ 98 Name: "prestate", 99 Usage: "JSON file with prestate (genesis) config", 100 } 101 MachineFlag = cli.BoolFlag{ 102 Name: "json", 103 Usage: "output trace logs in machine readable format (json)", 104 } 105 SenderFlag = cli.StringFlag{ 106 Name: "sender", 107 Usage: "The transaction origin", 108 } 109 ReceiverFlag = cli.StringFlag{ 110 Name: "receiver", 111 Usage: "The transaction receiver (execution context)", 112 } 113 DisableMemoryFlag = cli.BoolFlag{ 114 Name: "nomemory", 115 Usage: "disable memory output", 116 } 117 DisableStackFlag = cli.BoolFlag{ 118 Name: "nostack", 119 Usage: "disable stack output", 120 } 121 ) 122 123 func init() { 124 app.Flags = []cli.Flag{ 125 CreateFlag, 126 DebugFlag, 127 VerbosityFlag, 128 CodeFlag, 129 CodeFileFlag, 130 GasFlag, 131 PriceFlag, 132 ValueFlag, 133 DumpFlag, 134 InputFlag, 135 MemProfileFlag, 136 CPUProfileFlag, 137 StatDumpFlag, 138 GenesisFlag, 139 MachineFlag, 140 SenderFlag, 141 ReceiverFlag, 142 DisableMemoryFlag, 143 DisableStackFlag, 144 } 145 app.Commands = []cli.Command{ 146 compileCommand, 147 disasmCommand, 148 runCommand, 149 stateTestCommand, 150 } 151 } 152 153 func main() { 154 if err := app.Run(os.Args); err != nil { 155 fmt.Fprintln(os.Stderr, err) 156 os.Exit(1) 157 } 158 }