MCPcopy Create free account
hub / github.com/ethstorage/es-node / main

Function main

cmd/es-node/main.go:64–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}()
63
64func main() {
65 log.SetupDefaults()
66 app := cli.NewApp()
67 app.Version = BuildInfo
68 app.Flags = flags.Flags
69 app.Name = "EthStorage node"
70 app.Usage = "EthStorage Storage Node"
71 app.Description = "The EthStorage Storage Node derives L2 datahashes of the values of KV store from L1 data and reconstructs the values via L1 DA and ES P2P network."
72 app.Action = EsNodeMain
73 app.Commands = []cli.Command{
74 {
75 Name: "init",
76 Aliases: []string{"i"},
77 Usage: `Initialize shard data files (one per shard). Type 'es-node init --help' for more information.`,
78 UsageText: `Use --shard_len to create N sequential shards starting at 0, or --shard_index to list one or more explicit shard indices (repeatable). If both are supplied, --shard_index wins.`,
79 Flags: []cli.Flag{
80 cli.Uint64Flag{
81 Name: shardLenFlagName,
82 Usage: "Number of shards to mine. Will create one data file per shard.",
83 },
84 cli.IntFlag{
85 Name: encodingTypeFlagName,
86 Value: ethstorage.ENCODE_BLOB_POSEIDON,
87 Usage: "Encoding type of the shards. 0: no encoding, 1: keccak256, 2: ethash, 3: blob poseidon. Default: 3",
88 },
89 cli.Int64SliceFlag{
90 Name: shardIndexFlagName,
91 Usage: "Indexes of shards to mine. Will create one data file per shard.",
92 },
93 flags.DataDir,
94 flags.L1NodeAddr,
95 flags.StorageL1Contract,
96 flags.StorageMiner,
97 },
98 Action: EsNodeInit,
99 },
100 {
101 Name: "sync",
102 Aliases: []string{"s"},
103 Usage: "Fetch a single blob (by KV index) from a remote EthStorage RPC and write it into local storage. Type 'es-node sync --help' for more information.",
104 UsageText: fmt.Sprintf("Requires --%s (KV index) and --%s (RPC endpoint).", kvIndexFlagName, esRpcFlagName),
105 Flags: []cli.Flag{
106 cli.Uint64Flag{
107 Name: kvIndexFlagName,
108 Usage: "KV index to update",
109 },
110 cli.StringFlag{
111 Name: esRpcFlagName,
112 Usage: "EthStorage RPC endpoint",
113 },
114 flags.DataDir,
115 flags.L1NodeAddr,
116 flags.StorageL1Contract,
117 flags.StorageMiner,
118 flags.StorageFiles,
119 },
120 Action: EsNodeSync,
121 },

Callers

nothing calls this directly

Calls 4

SetupDefaultsFunction · 0.92
CLIFlagsFunction · 0.92
GetEmailConfigFunction · 0.92
SendEmailFunction · 0.92

Tested by

no test coverage detected