How to give an AI agent limited access to your crypto wallet
An AI agent that trades for you needs a way to move your tokens. The usual way to give it that ability is to give it your private key, which means giving it everything you own, on every chain, forever. Hopivia uses a different model: the agent gets a spending limit enforced by a smart contract, not a key.
Why a private key is the wrong tool for a bot
A private key cannot be limited. Whoever holds it can send any token, in any amount, to any address, and there is no way to take it back except moving all funds to a new wallet. For a bot this is a bad fit for three reasons:
- The bot's code is the weakest link. A bug, a leaked environment variable or a prompt injection in an AI agent exposes the key, and with it the whole wallet.
- Scope cannot be narrowed. You cannot tell a key "only USDT, only 50 a day". Exchange API keys can be restricted to trading, but they live on a centralized exchange that holds your funds.
- Revocation is slow and expensive. Rotating a key means creating a new wallet and moving every asset.
What "limited access" means on Hopivia
Delegated access is a smart contract that sits between the agent and your wallet. You, the wallet owner, record a limit for the agent's own address:
- Which tokens the agent may sell and which it may receive. The network's native coin is always allowed as the output.
- How much per day of each token, counted per calendar day in UTC.
- Until when. After the expiry date the limit stops working on its own.
- Where the output goes. Always to your address. The agent cannot redirect it.
- Revocation. One transaction removes a token, an agent or every limit at once.
The agent trades with its own wallet and pays its own gas. It never holds your private key and never holds your funds: the contract pulls the input token from your wallet, swaps it on one of the allowed exchanges and sends the result back to you in the same transaction.
How it works, step by step
- Open the AI agents page on Hopivia, connect your wallet and enter the agent's address, a token, a daily cap and an expiry date.
- Confirm two transactions: a token allowance for the contract, capped at "daily cap × days until expiry", and the limit itself.
- Give the agent the address of the contract. It asks the Hopivia API for the best route and calls the contract's
swapfunction with its own wallet. - Watch the limits on the same page: how much was spent today, when the counter resets, when the limit expires. Remove or revoke at any time.
What the agent can and cannot do
| Action | Possible? |
|---|---|
| Sell an allowed token for another allowed token or the native coin | Yes, within the daily cap |
| Sell more than the daily cap | No, the contract reverts |
| Trade after the expiry date | No |
| Buy a token you did not allow | No |
| Send the output anywhere except your wallet | No |
| Use an exchange outside the contract's list | No |
| Move funds without a limit for its address | No |
| Sign a message or transaction on your behalf | No, it never has your key |
What a limit protects against, honestly
A limit caps damage; it does not make a bad agent good. If an agent picks a poor route or trades at a bad moment, the most you can lose is the daily cap of each allowed token, every day until you revoke. Set the cap at an amount you would accept losing in a single day, allow only the tokens the strategy needs, and set the expiry to the length of the experiment rather than "forever".
Where it is available
Delegated access is rolled out network by network. The AI agents page lists the networks where the contract is live and its addresses. The contract has no owner and no admin functions, and the list of exchanges it may use is fixed at deployment.
FAQ
Does the agent see my private key?
No. The agent uses its own wallet. Your wallet only signs the two set-up transactions, and later any changes to the limits.
Can the agent withdraw my tokens to its own address?
No. The output of every swap goes to the wallet owner. The agent's address appears only as the caller.
What happens on the next day?
The counter resets at 00:00 UTC. If the agent used 40 of a 100 USDT cap, it can sell 100 USDT again the next day.
What if I lower the limit in the middle of the day?
The amount already spent today stays counted. With 60 spent and the cap lowered to 70, the agent has 10 left until midnight UTC.
Is this the same as a token approval in MetaMask?
Partly. The owner gives the delegation contract a normal ERC-20 allowance, but Hopivia sets it to "daily cap × days" rather than unlimited, and the contract itself enforces who may use it, for what and how much per day.
Can I set a one-time amount instead of a daily cap?
Yes. On the agents page switch the limit from "Per day" to "One-time (total)". The allowance to the contract is then set to exactly that amount: once the agent has sold it, the limit is used up even if the end date has not come.
The bot has no wallet yet. What do I give it?
The bot needs its own address only to sign its trades; your funds never move there. If the bot does not have one, the agents page can generate a fresh wallet for it: copy the private key into the bot's settings (it is shown once and stored nowhere) and send the address a little of the network coin for gas.
Updated: