How to start using your own Ethereum bot — no code edition

Gelato
Gelato Network
Published in
11 min readFeb 8, 2020

A manual for play.gelato.finance

On play.gelato.finance you can get your own Ethereum bot and submit Instructions to it

Quick Recap:

What is gelato?

- “Your personal Ethereum bot.

Gelato is your personal Ethereum bot that will execute and automate transactions for you, in accordance with instructions and allowances prescribed by you.

Why do I need a gelato bot?

- “Be woke, not broke.”

You, the mere human, cannot always be online and connected to Ethereum, in order to transact just when the Conditions (market, price, account balance, time …) are right.

So why not have your own bot do the manual work for you? Your bot can monitor the Ethereum network for you 24/7 and transact on your behalf when the Conditions, specified by you, are met.

What is play.gelato.finance?

- “An easy-to use web interface, to deploy, instruct, monitor and manage your gelato bot”

While gelato is your bot, play.gelato.finance is the tool that lets you talk to your bot. You can use it to submit Instructions to your bot and view your bot’s activity. Think about Instructions like transactions that your bot should execute for you, as soon as your pre-defined condition is met.

What can I do with my gelato bot?

- “Automate all your future Ethereum activity — also for Dapps”

On the gelato web interface you can create Instructions for your bot. These Instructions consist of sets of two components: Conditions and Actions. A Condition specifies the thing that you want your bot to keep monitoring. For example, your account balance, blocktime, or the ETH/DAI price on Kyber Network. An Action is what your bot should do with funds from your wallet if, and only if, your specified Condition is satisfied. Say, for instance, send tokens to your hot wallet from your cold storage, if the hot wallet balance is low. This means your bot can basically handle automatic account top-ups for you (this feature will be available on the UI soon). What else: maybe buy some ETH on Kyber, if the ETH-DAI price dropped? The list goes on. Your bot will constantly check the network for your Conditions, and execute transactions, with your funds, in accordance with your Action Instruction.

How do I get my gelato bot?

- “Deploy your bot in only 1 Ethereum transaction”

All you need to do, in order to have your own gelato bot available to you, is to deploy it on play.gelato.finance. This is a one-time thing you have to do. Well, to be precise, you have to do it once for every wallet that you use to connect with on gelato, if you want that wallet to also be upgraded to gelato’s automated transaction capability. You will be prompted to deploy your gelato bot at the end of creating your first instruction.

Let’s get to it!

FIRST TIME GELATO USER EXAMPLE WALKTHROUGH

“Automatically swap your KNC for DAI on Kyber, if the KNC/DAI price dropped — a so-called ‘stop-loss’ trade”

This example walkthrough will guide you through your first time usage of play.gelato.finance. The key takeaways from this walkthrough are:

  1. How to sign in on gelato
  2. How to create an Instruction for your bot by specifying a Condition-Action pair.
  3. How to deploy your own bot
  4. How to approve your bot to have access to the token that you want to schedule a conditional Action for.
  5. How to submit your Condition-Action Instruction to your bot.
  6. How to monitor your bot’s activity and the status of your submitted Instructions.

In this specific example, we are a first time gelato user, and we want to instruct our bot to convert some of our KNC into DAI, but only if the KNC/DAI price dropped by 0.10 DAI below the current market KNC/DAI rate. Here goes:

Step1: VISIT play.gelato.finance

play.gelato.finance: The web interface for deploying your gelato bot and for passing Instructions to it.

Step2: CONNECT YOUR METAMASK

At the moment Metamask is the only web3 wallet option. Soon more will follow.

You need to have ETH on there, to be able to deploy your bot and submit Instructions to it.

Step3: SELECT YOUR CONDITION

In our walkthrough example we want our bot to act upon price changes in the Kyber Exchange Network.

Other Conditions include monitoring an account’s balance or scheduling based on Time.

Step4: SELECT YOUR ACTION

Here we want our bot to Trade Tokens on Kyber, but only when our Price Condition is met by the market.

Other Actions include Sending Tokens or Buying and Selling Leveraged Tokens
The resulting Condition — Action pair that composes our example Instruction

Step5: INSTRUCT BOT

