Getting Started With Tenderly for Blockchain Development

Rahul Ravindran

Overview

First things first, we need to get your Smart Contracts into Tenderly to use all of the timesaving features like the Visual Debugger, Gas Profiler, Alerts, and more.

There are a couple of ways we can achieve this: we can use the Tenderly CLI to push contracts to a project, or we can verify our Smart Contracts on Etherscan and then paste in the address into Tenderly. I’m going to go with the first approach.

I already have the CLI installed locally, but if you don’t have it already, it’s effortless to set up. Once you have it installed, run tenderly login.

The next step is to go into your project directory and run tenderly init. As I’m using the Tennis Match example from a previous article, I’m going to pick Create new project and write Tennis Match.

$ tenderly init
✔ Create new project
✔ Project: Tennis Match
Project successfully initialized. You can change the project information by editing the tenderly.yaml file or by rerunning tenderly init with the –re-init flag.

Pushing your Smart Contracts to Tenderly

That’s it! Your project is all set up, and you can push it for the first time to Tenderly.

In order for Tenderly to monitor your Smart Contracts in real-time, you need to push them to your dashboard. Pushing your Smart Contracts is as easy as running the tenderly push command. Let’s try it now:

$ tenderly push
Setting up your project…
Analyzing Truffle configuration…

Pushing Smart Contracts for project: tennis-match
We have detected the following Smart Contracts:
• Migrations
• TennisMatch

Successfully pushed Smart Contracts for project tennis-match. You can view your contracts at https://dashboard.tenderly.dev/Habic/tennis-match/contracts

All Smart Contracts successfully pushed.

Now when you open your Tenderly dashboard, you’ll see your newly created project, and your Smart Contracts added!

Filtering Transactions

As you can see, you can filter by multiple properties:

  • Transaction Status – All/Success/Failed
  • Transaction Type – All/Internal/Direct
  • Contracts – Select which contracts must be present in the transaction
  • Network – Specify the network if you have contracts deployed to multiple networks
  • Tag – Filter by a specific tag that you provided during the tenderly push command (more on this later)

Having filtering this precise and fast is important when you need to pinpoint that specific transaction amongst thousands of them. Another example that comes to mind is finding internal transactions sent to your Smart Contracts that failed. This way, you can see if someone is trying to abuse your contract’s logic or if your code is failing and someone depends on it.

Transaction details, Debugging, Gas Profiling and so much more

The next thing we’re going to cover is the Transaction details and the accompanying suite of tools: a Swiss Army Knife of the Ethereum ecosystem. Why do I call it the Swiss Army Knife you might ask yourself? I did that because there is no other tool out there that saves so much time. Don’t take my word for it, here are some of the things people who already use Tenderly say about the tool.

The Transaction suite consists of several useful and timesaving tools: Execution Overview, Stack Traces, Events/Logs, Contracts, Visual Debugger, State Changes, and the Gas Profiler. We have a lot to cover, so let’s get started!

Execution Overview

The first tool we are covering is the Execution Overview. Think of it as the bird’s-eye view of the transaction. At a glance, you can see the exact code paths of all of the Smart Contracts that participated in a given transaction. You can open the transaction from the image above by clicking here.

When you click on a function name, you can see the context in which that function was called.

But let’s say you want to dig deeper. You can do that by clicking the View in Debugger button next to the function name. Let’s click on it now and go over the next tool.

4. Stack Traces

Stack traces are a very import part of any developer’s workflow both locally, but in production as well. That’s why Stack traces were one of the first features we released, first as a CLI tool and later as part of our platform.

The stack trace above shows the exact line of code where the transaction failed. From there, you can click Debug Error and find the issue in no time! How convenient!

Visual Debugger

The Visual Debugger is one of the tools people love the most. Instead of wasting countless hours debugging transactions, you can use the Visual Debugger so you can focus more on buidling and less on scratching your head.

If you followed along and clicked View in Debugger, you’re at the right place, and if not, you can click here.

Just like you would expect from a debugger in other modern languages, you have the current call stack at the left-hand side, Jump Up/Previous/Next stack navigation controls, and most importantly, Input, Output, Local and State variables to the right.

The level of detail present here doesn’t exist anywhere else and reduces development time by orders of magnitude.

Events and Logs

Moving on from the Visual Debugger, we have the Events/Logs tools. Smart Contract Events are the de-facto way of notifying interested parties that some event has occurred. The Logs themselves also contain valuable information in addition to the information that a particular event has occurred.

When we open the Events/Logs tool, we can see all of the Logs that were emitted during a transaction. What is even better is that the event parameters are already decoded and shown in a human-readable format. No more time wasted decoding hex strings to see what happened. Time: saved!

0 Comments

Leave a Reply

More great articles

How to sign messages using Metamask

Signing messages in Ethereum Authentication for web3 ? If you’ve ever interacted with an Ethereum Dapp you’ve probably been asked…

Read Story
Supercharge with DappTools

DappTools: Supercharge Your Smart Contracts

DappTools is a suite of Ethereum focused CLI tools following the Unix design philosophy, favoring composability, configurability and extensibility. But…

Read Story

Web 2 Vs Web 3

There’s a lot of talk about web 3.0 and the big changes it’ll bring to the industry, but few people…

Read Story

Never miss a minute

Get great content to your inbox every week. No spam.
[contact-form-7 id="6" title="Footer CTA Subscribe Form"]
Arrow-up