Introduction

Build Your Own Bot (BYOB) is a Solana web application to create (advanced) workflows and then run them yourself or automate them by creating (literally!) your own bots

BYOB is a very powerful tool to create either simple workflows like limit orders or DCA bots to ultra advanced defi use cases like flash loan collateral swaps or flash loan arbitrage bots. Before diving deep into what BYOB is and can do, here are some use cases that you can set up in order to get an understanding of the protocol.

Use cases

Automated DCA bot

Suppose you want to Dynamic Cost Average (DCA) into a position slowly over time. At BYOB, you can create a workflow that swap for example $100 for SOL and then create a bot that executes this every day or every week, but only if $SOL < $25.

This take only a few minutes to set up, and it will run for as long as you like! Here's how you can do it:

Step 1

Create a bot account. Navigate to https://www.byob.so/app/botaccounts/ and press the Create button

Step 2

Fund your bot account with some SOL to be able to send transactions and some USDC so you can actually buy SOL with it to do the DCA. Note that the bot account is just a Solana account, so you can just send funds to it. You can also export the private key and import it into your own wallet for easy management. Do keep the key safe though!

Step 3

Create the workflow. It's just a simple Jupiter swap, here's a screenshot of how it could look:

Step 4

Set up the bot to run every day and only execute when SOL < $25. Like this:

Step 5

Create the workflow! After you created it you are redirected to the bot accounts page. There you can click on "View logs" where all the executions and their transaction hashes are stored.

You now have created a bot that automatically buys $100 of SOL every day for as long as SOL < $25

Limit orders

Suppose you want to sell 100 SOL at $100. Create a workflow that sells 100 SOL for USDC, and let it run every 6 hours. Only execute it when SOL > $100, done!

Here's a step by step solution on how to create a limit order:

Step 1 & 2

First create the bot account and fund it, like step 1 and 2 above

Step 3

Create the workflow. It is again a simple Jupiter swap like above, but select SOL as the input token and USDC as the output token, like this:

Step 4

Create the bot by executing it only when SOL > $100 and run it every 6 hours, like this:

Step 5

Create the workflow! After you created it you are redirected to the bot accounts page. There you can click on "View logs" where all the executions and their transaction hashes are stored.

You now have created a bot that automatically buys sells 100 SOL when SOL is >$100, and it checks every 6 hours for you

A flash loan BONK arbitrage bot

Here's a more complex case. Please note that arbitrage bots generally won't be profitable because dedicated arbitrage bot developers can create much more efficient bots than the BYOB no-code solution. However, it is a nice showcase of the power of flash loans. Keep in mind that running this most probably won't make you any money.

Step 1 & 2

First create a bot account and fund it like before. Note that you only have to fund it with SOL as we're going to flash loan the BONK. Also note that you can use the same bot account for multiple workflows, no need to create multiple ones. But you can, if you want to split the funds for some reason.

Step 3

Create the workflow. First flashloan 100000 BONK and then swap BONK for BONK. If there is a profitable arb, the output should show that we get more BONK back.

Note for this tx, we first flash loan 100000 BONK and then do an arbitrage with it, which yields us 100226 BONK. 226 BONK profit!

Do note however that flash loan mastery (the name of the flash loan protocol that is used, see on the top left) takes a small fee. So for a profitable arbitrage, we might need to wait until a better arbitrage opportunity is there.

Step 4

Suppose we want to only run this if we get at least a 1000 BONK profit, so we can pay off the flash loan fees and then are left over with a nice profit. In that case we can set up the bot like this:

We run the bot every minute and check that the bot balance change of BONK is > 1000. So this only executes the transactions if we profit from the arb. But again, you will probably lose from the dedicated programmed arb bots.

Last updated