This project defines a production ready faucet for the Ethereum test networks, allowing users to request and receive a specified amount of ETH every X hours to an address from a max of N different IP addresses (configurable) after passing Google recaptcha verification. The API tracks IP addresses and wallet addresses which requested and resets them at configurable intervals.
The project comes with functional React and Angular applications to showcase the faucet.
Download the latest version of Go. Then, build the project.
make go
./dist/faucet --help
Outputs
Run a faucet server for Ethereum using captcha for verification and ip-based rate-limiting
Usage:
faucet [flags]
The faucet hosts an http JSON API on localhost:8000 by default and a gRPC server on localhost:5000 for client access. Further customizations and required parameters are specified below:
The following are the available parameters to the faucet server:
Required Flags
| flag | Description | Default Value |
|---|---|---|
| --web3-provider | HTTP web3provider endpoint to an Ethereum node | "http://localhost:8545" |
| --captcha-host | Host for the captcha validation | "" |
| --captcha-secret | Secret for Google captcha validation | "" |
| --private-key | Private key hex string of the funding account | "" |
Web Server Flags
| flag | Description | Default Value |
|---|---|---|
| --http-host | Host to serve REST http requests | 127.0.0.1 |
| --http-port | Port to serve REST http requests | 8000 |
| --grpc-host | Host to serve gRPC requests | 127.0.0.1 |
| --grpc-port | Port to serve gRPC requests | 5000 |
| --allowed-origins | Comma-separated list of allowed origins | "*" |
Misc. Flags
| flag | Description | Default Value |
|---|---|---|
| --config | Path to yaml configuration file for flags | "" |
| --captcha-min-score | Minimum passing captcha score | 0.9 |
| --chain-id | Chain id of the Ethereum network used | 5 (Goerli) |
| --funding-amount | Amount in wei to fund with each request | 32500000000000000000 |
| --gas-limit | Gas limit for funding transactions | 40000 |
| --ip-limit-per-address | Number of ip's allowed per funding address | 5 |
You can configure the faucet by using a yaml configuration file instead of command-line flags as follows:
chain-id: 9999
http-port: 8080
# Insert all other desired customizations below...
and running the faucet server by specifying the path to the configuration file as follows:
./dist/faucet --config=/path/to/config.yaml
The Angular project allows you to enter your ETH wallet address, complete a captcha verification, and waits for a transaction to complete:
./web/ng/src/environments/environment.ts or ./web/ng/src/environments/environment.prod.ts if building for productioncd web/ng
npm install
npm start
Then navigate to http://localhost:4200 and try it out!
You can build it for production with npm run build
./web/react-example/src/environment.ts.cd web/react-example
npm install -g yarn
yarn install
npm start
Then navigate to http://localhost:3000 and try it out!
You can build it for production with npm run build
Regenerating protobufs:
protocmake protoRunning tests:
go test ./... -v
The project is licensed under the MIT License.