Step6: SET CONDITION

Instruct your bot Step1: Set Condition

For our example we want to sell our KNC into DAI, if the current KNC/DAI price drops by 0.10 DAI, in order to put a hold on our losses should the KNC price decrease in the near future. This type of trade is also known as an automatic “stop-loss”. So in our Condition, we want to monitor the KNC/DAI rate. We set the Price Condition to the exact same (future) price that we want to sell our KNC into DAI at. However, we need to take into account that rates on Kyber depend on how much of a Token we want to sell. So to specify our Price Condition we need to:

  1. Set Sell Token to KNC
The number, 30.48 …, is our connected wallet’s current balance of Sell Token

2. Set our SellVolume

For this example, it makes sense to use the exact amount of KNC we intend to sell, so that the Condition accurately reflects the price we want our bot to monitor and act upon. So, if we want to sell 30 KNC for DAI, if the price drops, then we should fill in 30 KNC as Sell Volume into this Condition field.

Remember that Sell Volumes might also have an effect on the price per unit sold. This is the case on Kyber, Uniswap, and many other decentralized exchanges.

3. Set our BuyToken to DAI

The number, 15.6… , is our connected wallet’s current balance of Buy Token

Now we can see the current KNC/DAI price based on the KNC SellVolume we inputted:

The current KNC/DAI price based on our inputted Sell Volume

4. Set the Price Condition we want our bot to act upon

Lastly, and most importantly, we now need to set the KNC/DAI Price at which we want our bot to sell our 30 KNC into DAI for us. Since we said we only want to do that, if the KNC/DAI price drops by 0.10 DAI compared to the current price of ~0.36 DAI per KNC, we fill in the last box like so:

The price at which we want our bot to react and transact for us

Here you can compare the current price, with your specified price condition:

And you can also always double-check the auto-generated Condition description above

Click Next and ….

Step7: SET ACTION

Now that we have our KNC/DAI price condition set, we want to specify what our bot should do, if our condition is actually met by the market. We need to specify the “Action” it should take. For our example, we already specified that we then want our bot to Trade Tokens (KNC) on Kyber. Now we need to add more details to our Action Instruction.

Instruct your bot Step 2: Set Action

In our Condition, we set the price rate at which we want to swap our 30 KNC for DAI to 1 KNC = 0.26 DAI. So in the Action we now:

  1. Select KNC as Sell Token
The number, 30.48 …, is our connected wallet’s current balance of Sell Token

2. Input 30 as Sell Volume

This box is currently labelled Sell Amount but means the same as “Sell Volume”

3. Select DAI as Buy Token

Click Next and ….

Step8: CHECK THE INSTRUCTION SUMMARY

Now we want to check our Instruction Summary and make sure we did everything right.

Read the auto-generated Instruction Summary text. You can also check the dynamically generated Current Price and Current Sell Token Balance fields.

The auto-generated Instruction Summary text says:

If 30.0 KNC are worth 7.800.. DAI (1 KNC = 0.26 DAI) or less on Kyber

This is our Price Condition. And it is correct. We want to sell 30 KNC for DAI, if the KNC/DAI price drops to 0.26 DAI. Remember that the current KNC/DAI price in our example is at ~0.36 DAI

Then your gelato bot will sell 30.0 KNC for DAI on Kyber

Correct. If the KNC price drops to 0.26 DAI, we want our bot to sell our 30 KNC into DAI for us.

Make sure to read through the Condition and Action summary details again. Here you can also check the Current Price Condition again

and you can also check that you have enough tokens available for your bot in your wallet. In our case it is 30 KNC that we need.

All good, we are set! Click Next and ….

Step8: Submit Instruction

You can submit as many Instructions as you want to your bot.

Step9: DEPLOY YOUR BOT in Transaction #1

You need to pay gas for this transaction.

In this example, we are first time gelato users, and do not have our bot yet. So we first need to deploy our bot. We only have to do this once per wallet that we want to automate transactions for on play.gelato.finance.

Once deployed, your bot will work 24/7 for you

Confirm the bot deployment transaction on Metamask.

A Metamask window will pop open and ask you to confirm the transaction.
You cannot click Continue before this Success window appears.

