github.com/prysmaticlabs/prysm@v1.4.4/cmd/beacon-chain/flags/base.go (about) 1 // Package flags defines beacon-node specific runtime flags for 2 // setting important values such as ports, eth1 endpoints, and more. 3 package flags 4 5 import ( 6 "github.com/prysmaticlabs/prysm/shared/params" 7 "github.com/urfave/cli/v2" 8 ) 9 10 var ( 11 // HTTPWeb3ProviderFlag provides an HTTP access endpoint to an ETH 1.0 RPC. 12 HTTPWeb3ProviderFlag = &cli.StringFlag{ 13 Name: "http-web3provider", 14 Usage: "A mainchain web3 provider string http endpoint. Can contain auth header as well in the format --http-web3provider=\"https://goerli.infura.io/v3/xxxx,Basic xxx\" for project secret (base64 encoded) and --http-web3provider=\"https://goerli.infura.io/v3/xxxx,Bearer xxx\" for jwt use", 15 Value: "", 16 } 17 // FallbackWeb3ProviderFlag provides a fallback endpoint to an ETH 1.0 RPC. 18 FallbackWeb3ProviderFlag = &cli.StringSliceFlag{ 19 Name: "fallback-web3provider", 20 Usage: "A mainchain web3 provider string http endpoint. This is our fallback web3 provider, this flag may be used multiple times.", 21 } 22 // DepositContractFlag defines a flag for the deposit contract address. 23 DepositContractFlag = &cli.StringFlag{ 24 Name: "deposit-contract", 25 Usage: "Deposit contract address. Beacon chain node will listen logs coming from the deposit contract to determine when validator is eligible to participate.", 26 Value: params.BeaconConfig().DepositContractAddress, 27 } 28 // RPCHost defines the host on which the RPC server should listen. 29 RPCHost = &cli.StringFlag{ 30 Name: "rpc-host", 31 Usage: "Host on which the RPC server should listen", 32 Value: "127.0.0.1", 33 } 34 // RPCPort defines a beacon node RPC port to open. 35 RPCPort = &cli.IntFlag{ 36 Name: "rpc-port", 37 Usage: "RPC port exposed by a beacon node", 38 Value: 4000, 39 } 40 // MonitoringPortFlag defines the http port used to serve prometheus metrics. 41 MonitoringPortFlag = &cli.IntFlag{ 42 Name: "monitoring-port", 43 Usage: "Port used to listening and respond metrics for prometheus.", 44 Value: 8080, 45 } 46 // CertFlag defines a flag for the node's TLS certificate. 47 CertFlag = &cli.StringFlag{ 48 Name: "tls-cert", 49 Usage: "Certificate for secure gRPC. Pass this and the tls-key flag in order to use gRPC securely.", 50 } 51 // KeyFlag defines a flag for the node's TLS key. 52 KeyFlag = &cli.StringFlag{ 53 Name: "tls-key", 54 Usage: "Key for secure gRPC. Pass this and the tls-cert flag in order to use gRPC securely.", 55 } 56 // DisableGRPCGateway for JSON-HTTP requests to the beacon node. 57 DisableGRPCGateway = &cli.BoolFlag{ 58 Name: "disable-grpc-gateway", 59 Usage: "Disable the gRPC gateway for JSON-HTTP requests", 60 } 61 // GRPCGatewayHost specifies a gRPC gateway host for Prysm. 62 GRPCGatewayHost = &cli.StringFlag{ 63 Name: "grpc-gateway-host", 64 Usage: "The host on which the gateway server runs on", 65 Value: "127.0.0.1", 66 } 67 // GRPCGatewayPort specifies a gRPC gateway port for Prysm. 68 GRPCGatewayPort = &cli.IntFlag{ 69 Name: "grpc-gateway-port", 70 Usage: "The port on which the gateway server runs on", 71 Value: 3500, 72 } 73 // EthApiPort specifies the port which runs the official Ethereum REST API. 74 // Serves JSON values conforming to the specification: https://ethereum.github.io/eth2.0-APIs/ 75 EthApiPort = &cli.IntFlag{ 76 Name: "eth-api-port", 77 Usage: "The port which exposes a REST API conforming to the official Ethereum API specification.", 78 Value: 3501, 79 } 80 // GPRCGatewayCorsDomain serves preflight requests when serving gRPC JSON gateway. 81 GPRCGatewayCorsDomain = &cli.StringFlag{ 82 Name: "grpc-gateway-corsdomain", 83 Usage: "Comma separated list of domains from which to accept cross origin requests " + 84 "(browser enforced). This flag has no effect if not used with --grpc-gateway-port.", 85 Value: "http://localhost:4200,http://localhost:7500,http://127.0.0.1:4200,http://127.0.0.1:7500,http://0.0.0.0:4200,http://0.0.0.0:7500", 86 } 87 // MinSyncPeers specifies the required number of successful peer handshakes in order 88 // to start syncing with external peers. 89 MinSyncPeers = &cli.IntFlag{ 90 Name: "min-sync-peers", 91 Usage: "The required number of valid peers to connect with before syncing.", 92 Value: 3, 93 } 94 // ContractDeploymentBlock is the block in which the eth1 deposit contract was deployed. 95 ContractDeploymentBlock = &cli.IntFlag{ 96 Name: "contract-deployment-block", 97 Usage: "The eth1 block in which the deposit contract was deployed.", 98 Value: 11184524, 99 } 100 // SetGCPercent is the percentage of current live allocations at which the garbage collector is to run. 101 SetGCPercent = &cli.IntFlag{ 102 Name: "gc-percent", 103 Usage: "The percentage of freshly allocated data to live data on which the gc will be run again.", 104 Value: 100, 105 } 106 // HeadSync starts the beacon node from the previously saved head state and syncs from there. 107 HeadSync = &cli.BoolFlag{ 108 Name: "head-sync", 109 Usage: "Starts the beacon node with the previously saved head state instead of finalized state.", 110 } 111 // SlotsPerArchivedPoint specifies the number of slots between the archived points, to save beacon state in the cold 112 // section of DB. 113 SlotsPerArchivedPoint = &cli.IntFlag{ 114 Name: "slots-per-archive-point", 115 Usage: "The slot durations of when an archived state gets saved in the DB.", 116 Value: 2048, 117 } 118 // DisableDiscv5 disables running discv5. 119 DisableDiscv5 = &cli.BoolFlag{ 120 Name: "disable-discv5", 121 Usage: "Does not run the discoveryV5 dht.", 122 } 123 // BlockBatchLimit specifies the requested block batch size. 124 BlockBatchLimit = &cli.IntFlag{ 125 Name: "block-batch-limit", 126 Usage: "The amount of blocks the local peer is bounded to request and respond to in a batch.", 127 Value: 64, 128 } 129 // BlockBatchLimitBurstFactor specifies the factor by which block batch size may increase. 130 BlockBatchLimitBurstFactor = &cli.IntFlag{ 131 Name: "block-batch-limit-burst-factor", 132 Usage: "The factor by which block batch limit may increase on burst.", 133 Value: 10, 134 } 135 // DisableSync disables a node from syncing at start-up. Instead the node enters regular sync 136 // immediately. 137 DisableSync = &cli.BoolFlag{ 138 Name: "disable-sync", 139 Usage: "Starts the beacon node without entering initial sync and instead exits to regular sync immediately.", 140 } 141 // EnableDebugRPCEndpoints as /v1/beacon/state. 142 EnableDebugRPCEndpoints = &cli.BoolFlag{ 143 Name: "enable-debug-rpc-endpoints", 144 Usage: "Enables the debug rpc service, containing utility endpoints such as /eth/v1alpha1/beacon/state.", 145 } 146 // SubscribeToAllSubnets defines a flag to specify whether to subscribe to all possible attestation subnets or not. 147 SubscribeToAllSubnets = &cli.BoolFlag{ 148 Name: "subscribe-all-subnets", 149 Usage: "Subscribe to all possible attestation subnets.", 150 } 151 // HistoricalSlasherNode is a set of beacon node flags required for performing historical detection with a slasher. 152 HistoricalSlasherNode = &cli.BoolFlag{ 153 Name: "historical-slasher-node", 154 Usage: "Enables required flags for serving historical data to a slasher client. Results in additional storage usage", 155 } 156 // ChainID defines a flag to set the chain id. If none is set, it derives this value from NetworkConfig 157 ChainID = &cli.Uint64Flag{ 158 Name: "chain-id", 159 Usage: "Sets the chain id of the beacon chain", 160 } 161 // NetworkID defines a flag to set the network id. If none is set, it derives this value from NetworkConfig 162 NetworkID = &cli.Uint64Flag{ 163 Name: "network-id", 164 Usage: "Sets the network id of the beacon chain.", 165 } 166 // WeakSubjectivityCheckpt defines the weak subjectivity checkpoint the node must sync through to defend against long range attacks. 167 WeakSubjectivityCheckpt = &cli.StringFlag{ 168 Name: "weak-subjectivity-checkpoint", 169 Usage: "Input in `block_root:epoch_number` format. This guarantees that syncing leads to the given Weak Subjectivity Checkpoint along the canonical chain. " + 170 "If such a sync is not possible, the node will treat it a critical and irrecoverable failure", 171 Value: "", 172 } 173 // Eth1HeaderReqLimit defines a flag to set the maximum number of headers that a deposit log query can fetch. If none is set, 1000 will be the limit. 174 Eth1HeaderReqLimit = &cli.Uint64Flag{ 175 Name: "eth1-header-req-limit", 176 Usage: "Sets the maximum number of headers that a deposit log query can fetch.", 177 Value: uint64(1000), 178 } 179 // GenesisStatePath defines a flag to start the beacon chain from a give genesis state file. 180 GenesisStatePath = &cli.StringFlag{ 181 Name: "genesis-state", 182 Usage: "Load a genesis state from ssz file. Testnet genesis files can be found in the " + 183 "eth2-clients/eth2-testnets repository on github.", 184 } 185 )