cmd/faucet: fix genesis flag and improve documentation (#24735)

pull/24745/head^2
s7v7nislands 3 years ago committed by GitHub
parent 2951b50bae
commit 9e0a10004e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      cmd/faucet/README.md
  2. 8
      cmd/faucet/faucet.go

@ -10,9 +10,11 @@ The `faucet` is a single binary app (everything included) with all configuration
First thing's first, the `faucet` needs to connect to an Ethereum network, for which it needs the necessary genesis and network infos. Each of the following flags must be set:
- `--genesis` is a path to a file containin the network `genesis.json`
- `--network` is the devp2p network id used during connection
- `--bootnodes` is a list of `enode://` ids to join the network through
- `-genesis` is a path to a file containin the network `genesis.json`. or using:
- `-goerli` with the faucet with Görli network config
- `-rinkeby` with the faucet with Rinkeby network config
- `-network` is the devp2p network id used during connection
- `-bootnodes` is a list of `enode://` ids to join the network through
The `faucet` will use the `les` protocol to join the configured Ethereum network and will store its data in `$HOME/.faucet` (currently not configurable).
@ -20,14 +22,14 @@ The `faucet` will use the `les` protocol to join the configured Ethereum network
To be able to distribute funds, the `faucet` needs access to an already funded Ethereum account. This can be configured via:
- `--account.json` is a path to the Ethereum account's JSON key file
- `--account.pass` is a path to a text file with the decryption passphrase
- `-account.json` is a path to the Ethereum account's JSON key file
- `-account.pass` is a path to a text file with the decryption passphrase
The faucet is able to distribute various amounts of Ether in exchange for various timeouts. These can be configured via:
- `--faucet.amount` is the number of Ethers to send by default
- `--faucet.minutes` is the time to wait before allowing a rerequest
- `--faucet.tiers` is the funding tiers to support (x3 time, x2.5 funds)
- `-faucet.amount` is the number of Ethers to send by default
- `-faucet.minutes` is the time to wait before allowing a rerequest
- `-faucet.tiers` is the funding tiers to support (x3 time, x2.5 funds)
## Sybil protection
@ -35,13 +37,13 @@ To prevent the same user from exhausting funds in a loop, the `faucet` ties requ
Captcha protection uses Google's invisible ReCaptcha, thus the `faucet` needs to run on a live domain. The domain needs to be registered in Google's systems to retrieve the captcha API token and secrets. After doing so, captcha protection may be enabled via:
- `--captcha.token` is the API token for ReCaptcha
- `--captcha.secret` is the API secret for ReCaptcha
- `-captcha.token` is the API token for ReCaptcha
- `-captcha.secret` is the API secret for ReCaptcha
Sybil protection via Twitter requires an API key as of 15th December, 2020. To obtain it, a Twitter user must be upgraded to developer status and a new Twitter App deployed with it. The app's `Bearer` token is required by the faucet to retrieve tweet data:
- `--twitter.token` is the Bearer token for `v2` API access
- `--twitter.token.v1` is the Bearer token for `v1` API access
- `-twitter.token` is the Bearer token for `v2` API access
- `-twitter.token.v1` is the Bearer token for `v1` API access
Sybil protection via Facebook uses the website to directly download post data thus does not currently require an API configuration.

@ -147,7 +147,7 @@ func main() {
log.Crit("Failed to render the faucet template", "err", err)
}
// Load and parse the genesis block requested by the user
genesis, err := getGenesis(genesisFlag, *goerliFlag, *rinkebyFlag)
genesis, err := getGenesis(*genesisFlag, *goerliFlag, *rinkebyFlag)
if err != nil {
log.Crit("Failed to parse genesis config", "err", err)
}
@ -886,11 +886,11 @@ func authNoAuth(url string) (string, string, common.Address, error) {
}
// getGenesis returns a genesis based on input args
func getGenesis(genesisFlag *string, goerliFlag bool, rinkebyFlag bool) (*core.Genesis, error) {
func getGenesis(genesisFlag string, goerliFlag bool, rinkebyFlag bool) (*core.Genesis, error) {
switch {
case genesisFlag != nil:
case genesisFlag != "":
var genesis core.Genesis
err := common.LoadJSON(*genesisFlag, &genesis)
err := common.LoadJSON(genesisFlag, &genesis)
return &genesis, err
case goerliFlag:
return core.DefaultGoerliGenesisBlock(), nil

Loading…
Cancel
Save