Skip to content

Commit 4d086dc

Browse files
s7v7nislandscp-wjhan
authored andcommitted
cmd/faucet: fix genesis flag and improve documentation (ethereum#24735)
1 parent 7c2e940 commit 4d086dc

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

cmd/faucet/README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,40 @@ The `faucet` is a single binary app (everything included) with all configuration
1010

1111
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:
1212

13-
- `--genesis` is a path to a file containin the network `genesis.json`
14-
- `--network` is the devp2p network id used during connection
15-
- `--bootnodes` is a list of `enode://` ids to join the network through
13+
- `-genesis` is a path to a file containin the network `genesis.json`. or using:
14+
- `-goerli` with the faucet with Görli network config
15+
- `-rinkeby` with the faucet with Rinkeby network config
16+
- `-network` is the devp2p network id used during connection
17+
- `-bootnodes` is a list of `enode://` ids to join the network through
1618

1719
The `faucet` will use the `les` protocol to join the configured Ethereum network and will store its data in `$HOME/.faucet` (currently not configurable).
1820

1921
## Funding
2022

2123
To be able to distribute funds, the `faucet` needs access to an already funded Ethereum account. This can be configured via:
2224

23-
- `--account.json` is a path to the Ethereum account's JSON key file
24-
- `--account.pass` is a path to a text file with the decryption passphrase
25+
- `-account.json` is a path to the Ethereum account's JSON key file
26+
- `-account.pass` is a path to a text file with the decryption passphrase
2527

2628
The faucet is able to distribute various amounts of Ether in exchange for various timeouts. These can be configured via:
2729

28-
- `--faucet.amount` is the number of Ethers to send by default
29-
- `--faucet.minutes` is the time to wait before allowing a rerequest
30-
- `--faucet.tiers` is the funding tiers to support (x3 time, x2.5 funds)
30+
- `-faucet.amount` is the number of Ethers to send by default
31+
- `-faucet.minutes` is the time to wait before allowing a rerequest
32+
- `-faucet.tiers` is the funding tiers to support (x3 time, x2.5 funds)
3133

3234
## Sybil protection
3335

3436
To prevent the same user from exhausting funds in a loop, the `faucet` ties requests to social networks and captcha resolvers.
3537

3638
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:
3739

38-
- `--captcha.token` is the API token for ReCaptcha
39-
- `--captcha.secret` is the API secret for ReCaptcha
40+
- `-captcha.token` is the API token for ReCaptcha
41+
- `-captcha.secret` is the API secret for ReCaptcha
4042

4143
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:
4244

43-
- `--twitter.token` is the Bearer token for `v2` API access
44-
- `--twitter.token.v1` is the Bearer token for `v1` API access
45+
- `-twitter.token` is the Bearer token for `v2` API access
46+
- `-twitter.token.v1` is the Bearer token for `v1` API access
4547

4648
Sybil protection via Facebook uses the website to directly download post data thus does not currently require an API configuration.
4749

cmd/faucet/faucet.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func main() {
147147
log.Crit("Failed to render the faucet template", "err", err)
148148
}
149149
// Load and parse the genesis block requested by the user
150-
genesis, err := getGenesis(genesisFlag, *goerliFlag, *rinkebyFlag)
150+
genesis, err := getGenesis(*genesisFlag, *goerliFlag, *rinkebyFlag)
151151
if err != nil {
152152
log.Crit("Failed to parse genesis config", "err", err)
153153
}
@@ -886,11 +886,11 @@ func authNoAuth(url string) (string, string, common.Address, error) {
886886
}
887887

888888
// getGenesis returns a genesis based on input args
889-
func getGenesis(genesisFlag *string, goerliFlag bool, rinkebyFlag bool) (*core.Genesis, error) {
889+
func getGenesis(genesisFlag string, goerliFlag bool, rinkebyFlag bool) (*core.Genesis, error) {
890890
switch {
891-
case genesisFlag != nil:
891+
case genesisFlag != "":
892892
var genesis core.Genesis
893-
err := common.LoadJSON(*genesisFlag, &genesis)
893+
err := common.LoadJSON(genesisFlag, &genesis)
894894
return &genesis, err
895895
case goerliFlag:
896896
return core.DefaultGoerliGenesisBlock(), nil

0 commit comments

Comments
 (0)