This simple API allows users to be funded with native token of the connected network. The secret of an account with funds is passed as environment variable. When a user requests funds, a transaction from the balances pallet is made to the user's address.
In order to use the faucet, make a GET request to /fund?to={your-public-address}
, which will trigger
the transaction and respond to the user if the funding was successful.
An address can only be funded X times every 60 minutes, where it must also wait for Y minutes between
each funding. Both values can be configured in config.json
by setting limitPerHour
and minWaitTimeMinutes
respectively.
Alternatively, the requests per IP can be configured by RATE_LIMIT_MAX_REQUESTS
and RATE_LIMIT_WINDOW_MINUTES
.
If an error arises during the transfer (like a lack of funds from the sender's account), a message will be sent to the corresponding slack channel specified via environment. To avoid sending multiple messages, only one type of error will be sent every period of time, here defined as 8 hours.
SLACK_WEB_HOOK_TOKEN
- Slack web hook token for error reporting.SUBSTRATE_SECRET_PHRASE
- Substrate account secret used by the service to fund user's account.
PORT
- Defaults to3000
.RATE_LIMIT_WINDOW_MINUTES
- Rate limit window in minutes. Defaults to1
.RATE_LIMIT_MAX_REQUESTS
- Max requests per rate limit window. Defaults to60
.RATE_LIMIT_NUMBER_OF_PROXIES
- Allowed number of proxies in front of the service. Defaults to1
.
If you want to develop frontend
- go to /interface
- run
yarn dev
If you want to develop both frontend and backend
- in /interface run
yarn build
- in the main directory run
yarn dev