A self-hosted, community-built (unofficial) alert system for silo.finance interest rates.
Decentralized lending protocols present unique challenges for alerting systems, especially when managing high-stakes positions vulnerable to liquidation. In cases of downtime / alert failures where liquidations are involved, traditional alert service providers may feel/face some perceived role of responsibility/culpability. This may deter would-be alert providers from offering such services.
To address this, our project focuses on a "run it yourself" approach, below is a guide to set up and run your own alerting service for silo.finance. By self-hosting, you maintain control and responsibility, reducing reliance on third-party alerting services.
This codebase is continually evolving and may contain bugs. It is not intended to be a standalone, mission-critical service. Instead, it should be part of a broader, redundant alerting framework to enhance reliability. This project advocates for a robust alerting strategy in the DeFi space. A healthy setup should include multiple, independently-developed alerting systems running in parallel.
Assuming a user has an account on all of the service providers outlined in the tutorial, one can get set up in under 15 minutes (else a few more minutes will need to be spent on signing up for the required services). This project is built to be easy to self-host. No technical knowledge is required.
Since this project relies on self-hosting, it is necessary to pay some hosting fees. The tutorial below guides a user through a method to get this system running for $5 per month. The $5 a month will be the cheapest option for DigitalOcean's instance of the alert provider. The free tier of Alchemy should be sufficient in most cases.
Please create an account on the following websites (log in if already registered):
- Discord
- GitHub
- DigitalOcean
- Alchemy (Free Tier)
Fork this repo onto your own GitHub account:
Select your username from the "Owner" dropdown, you can leave the rest as default and then click "Create Fork":
Congratulations, you will now have this repo forked onto your own account, the new repo URL will look something like this: https://github.com/YOUR_GITHUB_USERNAME/silo-observer-alert
.
Navigate to your apps on Alchemy.
We need to create an "app" for Ethereum Mainnet & Arbitrum Mainnet. If you have just signed up for Alchemy, there is a good chance that an "app" for Ethereum Mainnet has already been created, in which case we only need to add the Arbitrum app.
If you don't have an Ethereum Mainnet and an Arbitrum Mainnet app, create what's missing:
Ethereum Mainnet Config:
Arbitrum Mainnet Config:
Congratulations, you've created what we need for our alerting service to query the Ethereum & Arbitrum blockchains for data.
Navigate to the applications section of Discord's Developer Portal.
Click "New Application":
Add a name for your application, we call ours "alert.silo.observer" but you can call yours whatever you would like to:
Once created, we'd recommend adding a profile picture to your bot for the sake of making notifications easier to spot. Feel free to use this picture. The rest of the settings can be left in their default state.
You will now open up a line of communication with your bot. Due to how Discord works, the only way to open up your line of communication with your bot is to first add the bot to a Discord server that you own, you will then see the bot in the list of members of the server and can send the bot a DM to grant the bot the ability to DM you (it's enough to just send a message that says "hello").
If you don't already own a Discord server, just quickly create one (click "add a server" / the "+" icon at the bottom of your list of Discord servers).
Once you have your own Discord server, navigate to the applications section of the Discord Developer Portal and select the application which you have created.
Once your application is selected, copy the "Application ID" of your bot:
Now, using the following link as a template, but replace "APPLICATION_ID" with your bot's "Application ID":
https://discord.com/api/oauth2/authorize?client_id=APPLICATION_ID&permissions=0&scope=bot%20applications.commands
Example of the edited link (don't use this link, it's just demonstrating the replacement of "APPLICATION_ID" with an Application ID):
https://discord.com/api/oauth2/authorize?client_id=1234567890123456789&permissions=0&scope=bot%20applications.commands
Take your adjusted link using your own Application ID and navigate to the link in your browser (where you are signed into Discord):
Congrats, your bot should not be added to the server!
P.S. "the developer" in the context of the screenshot above refers to you, since you created this app within Discord's developer portal.
Next, open up the communication channel with the bot by finding it in your server:
Once you have sent a message to the bot, you won't get a reply yet, but our message will have enabled the bot to DM us once our alert service is running, this is all we need to do for now:
We are almost done! Now we are going to gather all of the necessary environment variables that we need for our alerting service to run smoothly. Please copy the following into a text editor of your choice:
ALCHEMY_API_KEY_ETHEREUM=""
ALCHEMY_API_KEY_ARBITRUM=""
DISCORD_BOT_TOKEN=""
DISCORD_BOT_CLIENT_ID=""
DISCORD_USER_ID_LIST=""
ACCOUNT_WATCHLIST=""
Now we just need to fill in the values, I will explain where each value can be found, going in order from top to bottom:
Navigate to your apps on Alchemy and copy the API Key for your Ethereum Mainnet app, add this value to the quotes for ALCHEMY_API_KEY_ETHEREUM
(e.g. ALCHEMY_API_KEY_ETHEREUM="YOUR ETHEREUM API KEY"
):
Navigate to your apps on Alchemy and copy the API Key for your Arbitrum Mainnet app, add this value to the quotes for ALCHEMY_API_KEY_ARBITRUM
(e.g. ALCHEMY_API_KEY_ARBITRUM="YOUR ARBITRUM API KEY"
):
Navigate to Discord's Developer Portal, go to your app that we created in step 4, switch to the "Bot" tab and then click "Reset" to get your bot's token:
Once the token resets, it will show the new token near where we clicked "Reset", copy the whole value into the quotes for DISCORD_BOT_TOKEN
(e.g. DISCORD_BOT_TOKEN="YOUR DISCORD BOT TOKEN"
):
Navigate to Discord's Developer Portal, go to your app that we created in step 4, from the "General Information" tab and then click "Copy" on your bot's Application ID:
Copy the whole value into the quotes for DISCORD_BOT_CLIENT_ID
(e.g. DISCORD_BOT_CLIENT_ID="YOUR DISCORD BOT CLIENT ID"
).
This represents the Discord User ID of your own Discord Account, this is the user that our alert bot will try to inform of any alerts. You can place multiple values into this field, just separate them using ";". Make sure you have messaged the bot as we did at the end of Step 4 from each Discord account in order to ensure that the bot has permission to DM you.
Copy the whole value into the quotes for DISCORD_USER_ID_LIST
(e.g. DISCORD_USER_ID_LIST="YOUR DISCORD USER ID"
or DISCORD_USER_ID_LIST="YOUR DISCORD USER ID;SOME OTHER DISCORD ID"
).
This represents the Ethereum/Arbitrum accounts that we want the alert bot to keep an eye on the interest rates of, here you will place your wallet addresses so that the alert bot knows which silos it should be alerting you about. You can place multiple values into this field, just separate them using ";".
e.g. ACCOUNT_WATCHLIST="0x0000000000000000000000000000000000000001"
or ACCOUNT_WATCHLIST="0x0000000000000000000000000000000000000001;0x0000000000000000000000000000000000000002"
You should now have values for all of your required fields in a text editor:
ALCHEMY_API_KEY_ETHEREUM="YOUR ETHEREUM API KEY"
ALCHEMY_API_KEY_ARBITRUM="YOUR ARBITRUM API KEY"
DISCORD_BOT_TOKEN="YOUR DISCORD BOT TOKEN"
DISCORD_BOT_CLIENT_ID="DISCORD_BOT_CLIENT_ID"
DISCORD_USER_ID_LIST="YOUR DISCORD USER ID"
ACCOUNT_WATCHLIST="0x0000000000000000000000000000000000000001;0x0000000000000000000000000000000000000002"
It's recommend to save this file somewhere locally.
We are now ready for the final step of the process!
Now that we have done all of the preparation, the only thing left to do is deploy our alert bot!
While logged into DigitalOcean, navigate to the apps page, and click "Create App".
Once on the "Create App" screen, set the Service Provider to GitHub and then click the "Edit Your GitHub Permissions" option near the bottom:
Next, select your own account to install the DigitalOcean app on your GitHub account:
Pick the "Only select repositories" option and then pick the "silo-observer-alert" repo from the list, you can then click "Install & Authorize":
You will now be redirected back to DigitalOcean and able to select your repository from the dropdown. Leave the settings in their default state with "Autodeploy" selected. Click "Next":
By default, a ~ $25 "pro" plan is selected, we can adjust this down to a "basic" $5 instance:
This is up to you to do depending on your budget, but leave "containers" set to 1 even if you decide to go with a more expensive option:
Confirm the resource sizing options:
Now we will set our environment variables:
Switch to the "Bulk Editor" view:
Paste the contents of your environment variables which we gathered in Step 5:
Remember to save your imported variables, and then click "Next":
Adjust your region if preferred, then click "Next":
If everything looks good to you (mostly cost), click "Create Resources":
That's it! If everything went according to plan and all steps were correctly followed, after around 5-10 minutes you should receive a message from your bot on Discord (if you don't end up receiving a message from your bot, then please get in touch via the support details at the bottom of this document):
Updates and upgrades to this project can be deployed to your instance by merging the main
branch of this repo into the main
branch of your fork. If you followed the deployment steps above or have used a similar methodology to the above, any changes that you merge into your fork will automatically be deployed.
If you run into any trouble or have questions, please consult the Questions / Support section at the bottom of this document.
If you have any questions or need any help, please feel free to join the silo.observer Discord server, or alternatively ping @JayWelsh on the silo.finance Discord server.