Faucet server for the Akash Network
The faucet is authenticated using Auth0
and the SPA API architecture.
A good example of this setup is the Akash faucet UI.
Users have rate-limited access to the faucet with a configurable wait period. If the manage:faucet
permission is given to a user in Auth0, additional endpoints are accessible to view transaction and user history, and manage a list of blocked addresses.
This faucet is configured to work with Akash but will work with any Tendermint SDK based chain.
Create a local .env
file from the .env.example
file
cp .env.example .env
Open the .env
file and add required values
NETWORK_RPC_NODE="https://rpc.akash.beyno.de:443"
FAUCET_WAIT_PERIOD=1d
FAUCET_DISTRIBUTION_AMOUNT=1000
FAUCET_DENOM=uakt
FAUCET_FEES=5000
FAUCET_GAS=180000
FAUCET_MEMO="Sent from Faucet"
FAUCET_MNEMONIC="secret words"
# uncomment line below for local dev
# INLINE_UI=true
# comment out all lines below for local dev
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=faucet
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
PROM_USER=prom
PROM_PASSWORD=client
AUTH0_DOMAIN="mydomain.us.auth0.com"
AUTH0_AUDIENCE="https=//mydomain.com"
All endpoints will return the relevent success status if successful. Errors will
return an appropriate error code and a message under the error
key.
Returns status about the faucet
{
'faucetAddress': 'akash1...',
'unlockDate': '2020-10-10T14:48:00',
'chainId': 'akashnet-2',
'distributionAmount': 10000
}
Request funds from the faucet. Requires an access token.
{
'address': 'akash1...'
}
{
'transactionHash': 'A5BE0243169DAF5A...'
}
Returns an array of users who have used the faucet. Requires an access token with the
manage:faucet
permission.
[{
'id': 1,
'sub': 'github|1',
'nickname': 'username',
'name': 'User Name',
'email': '[email protected]',
'picture': 'http://image.com/user.jpg',
'createdAt': '...',
'updatedAt': '...'
}]
Returns an array of transactions sent from the faucet. Requires an access token with the
manage:faucet
permission.
[{
'id': 1,
'userId': 1,
'address': 'github|1',
'amount': 100000,
'transactionHash': 'A5BE0243169DAF5A...',
'user': {
...
},
'createdAt': '...',
'updatedAt': '...'
}]
Returns an array of blocked addresses. Requires an access token with the
manage:faucet
permission.
[{
'id': 1,
'address': 'akash1...',
'createdAt': '...',
'updatedAt': '...'
}]
Create a blocked addresses. Requires an access token with the manage:faucet
permission.
{
address: 'akash1...'
}
{}
Delete a blocked address.