DEV Community

CoinMonks
CoinMonks

Posted on • Originally published at blog.coincodecap.com on

Making Sense of Ethereum Transaction History With Etherscan

Let’s say you’re executing a lot of Ethereum transactions, some manually and some scripted. When the dust settles, you need to make sure that everything went perfectly because a lot is riding on it. What’s the best way to satisfy yourself that it all went down as planned?

A Flurry of Activity

I recently spent about 26 hours engaged in what is arguably the most intense set of network interactions of my entire career. The stakes were high, and the clock was ticking.

The job?

Deploy four smart contracts to the Ethereum mainnet and prepare them with their initial state data.

The next day we were to open our “Founders sale” on Open Sea, the leading NFT marketplace. Our Discord was going bonkers. Buyers were queued up like the teeming masses pressed against a Target storefront on Black Friday morning. When does the sale start???

Each of the contracts has a set of management roles associated with it that need to be set to the right wallet addresses, or control of them could be lost entirely.

The Gas Cost

The gas cost alone to initialize the data on one of these contracts amounted to over $1,700 and over 1000 scripted transactions. If a single transaction failed, I had to restart the script so that I couldn’t go to sleep.

Gas prices fluctuated during this long march. Therefore, each time I restarted the script, I needed to check the current gas price and determine if I needed to give each Ethereum transaction more gas so that it would complete faster. But not too much, or we’d be overspending.

The project was Avastars, a collectible NFT effort I’d been working on non-stop for the previous seven months, and into which my client had a lot of time, money, and reputation invested.

And the thing about Ethereum smart contracts is, once they’re deployed, they’re immutable. You can’t fix a bug on a contract without redeploying it and moving over all the state from the old contract, also an expensive and tedious process.

Failure was, needless to say, not an option.

When Things Went South

Meanwhile, at my terminal, everything that could go wrong did go wrong. And, it seemed, everything that couldn’t go wrong also went wrong.

I kid you not, midway through the process, my router was hit with a sustained DDOS attack, taking my network offline for several hours. I switched to my cellphone’s hotspot and forged on.

In the end, the contracts were deployed, their states successfully initialized, and all was, seemingly well. I even took the next day off and relaxed (if you can call wrestling with the layout of a tech book all day relaxing).

Now, a little less than a month later, Avastars is the number 6 project in 7-day trade volume on Open Sea. And this is just from the initial promotional NFTs that I minted during that arduous session.

Avatars at OpenSea DappRanking
#6 with a bullet, baby

Analyzing the Ethereum Transaction History

Before I could relax, though, I had to be certain I hadn’t missed anything in my sleep-deprived, over-caffeinated haze.

I had created the bulk of my transactions with a handful of Node scripts that I tested locally and on two public testnets (Rinkeby and Ropsten).

Of course, they generated reasonable logging output. That feedback gave me confidence that what I had intended to happen had probably happened.

But the transactions themselves are public, and the blockchain is the ultimate source of truth. Once the deal is done, analyzing those transactions is the best way to be sure that everything we intended to do took place.

Etherscan comes to the rescue

Currently, the best tool for browsing transactions on the Ethereum blockchain (that I know of) is Etherscan.io. But when you look at the transactions, it’s not always easy to follow.

Transaction history on Etherscan
Transaction history, public view, etherscan.io

Now, if you recognize the contract and wallet addresses, you can follow this. The leftmost number/link is the unique Ethereum transaction hash. Columns 4 and 6 are the from and to addresses. Still, it’s cryptic. You need to dive into one transaction, review it, pop back out, view another, try and remember which one was the ‘setAdmin’ call and which was ‘setOwner’. You could make a printout and scribble notes on it.

Or, what if you could transform the important wallet and contract addresses to meaningful names? And make notes about which transactions did what.

Well, surprise, you can. All you have to do is create an Etherescan login.

Being an anonymously browsable public service, I think many people don’t bother to do this. But if you do, a whole world of possibilities opens up. You can tag wallet and contract addresses with names, add notes to each Ethererum transaction, making the history far more navigable, and much more.

Below is that same set of transactions, annotated. See the difference.

Annotated Transaction history
the same transaction history, logged in, with address tags and transaction notes.

When you create an account and are logged in, if you click an address link to look at its transaction history, you’ll see the option to add a tag.

To add a name tag to a viewed contract or wallet address, click the “Update?” link under “More Info”.

When logged in, if you view a transaction, you can enter a private note in the box at the bottom of the form, like so…

Add a note to a viewed transaction.
Add a note to a viewed transaction.

Summary

Clearly, Etherscan is looking out for all our best interests, let us browse the blockchain and annotate it for our personal edification, all for free.

Private Transaction notes
Private Transaction notes

Private Address Name Tags
Private Address Name Tags

With a simple email/password secured account, you can add tags to contract and wallet addresses so that they’re more recognizable in a list.

And when you add notes to a transaction, they appear under the transaction hash in lists, making the sequence of events clear.

However, only I can see my tags and notes. They help me make sense of what has happened. But I’d love to see this markup be sharable with others. There may be privacy concerns involved with that, though, so we’ll see how Etherscan handles this functionality in the future.

In the meantime, if you do a lot of Ethereum transactions and need to analyze them afterward, you’ll want to be sure you have an account on Etherscan and leverage their tags and notes functionality.

Attribution

This article is contributed by Cliff Hall.

Also, Read

The post Making Sense of Ethereum Transaction History With Etherscan appeared first on CoinCodeCap Blog.

Top comments (0)