The faucet is a web application with the goal of distributing small amounts of Ether in private and test networks.
- Configure the funding account using a private key or keystore
- Implement CAPTCHA verification to prevent abuse
- Rate-limit requests by ETH address and IP address to prevent spam
- Prevent X-Forwarded-For spoofing by specifying the number of reverse proxies
- Go (version 1.17 or later)
- Node.js
- Clone the repository and navigate to the app’s directory
git clone https://github.com/chainflag/eth-faucet.git
cd eth-faucet- Bundle frontend with Vite
go generateor
cd web
yarn install
yarn build- Build Go project
go build -o eth-faucetUse a private key
./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.privkey privkeyUse a keystore
./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.keyjson keystore -wallet.keypass password.txtYou can configure the funding account by using environment variables instead of command-line flags:
export WEB3_PROVIDER=rpc_endpoint
export PRIVATE_KEY=hex_private_keyor
export WEB3_PROVIDER=rpc_endpoint
export KEYSTORE=keystore_path
echo "your_keystore_password" > `pwd`/password.txtThen run the faucet application without the wallet command-line flags:
./eth-faucet -httpport 8080Optional Flags
The following are the available command-line flags(excluding above wallet flags):
| Flag | Description | Default Value |
|---|---|---|
| -httpport | Listener port to serve HTTP connection | 8080 |
| -proxycount | Count of reverse proxies in front of the server | 0 |
| -faucet.amount | Number of Ethers to transfer per user request | 1.0 |
| -faucet.minutes | Number of minutes to wait between funding rounds | 1440 |
| -faucet.name | Network name to display on the frontend | testnet |
| -faucet.symbol | Token symbol to display on the frontend | ETH |
| -hcaptcha.sitekey | hCaptcha sitekey | |
| -hcaptcha.secret | hCaptcha secret |
Yoou can get hCaptcha at https://www.hcaptcha.com/
docker build --tag eth-faucet:1.2.0 .docker run -d -p 8080:8080 -e WEB3_PROVIDER=rpc_endpoint -e PRIVATE_KEY=hex_private_key eth-faucet:1.2.0 -faucet.symbol=NXRA -faucet.name=nexeraor
docker run -d -p 8080:8080 -e WEB3_PROVIDER=rpc_endpoint -e KEYSTORE=keystore_path -v `pwd`/keystore:/app/keystore -v `pwd`/password.txt:/app/password.txt eth-faucet:1.2.0 -faucet.symbol=NXRA -faucet.name=nexeraIf running locally rpc_endpoint should be http://host.docker.internal:8545
In order to add a network you should go to server.go and add the network in the the chainId array
chainIDMap = map[string]int{"sepolia": 11155111, "holesky": 17000, "nexera": 32382}To select it use the faucet.name flag.
Distributed under the MIT License. See LICENSE for more information.