Faucet agent that drips token using delegation
This tutorial shows you how to build a faucet agent using the Brewit Agent Template. The agent uses Brewit’s delegation system to distribute tokens from delegated accounts, providing a secure and efficient way to run a token faucet service.
Clone the Agent Template
Start by cloning the Brewit Agent Template repository to your local machine.
Install Dependencies
Install all required dependencies using your preferred package manager.
Configure Environment
Set up your environment variables by copying the example file and adding your configuration.
Edit the .env
file with your configuration:
Configure Agent Settings
Set up your agent configuration by editing the config file with your private key and salt.
Start the Agent
Launch the development server to start your faucet agent.
The agent will start on http://localhost:8002
Once your agent is running and you have set up delegation, here’s the complete flow to claim tokens:
Get Agent Information
First, get the agent’s validator information by querying the info endpoint.
This returns the agent’s validator details needed for delegation setup.
Set Up Delegation
Create a delegated account using the validator info from the previous step. Follow the delegation guide to set up the delegated account for the agent.
The delegated account will have permission to spend tokens on behalf of the main account, enabling the faucet to distribute tokens securely.
Claim Tokens
Once delegation is set up, you can claim tokens from the faucet using the claim endpoint.
The faucet agent uses Brewit’s delegation system to distribute tokens securely:
Edit src/executer/index.ts
to change the token distribution amounts:
Add rate limiting to prevent abuse in src/routes/faucet.ts
:
Add auto claim flow using a scheduler to drip tokens every hour or day
Add auto swap flow to convert existing token if the requested token doesn’t exist
Faucet agent that drips token using delegation
This tutorial shows you how to build a faucet agent using the Brewit Agent Template. The agent uses Brewit’s delegation system to distribute tokens from delegated accounts, providing a secure and efficient way to run a token faucet service.
Clone the Agent Template
Start by cloning the Brewit Agent Template repository to your local machine.
Install Dependencies
Install all required dependencies using your preferred package manager.
Configure Environment
Set up your environment variables by copying the example file and adding your configuration.
Edit the .env
file with your configuration:
Configure Agent Settings
Set up your agent configuration by editing the config file with your private key and salt.
Start the Agent
Launch the development server to start your faucet agent.
The agent will start on http://localhost:8002
Once your agent is running and you have set up delegation, here’s the complete flow to claim tokens:
Get Agent Information
First, get the agent’s validator information by querying the info endpoint.
This returns the agent’s validator details needed for delegation setup.
Set Up Delegation
Create a delegated account using the validator info from the previous step. Follow the delegation guide to set up the delegated account for the agent.
The delegated account will have permission to spend tokens on behalf of the main account, enabling the faucet to distribute tokens securely.
Claim Tokens
Once delegation is set up, you can claim tokens from the faucet using the claim endpoint.
The faucet agent uses Brewit’s delegation system to distribute tokens securely:
Edit src/executer/index.ts
to change the token distribution amounts:
Add rate limiting to prevent abuse in src/routes/faucet.ts
:
Add auto claim flow using a scheduler to drip tokens every hour or day
Add auto swap flow to convert existing token if the requested token doesn’t exist