API Distribution
This distribution method is an application owned distribution method as opposed to an on-chain distribution. The API facilitates 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.
Implementation Example
-
Create project folder
Open up your terminal and start by cloning the Github Repo
In order to create a project using Node.js and NPM. You can verify that you have Node.js installed by running:
You should see a number such as 18.12.0 OR a response saying that the command node is not recognized. If you see the former, continue, else head over to the Node.js website and install Node.js on your computer.
Once you have Node installed, proceed to the project creation.
-
Install Dependencies
Run the following in your terminal to install the project dependencies
-
Add Environment Variables
Run the following in your terminal
Add an Ethereum private key to your .env file and change the RPC to match your SKALE Chain. The default RPC_URL is set to the Chaos Testnet.
-
Run the API
To run the API locally and hot-reload when changes occur, run:
To run the API without hot-reload, run: