What was that sound?, I asked Andrej. Oh, it’s just another CryptoKitty being born.
With Tenderly you can set up custom real-time alerts and get notified when anything of your interest happens on the Ethereum Blockchain. Let’s see it in action!
But first: Why is this needed?
In traditional development, your software is your system, so everything that is happening inside of that system is of interest to you. Then came Blockchain, and there is this huge paradigm shift where your software (Smart Contracts) is just a part of an ever-expanding system whose parts are continually interacting with each other.
All of this noise makes it hard to see what is happening with your Smart Contracts. What’s even scarier is that if you don’t actively monitor your Smart Contracts, you’ll probably miss some critical activity that happened during execution.
That’s why last year, at ETHBerlin, we made a proof of concept called Smart Alert and were one of the winning teams. This hackathon showed us just how much a tool like this is desperately needed, so we’ve set out to deliver it for everyone to use.
Tenderly Alerting to the rescue
We’ve built our alerting feature on top of the transaction tracing facilities we used to make our Execution Overview and Stack Trace features, as well as our brand new Visual Debugger. What this means is that our alerting solution is much more robust than anything else out there: want to get alerted when a transaction fails? Done! Want to get an e-mail when a particular function gets called? Your wish is our command!
A bit of show and tell
I was always more of a visual type, so let’s dive into some examples. After going through these examples, you’ll see just how simple and powerful the alerting feature really is!
Get an alert when a transaction fails
Let’s say I want to get alerted whenever any of my Smart Contracts fail. What I would do is the following:
- Use the Tenderly CLI and the tenderly push command to add my contracts to a project
- Go to my project, then the alert tab and configure that if any transaction in that project fails I want to get notified
Now if a transaction ever fails, I get notified instantly. This means that I can act immediately instead of waiting for my Dapp users to contact me that something isn’t working.
Get alerted when a specific function is called
Another great example is that sometimes I want to get alerted when a specific function was called in a transaction. And no, I’m not talking about just the first function that was called in a transaction: I’m talking about getting notified if that specific function was called at any time during the execution of a transaction.
Let’s get notified every time a new CryptoKitty is born:
- I’m going to add the CryptoKitties Smart Contract to my project by importing it from Etherscan by going to my project, then click on Add Contract and paste in the following address: 0x06012c8cf97bead5deae237070f9587f8e7a266d
- Go to the alerts tab and select the Function Call rule
- Pick the KittyCore Smart Contract as the Alert target
- Select the giveBirth function
That’s it! You’ll get an e-mail whenever a cute little CryptoKitty comes into this world. Or not this world, but to the Ethereum blockchain at least.
Get a notification if a Smart Contract gets called from an address that isn’t whitelisted
This one is one of my favorite security-oriented alerts: we can get a notification whenever someone who isn’t whitelisted calls our contract.
For this example, I’ve set up a simple Gnosis Multisig Wallet which you can find here.
- First things first: add the contract to a Project either via the tenderly push command or using the Verified contract feature
- Go to the alerts tab, select the Whitelisted Callers rule, and then select the MultiSigWalletWithDailyLimit Smart Contract
- I’ve added the following addresses to the whitelist (the owners of the Multisig wallet):0xc9E094Deb826b00D10af0aB3D2A62d712e89F67A and 0xC4dFd227848Fbe6640ab14c9C339845BEd350665
Now, whenever someone other then the owners of the Multisig Wallet calls this Smart Contract I’ll get an e-mail instantly so that I can react accordingly.
Won’t this spam the hell out of me?
Don’t worry, we have a smart delivery algorithm for the e-mails we send your way. You will get notified instantly when something happens, and afterward, you will receive aggregated notifications when it makes more sense. So you’ll have both the latest alerts from Tenderly and the latest and greats from Netflix at the top of your inbox!
What you just saw is something we call simple alerting. It covers a lot of common use-cases seen around the Blockchain world:
- Successful Transaction - Get notified if a transaction has succeeded
- Failed Transaction - Get notified if a transaction has failed
- Whitelisted Callers - Get notified if an unknown address calls your Smart Contract
- Blacklisted Callers - Get notified if a specific address from the blacklist calls your Smart Contract
- Function Call - Get notified if a specific function gets called in a transaction
And we’re not stopping here. Very soon we are going to release additional improvements :
- Get alerted if another Smart Contract calls your Smart Contract
- Get alerted when a function is called with a specific argument
- Use operators like greater than, equal, etc. to compare function arguments
- Get alerted when a Smart Contract event is emitted
- Slack as an additional delivery channel for your alerts
And I saved the best thing for last: we’re making a robust alert builder which will let you combine all of the rules mentioned above in any way you see fit!
If you have any ideas for a specific alerting rule you would like to see us implement, a delivery channel you would like us to add (*cough* Telegram *cough*) or just want to have a call or chat with us you can always reach us on our Discord or by shooting us an e-mail over at email@example.com .