MCPcopy Index your code
hub / github.com/chainflag/eth-faucet

github.com/chainflag/eth-faucet @v1.2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.1 ↗ · + Follow
61 symbols 202 edges 18 files 1 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

eth-faucet

Build Release Report Go License

The faucet is a web application with the goal of distributing small amounts of Ether in private and test networks.

Features

  • 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

Get started

Prerequisites

  • Go (version 1.17 or later)
  • Node.js

Installation

  1. Clone the repository and navigate to the app’s directory
git clone https://github.com/chainflag/eth-faucet.git
cd eth-faucet
  1. Bundle frontend with Vite
go generate
  1. Build Go project
go build -o eth-faucet

Usage

Use a private key

./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.privkey privkey

Use a keystore

./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.keyjson keystore -wallet.keypass password.txt

Configuration

You can configure the funding account by using environment variables instead of command-line flags:

export WEB3_PROVIDER=rpc_endpoint
export PRIVATE_KEY=hex_private_key

or

export WEB3_PROVIDER=rpc_endpoint
export KEYSTORE=keystore_path
echo "your_keystore_password" > `pwd`/password.txt

Then run the faucet application without the wallet command-line flags:

./eth-faucet -httpport 8080

Optional 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

Docker deployment

docker run -d -p 8080:8080 -e WEB3_PROVIDER=rpc_endpoint -e PRIVATE_KEY=hex_private_key chainflag/eth-faucet:1.2.0

or

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 chainflag/eth-faucet:1.2.0

License

Distributed under the MIT License. See LICENSE for more information.

Extension points exported contracts — how you extend this code

TxBuilder (Interface)
(no doc) [2 implementers]
internal/chain/transaction.go
Window (Interface)
(no doc)
web/src/vite-env.d.ts

Core symbols most depended-on inside this repo

Error
called by 10
internal/server/dto.go
renderJSON
called by 7
internal/server/dto.go
Run
called by 5
internal/server/server.go
ServeHTTP
called by 4
internal/server/middleware.go
EtherToWei
called by 3
internal/chain/util.go
Sender
called by 2
internal/chain/transaction.go
refreshNonce
called by 2
internal/chain/transaction.go
DecryptKeyfile
called by 2
internal/chain/keystore.go

Shape

Function 28
Method 19
Struct 12
Interface 2

Languages

Go98%
TypeScript2%

Modules by API surface

internal/chain/transaction.go12 symbols
internal/server/middleware.go8 symbols
internal/server/dto.go8 symbols
internal/server/server.go7 symbols
internal/server/server_test.go6 symbols
internal/chain/util_test.go3 symbols
internal/chain/util.go3 symbols
internal/chain/keystore_test.go3 symbols
cmd/server.go3 symbols
internal/server/config.go2 symbols
internal/chain/keystore.go2 symbols
web/src/vite-env.d.ts1 symbols

For agents

$ claude mcp add eth-faucet \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact