Why does an agent need a Wallet?
To enable an agent to interact with the blockchain—such as autonomously executing trades—you must create a wallet and grant the agent control access. This allows the agent to sign transactions, for example, swapping assets based on its financial decisions.Wallet Setup
Before using the wallet, you must either- create a new Solana wallet
- or import an existing wallet
Creating a Wallet
Use the following command to create a new wallet:~/secret/.private_key.json
. You can specify a custom path using the --path
flag:
Importing an Existing Wallet
To import an existing wallet, use one of the following methods: Import from a fileSOLANA_KEY_PATH
in .agents.env
.
Request Airdrop
To help developers test the framework, Galadriel provides a faucet service that can fund your wallet with test tokens. To request a small amount of SOL from the faucet service, execute the following command:- One request per wallet address every 24 hours
- One request per IP address every 30 minutes
Using a Wallet in an Agent
Prerequisites
Important: Ensure your wallet is funded before use. Without sufficient SOL, Web3 tools may fail due to a lack of gas fees or available funds.Agent Code Example
Once the wallet is set up, it is automatically accessible by Web3 tools. To use it, simply include Web3 tools in your agent’s toolset. Below is an example of how to enable the agent with the Jupiter tool for token swapping. The agent can call theswap_token
function using the previously set up wallet to execute swaps when needed.