Improving Smart Contract development with Tenderly and human readable stack traces

The Tenderly team at Beyond Hackathon 2018

Either you landed on this article by clicking on a link on Twitter/Reddit/<insert favorite social network here> or someone has sent you this way because they thought you might find something in this article interesting. Whichever is the case I’m humbled you are giving your time to these words and not some other words or funny Bitconnect remixes.

TL;DR: Try out our CLI which simplifies local Solidity debugging. It is made by 5 friends who believe that the future is decentralized and we need better tooling so that day comes sooner rather than later.

Hi! My name is Bogdan, and I’m one of the people working on Tenderly. By the end of this article, I hope you will have a better feeling of who we are, what we do and why we do it. Also, I hope you will give our new CLI tool a try and join us in making the next generation of development tools.

Who we are

I’m not going to bore you with our life stories or how we got to where we are right now. I’m just going to say that we are 5 friends who firmly believe that the future is decentralized, that Ethereum is leading the way and that we need more developers working on decentralized solutions to both traditional and new problems.

We weren’t always thinking like this. We came from a traditional development background, building systems that were used by millions of users, and where every problem is easy to solve because you trust the database/administrator/operator you are working with. But as more and more cases emerged, be it malpractice or mismanagement in traditional systems, we started questioning whether we were on the right side of things.

So we set out to fix some of the problems we saw around us that have an impact on both our lives and lives of others:

While working on these projects, we were missing some of the tooling that we had while working with mainstream technologies. Tools that made us more productive.

The Problem

Right now if you came from the JavaScript ecosystem, for example, you would feel like one of your hands is tied behind your back. Let’s say that you are implementing a simple calculator. If you had a division by zero error, you wouldn’t know that was the actual error causing your transaction to fail. The stack trace is unusable, and you either have to debug the contract step by step or add log statements you will delete later on.

What’s even worse is the fact that you are probably typing your smart contract in Remix, testing it out by hand, then copying it to your local filesystem so you can use Truffle to migrate it onto a network. At a later stage you discover the error mentioned above, and then you have to rinse and repeat the whole process.

The development process shouldn’t have this much friction! It should be as ergonomic as possible! A new developer who never saw a line of Solidity should be able to get up and running in no time!

Our Mission

To build the next generation of solutions with the next generation of technology, we need the next generation of tooling.

Our Goal

And this is where we step in: we want to build tools that help blockchain developers speed up and enhance their development experience. Additionally, we want to develop services that help teams and companies gain insight into what is happening with their Smart Contracts and the Blockchain in general.

Our Motivation

A decentralized future is the one we believe in, and we want to do everything in our power to make that future happen. We cannot just sit with our arms crossed waiting on that future to happen, so we are going to try to help as much as we can!

Introducing the Tenderly CLI

One of the first tools we are open-sourcing is our CLI which greatly simplifies debugging Solidity during the development phase. You can check it out now and go through the readme to get a feel how it can help you while you are developing your next Smart Contract.

In short, let’s go back to our Calculator example:

This is a simple contract, so you probably caught the division by zero exception that can occur. But let’s imagine it’s 5 am and we didn’t find it. If we were to call that function with the second argument being 0 we would get this:

How the Tenderly CLI helps here is that you run it locally as a proxy and tell Remix to send requests through it instead of sending it to a node directly.

Read more about the proxy command here

You do this and presto: human readable stack traces for everyone!

If you look at the status field, you can see the exact line of code that caused the exception

If you are using truffle test or truffle exec, the flow is even faster! Just add another network in your truffle configuration containing the proxy information, and you will get useful error messages when a test fails:

This is how our test looks when it fails without the Tenderly CLI
And this is how it looks with the Tenderly CLI running as a proxy

In a couple of days, we will be publishing a guide on how to setup Tenderly with Truffle and speed up your existing local debugging workflow.

Next step

We are not stopping here! Soon, we will be releasing a Remix plugin which will integrate seamlessly with the Tenderly CLI to enable file system sync functionality and full-featured stack trace functionality which until now wasn’t possible!

Thank you!

Thanks for sticking until the end of this article and I hope I’ll talk to you soon! You can reach us on our Discord, shoot us an e-mail over at support@tenderly.app or by opening an issue on the GitHub repository, and if you are interested in future news, be sure to check out our website https://tenderly.app or subscribe to our newsletter, I promise we don’t spam!

As Rick in Casablanca would say