Coder Social home page Coder Social logo

ethermint-faucet-backend's Introduction

Ethermint Faucet

NOTE: this repo was archived, the new version is using my evmosgrpc lib and a simple FASTAPI app.

Faucet server for Ethermint

How to use

The faucet is authenticated using Auth0 and the SPA with API architecture. A good example of this setup is the Ethermint faucet frontend.

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 Ethermint.

Configuration

POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: faucet
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
NETWORK_RPC_NODE: https://rpc.akash.beyno.de:443
FAUCET_WAIT_PERIOD: 1d
FAUCET_DISTRIBUTION_AMOUNT: 1000
FAUCET_DENOM: ethm
FAUCET_FEES: 5000
FAUCET_GAS: 180000
FAUCET_MEMO: Sent from Faucet
AUTH0_DOMAIN: mydomain.us.auth0.com
AUTH0_AUDIENCE: https://mydomain.com
FAUCET_MNEMONIC: some secret words here

Endpoints

All endpoints will return the relevant success status if successful. Errors will return an appropriate error code and a message under the error key.

GET /

Returns status about the faucet

Response

{
  'faucetAddress': 'akash1...',
  'unlockDate': '2020-10-10T14:48:00',
  'chainId': 'akashnet-2',
  'distributionAmount': 10000
}

POST /faucet

Request funds from the faucet. Requires an access token.

Params

{
  'address': 'akash1...'
}

Response

{
  'transactionHash': 'A5BE0243169DAF5A...'
}

GET /users

Returns an array of users who have used the faucet. Requires an access token with the manage:faucet permission.

Response

[{
  'id': 1,
  'sub': 'github|1',
  'nickname': 'username',
  'name': 'User Name',
  'email': '[email protected]',
  'picture': 'http://image.com/user.jpg',
  'createdAt': '...',
  'updatedAt': '...'
}]

GET /transactions

Returns an array of transactions sent from the faucet. Requires an access token with the manage:faucet permission.

Response

[{
  'id': 1,
  'userId': 1,
  'address': 'github|1',
  'amount': 100000,
  'transactionHash': 'A5BE0243169DAF5A...',
  'user': {
    ...
  },
  'createdAt': '...',
  'updatedAt': '...'
}]

GET /blocked-addresses

Returns an array of blocked addresses. Requires an access token with the manage:faucet permission.

Response

[{
  'id': 1,
  'address': 'akash1...',
  'createdAt': '...',
  'updatedAt': '...'
}]

POST /blocked-addresses

Create a blocked addresses. Requires an access token with the manage:faucet permission.

Params

{
  address: 'akash1...'
}

Response

{}

DELETE /blocked-addresses/{id}

Delete a blocked address.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.