sFUEL API Distribution

The API distribution method is an application owned distribution method as opposed to an on-chain distribution. The API faciliates sFUEL distribution to users by exposing an API endpoint through a public or private endpoint.

The default infrastructure option showed in the documentation is public by default as well as very minimal. It is designed to be easily extended by projects with various middlewares, protections, etc.

Code samples and recipes provided are examples of this method, however, may not be suitable for production use.

Head over to the Infrastructure Guide for API distribution and learn how to setup your own sFUEL API Distributor using Node.js.

About the API

For the above sFUEL API Distribution example, once the application is setup and running there are a few things to be aware of:

  • The API will run by default on 8888. You can change this in the index.js file or pass in a dynamic port through the environment.

  • The API exposes a publicly available endpoint at GET /claim/:address where the address should be a valid Ethereum address

  • The PRIVATE_KEY passed in through the .env must have enough sFUEL to cover costs otherwise the application will fail

  • The RPC_URL passed in through the .env should be a valid testnet or mainnet SKALE Chain RPC endpoint

  • If you don’t see a .env and are unsure how to create one run touch .env.example .env in your command prompt