Step10: APPROVE YOUR BOT in Transaction #2

Approving your bot to access one of your tokens means sending an Ethereum transaction that you have to pay gas for.

In this example, our bot needs to have access to our 30 KNC, in order to be able to convert it to DAI, when the price is ripe.

Your bot can only act on your behalf, if you have approved it for any tokens you want actions for.
Always check your Metamask to confirm any transaction you send on play.gelato.finance
You will see a window like this for all 3 transactions of this example walkthrough
You can already click Continue after you confirmed the transaction in Metamask.
Now we are ready to submit the Instruction to our newly deployed bot

Step11: SUBMIT INSTRUCTION TO BOT in Transaction #3

This is the 3rd and final transaction step that we as first time gelato users have to get done. Now we are going to submit our Instruction to our newly deployed bot. In our future usage of gelato, we sometimes still need to send approval transactions, to give our bot access to our funds. However, if it already has our approval to spend a token, we will only need 1 transaction to submit a new instruction to our bot. Let’s get on with our very first Instruction

This Instruction Submission transaction is like a notification that we send to our bot, with the details of our Condition and Action in it.

Here we can see that on top of the usual Transaction Fee we have to pay on Ethereum, we also need to pay a Gelato Fee. The reason is that your bot will have to pay for any gas it will use, when executing transactions for you, in the future. So the “Gelato Fee” is basically an Ethereum Transaction Fee deposit that your bot needs, in order to be able to transact on the network on your behalf.

This time we have to wait for the transaction to be mined.

Step12: Your bot has received your Instruction and begins working for you

Next Steps: Either check your Bot Activity or Share your Instruction with the Twitter Community.

Step13: My Bot Activity

Here we can see all the Instructions we have submitted to our bot.

Instructions can be in status:

  • open: your bot is working but your Condition was not there yet.
  • successfully executed: your Condition was there and your bot executed your specified Action for you.
  • cancelled: you cancelled your Instruction or it expired and you forgot to cancel it beforehand.
  • issueplease contact us: there might be a problem with your bot that you should contact the gelato team on Telegram for.

Step14: Instruction Details

Here you have an overview over all your Instruction’s details. We will take a look at the details of the Instruction we just created. Please take note that your Instruction has an expiry date. An Instruction expires, if the Condition you specified was never reached and the Instruction’s lifespan is over. You can always cancel an Instruction to reclaim your Gelato Fee deposit, but only before it has expired. After that you cannot reclaim your Gelato Fee deposit.

The KNC/DAI Current Price and Current Sell Token Balance fields are dynamically updated.

Optional Step: Cancel

You can cancel any Instructions that are “open”

You can always send a transaction to cancel your open Instructions. Please be aware that Instructions for your bot also have an Expiry Date. If your Condition never happens before expiry, and you do not cancel the Instruction, you will not be able to cancel the Instruction any more, in order to get your Gelato Fee deposit back.

Cancelling an Instruction also requires an Ethereum transaction because your are writing to your bot on the Ethereum database.
You have to pay some gas for cancelling an Instruction.
Confirm the cancellation transaction in Metamask because ETH from your wallet will be used to pay for gas.
Done. You can close this window.

You can check the Transaction on Etherscan and see that some ETH was transferred back to your wallet. This is the Gelato Fee deposit you prepaid when you submitted the Instruction, which you just cancelled.

You will see that “My Bot Activity” will reflect the new Instruction Status

END OF EXAMPLE WALKTHROUGH

Wow. We made it. And boy does Ethereum’s User Experience still suck! Sorry for that. Tell us about it. We are working on it. Patience….. We’ll get there eventually.

On the slim chance that any of the readers made it to here without starving, here is some bonus material:

Another last use case example, please?

- “If MKR/DAI price increases, go short on Maker ”

Same as the walkthrough example, just this time your bot will take your funds to buy Short-MKR leverage tokens for you, but only if the MKR/DAI price increased into the range of your price Condition.

Last but not least. Gelato is in Alpha and the smart contracts are NOT AUDITED. Therefore, use at own risk and with caution.

Sweet like ice cream!

--

--