In this tutorial we will review the toolkit features of the Tenderly application. Tenderly is a platform that offers several useful tools for Solidity smart contract developers. The platform provides smart contract monitoring, real-time alerts, analytics and troubleshooting tools. They offer additional features for a fee but for this tutorial we will review their free offerings that are most useful for solidity developers.
Searching for transactions and smart contracts
Tenderly makes it easy to search for a transaction or smart contract across different blockchains. For example input the transaction hash or smart contract address in Tenderly’s search box and the system will search across multiple platforms (Ethereum, Binance Smart Chain, RSK, POA, xDai, Polygon, Avalanche, Optimism, etc.) and different environments (Mainnet or Testnet). Tenderly makes it very easy to find information across platforms.
Search for a smart contract
To search for a smart contract input the address in the search box and Tenderly will search all supported networks. The results Tenderly provides is similar to a traditional block explorer.
- Relevant smart contract information
- ABI data
- Transaction history
- Source code
The benefit to using Tenderly is you can search for an address across all supported platforms (Ethereum, Binance Smart Chain, RSK, POA, xDai, Polygon, Avalanche, Optimism, etc.) in one search request.
Search for a transaction
To search for a transaction input a transaction hash in the search box and Tenderly will search all support networks for the transaction.
- Basic transaction information
- Function called
- Input data
- Execution trace stack
- View source code
- View code execution sequence
- Step through code in the debugger
You can search for a transaction across all supported platforms and have developer tools readily accessible to help with your development and testing activities.
Smart contract monitoring and alert notifications
Use Tenderly to monitor a smart contract and receive a notification for different transaction events (successful transactions, failed transactions, specific function calls, etc.). To get started with monitoring and alerts you need to signup for an account on the Tenderly website. They offer the ability to register for free with Google, Github or any other email account.
Select a smart contract to monitor
To get started with monitoring and alerts first log into your account and add a contract to monitor.
Second add the contract address, select the contract, then import it.
After the import is complete, Tenderly is monitoring the contract. For example Tenderly is monitoring the Dai contract below.
Setup smart contract alerts
Now that the contract is being monitored lets setup an alert. Select alerting then select the setup an alert button.
Select your contract then select the alert type. You can monitor the following types of events:
- Successful transactions
- Failed transactions
- Specific function calls
- Events emitted
- Event parameters match a specific condition
- ERC20 token transfers
- Whitelisted callers
- Blacklisted callers
- ETH balances that fall below a threshold
- When a specific transaction occurs
- Variable state changes
- View function values change
After you select the alert type select the contract that you want alerts for. For example select one of the contract that you setup for monitoring.
Finally select how you would like to receive your alerts. You can setup alerts for email, Slack, Telegram, Discord, Sentry, PagerDuty, etc. After pressing save you will receive an alert when an event meets your saved criteria parameters.
Simulate a transaction on the Mainnet
There are times when you might want to simulate a test transaction to determine how a smart contract will behave. If you want to simulate a transaction on the Mainnet or Testnet you can use Tendery to run a simulation. To get stated log into your account and click on Simulator.
Then select new simulation and the screen below will display. You have several options to run a simulation.
- Perform a simulation using a contract that you are monitoring in Tenderly
- Perform a simulation using a contract that you are not monitoring in Tenderly
Simulation using a contract that you are monitoring in Tenderly
If you select a contract that you are monitoring in Tenderly select the function that you would like to execute:
- Input the function parameters that are required by the smart contract
- Then input the transaction parameters to indicate the block and transaction information that you would like to simulate. Leave block number and tx index blank if you would like to use the current block
- Then press simulate transaction and review your results
Simulation using a contract that you are not monitoring in Tenderly
If you would like to run a simulation on a contract that you are not monitoring in Tenderly use the Custom Contract option. To execute this simulation we need the hex data from the transaction we want to simulate. We can use MetaMask to capture this hex data. For example lets simulate a Uniswap transaction:
- Go to the Uniswap website and submit a swap
- When your MetaMask wallet displays, for you to accept or reject the transaction, select the data tab
- In MetaMask copy the address you are sending to and the hex data into Tenderly’s address and input data fields
- In Tenderly select the network you would like to simulate the transaction on
- Reject the transaction in MetaMask to prevent the transaction from processing
- Then in Tenderly input the transaction parameters to indicate the block and transaction information that you would like to simulate. Leave block number and tx index blank if you would like to use the current block
- Finally press simulate transaction and review your results
Use Tenderly analytics to view graphs of smart contract data. You can view analytics data per contract by using the contract picker. The analytics section in Tenderly allows you to view the following reports:
- Transactions over time
- Events emitted over time
- ETH value over time
- Top callers of the contract
- Top events emitted
- Most active function calls of the contract
- Daily active users
- Weekly active users
- Monthly active users
These reports help you see trends in your smart contracts. View how transaction, users, etc. grow over time. If you wish to view data for all contracts in your project, you can upgrade your account to the Tenderly Developer or Tenderly Pro plan for organizations.