chainflag/eth-faucet

GitHub: chainflag/eth-faucet

基于 Go 和 Svelte 构建的以太坊水龙头应用,为私有网络和测试网络提供小额 Ether 分发服务。

Stars: 577 | Forks: 252

# eth-faucet [![Build](https://img.shields.io/github/actions/workflow/status/chainflag/eth-faucet/build.yml?branch=main)](https://github.com/chainflag/eth-faucet/actions/workflows/build.yml) [![Release](https://img.shields.io/github/v/release/chainflag/eth-faucet)](https://github.com/chainflag/eth-faucet/releases) [![Report](https://goreportcard.com/badge/github.com/chainflag/eth-faucet)](https://goreportcard.com/report/github.com/chainflag/eth-faucet) [![Go](https://img.shields.io/github/go-mod/go-version/chainflag/eth-faucet)](https://go.dev/) [![License](https://img.shields.io/github/license/chainflag/eth-faucet)](https://github.com/chainflag/eth-faucet/blob/main/LICENSE) 该水龙头是一个 Web 应用程序,旨在为私有网络和测试网络分发少量的 Ether。 ## 功能 * 使用 private key 或 keystore 配置注资账户 * 实现 CAPTCHA 验证以防止滥用 * 通过 ETH 地址和 IP 地址对请求进行速率限制,以防止垃圾请求 * 通过指定反向代理的数量来防止 X-Forwarded-For 欺骗 ## 快速开始 ### 前置条件 * Go(1.17 或更高版本) * Node.js ### 安装说明 1. 克隆仓库并进入应用程序目录 ``` git clone https://github.com/chainflag/eth-faucet.git cd eth-faucet ``` 2. 使用 Vite 打包前端 ``` go generate ``` 3. 构建 Go 项目 ``` go build -o eth-faucet ``` ## 用法 **使用 private key** ``` ./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.privkey privkey ``` **使用 keystore** ``` ./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.keyjson keystore -wallet.keypass password.txt ``` ### 配置 你可以使用环境变量代替命令行参数来配置注资账户: ``` export WEB3_PROVIDER=rpc_endpoint export PRIVATE_KEY=hex_private_key ``` 或者 ``` export WEB3_PROVIDER=rpc_endpoint export KEYSTORE=keystore_path echo "your_keystore_password" > `pwd`/password.txt ``` 然后运行水龙头应用程序,无需带 wallet 命令行参数: ``` ./eth-faucet -httpport 8080 ``` **可选参数** 以下是可用的命令行参数(不包括上述 wallet 参数): | 参数 | 描述 | 默认值 | |-------------------|--------------------------------------------------|---------------| | -httpport | 用于处理 HTTP 连接的监听端口 | 8080 | | -proxycount | 服务器前端的反向代理数量 | 0 | | -faucet.amount | 每次用户请求传输的 Ether 数量 | 1.0 | | -faucet.minutes | 两次注资轮次之间等待的分钟数 | 1440 | | -faucet.name | 在前端显示的网络名称 | testnet | | -faucet.symbol | 在前端显示的 token 符号 | ETH | | -hcaptcha.sitekey | hCaptcha sitekey | | | -hcaptcha.secret | hCaptcha secret | | ### Docker 部署 ``` docker run -d -p 8080:8080 -e WEB3_PROVIDER=rpc_endpoint -e PRIVATE_KEY=hex_private_key chainflag/eth-faucet:1.2.0 ``` 或者 ``` 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 ``` ## 许可证 基于 MIT 许可证分发。查看 LICENSE 了解更多信息。
标签:EVTX分析, Go, Ruby工具, SBOM分析, Svelte, 以太坊, 区块链, 日志审计, 水龙头, 请求拦截