go-ethereum/cmd/faucet
Morty 365b82953d
feat: add system config consensus to deprecate clique (#1102)
* feat: add system config consensus to deprecate poa

* fix: check extra field lens

* Finish implementation with one signer only

* Implement unit tests

* Only check signature if block not requested

* Remove Extra from rlp encoding (and hashing)

* Implement UpgradableEngine as middleware for Clique/SystemContract

* Use isEuclid, add json tag to Requested, make go idiomatic

* Changes post integration test

* Remove comment

* Address comments

* Merge

* New field BlockSignature (not used in hashing/JSON)

* Enforce .Extra to be an empty slice

* replace header.Requested for header.IsNewBlock

* mark new block as IsNewBlock

* Make new RLP optional fields always default for legacy/reth compatibility

* Placing new fields as last non-zero rlp:optional values used by Scroll

* Penalize nodes that send non-zero Euclid V2 header field values

* Bring back .Requested to downloader instead of .IsNewBlock

* Replace IsNewBlock for Requested

* Address comments

* merge

* prevent timing issues in tests

* fix ci

* chore: auto version bump [bot]

* Update consensus/system_contract/consensus.go

Co-authored-by: Morty <70688412+yiweichi@users.noreply.github.com>

* chore: auto version bump [bot]

* Update consensus/system_contract/consensus.go

Co-authored-by: Jonas Theis <4181434+jonastheis@users.noreply.github.com>

* Remove whitespaces and merge version number

* chore: auto version bump [bot]

* validate that the read address from L1 is not empty and improved error handling when fetching address

* Fix indentation issue

* Fix test

* goimports fix

* goimports

---------

Co-authored-by: Alejandro Ranchal-Pedrosa <a.ranchalpedrosa@gmail.com>
Co-authored-by: jonastheis <4181434+jonastheis@users.noreply.github.com>
Co-authored-by: jonastheis <jonastheis@users.noreply.github.com>
Co-authored-by: ranchalp <ranchalp@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
2025-02-28 15:53:32 +01:00
..
faucet.go feat: add system config consensus to deprecate clique (#1102) 2025-02-28 15:53:32 +01:00
faucet.html cmd/faucet: fix nonce-gap problem (#22145) 2021-01-08 12:17:15 +02:00
faucet_test.go Update mod file and all imports to use scroll-tech URL (#15) 2021-12-24 10:59:22 +01:00
README.md cmd: support v1.1 Twitter API in faucet, fix puppeth 2021-01-04 14:13:21 +02:00
website.go style: revert some formatting (#294) 2023-04-20 17:49:35 +08:00

Faucet

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

Users need to post their Ethereum addresses to fund in a Twitter status update or public Facebook post and share the link to the faucet. The faucet will in turn deduplicate user requests and send the Ether. After a funding round, the faucet prevents the same user requesting again for a pre-configured amount of time, proportional to the amount of Ether requested.

Operation

The faucet is a single binary app (everything included) with all configurations set via command line flags and a few files.

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:

  • --genesis is a path to a file containin the network genesis.json
  • --network is the devp2p network id used during connection
  • --bootnodes is a list of enode:// ids to join the network through

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

Funding

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

  • --account.json is a path to the Ethereum account's JSON key file
  • --account.pass is a path to a text file with the decryption passphrase

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

  • --faucet.amount is the number of Ethers to send by default
  • --faucet.minutes is the time to wait before allowing a rerequest
  • --faucet.tiers is the funding tiers to support (x3 time, x2.5 funds)

Sybil protection

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

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:

  • --captcha.token is the API token for ReCaptcha
  • --captcha.secret is the API secret for ReCaptcha

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:

  • --twitter.token is the Bearer token for v2 API access
  • --twitter.token.v1 is the Bearer token for v1 API access

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

Miscellaneous

Beside the above - mostly essential - CLI flags, there are a number that can be used to fine tune the faucet's operation. Please see faucet --help for a full list.