npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@artossystems/geth-trace-decoder

v0.1.1

Published

Call trace decoder for Geth

Downloads

6

Readme

Geth trace decoder

Call trace decoder for Geth with output formatter and demonstration app

Development for Ethereum is hard. The tools currently available to support our role as developers are still crude in many ways. They are all welcome and essential but we are still very far away of the development environments for more mature technologies.

In 2019, we have been spoiled for many years with IDEs, smart debuggers and other tools that are simply not yet available for Solidity development. Even the ecosystem itself is harsher: contracts have to be deployed in a public net in order to be properly tested; execution happens asynchronously, with an unspecified delay; and it is totally non-interactive: all the output we have comes down to a function reply or encoded transactions logs. We can debug transactions after the fact, but that is not always useful. And when a transaction reverts, we often get a cryptic message similar to Error: Transaction has been reverted by the EVM where Geth ignores any message associated to the revert action, even if the programmer was kind enough to provide it in the first place.

Overall, it is difficult to understand what makes a contrat fail, and in contract calls that make several calls of their own, finding the cause for an error is frequently a hair-pulling exercise.

Enter the geth-trace-decoder.

We developed this tool to reduce the frustration of our debugging sessions. It takes the call trace of a transaction (successful or failing) and decodes it into a human-readable way, so that the user will be able to understand the whole sequence of calls until the transaction failed. This tool is not able to extract the error associated with a revert, but typically it will give all the information exactly until that point, including:

  • contract called into (by name or address)
  • method name
  • decoded inputs and outputs

We hope this is useful for the community at large. It is our 'Thank you!' for all the people working to make Ethereum the platform of the future, to improve the productivity of developers in this eco-system, and to make it an easier environment to develop in.

This repo provides a library that you can use and an example formatter making use of those libraries to output the results to console. Feel free to produce other formatters more suitable to your needs, and let us know if you find our work useful, if you know how it could be improved and how you'd like to see it evolve in the future.

Thank you to ConsenSys for their abi-decoder tool and the inspiration it gave us.

Happy coding!

Install

From the root of this repository, run

npm install

Usage

const lib = require('@artossystems/geth-trace-decoder');

const processor = new lib.traceProcessor(your-contract-ABI-array);
const result = processor.decodeTrace(geth-transaction-debug-trace);
console.log(lib.consoleOutputFormatter.format(result));

Examples

The examples provided in demo.js are very simple implementations to highlight the different use cases for this library. They are not production ready implementations.

  • Decoding hard coded call trace
demo_manualInput()
  • Replacing addresses with friendly names
demo_knownAddresses()
  • Multiple contracts (ABIs)
demo_multipleContracts()
  • Handling custom solidity types
demo_customTypes()
  • Getting call trace from rinkeby via etherscan()
demo_rinkeby()
  • Getting call trace from the main net via etherscan()
demo_mainNet()
  • Getting call trace directly from a geth node. To run this function you need to replace <YOUR TRANSACTION HASH> with a recent transaction hash and update the RPC IP address used to connect to your node if required.
demo_privateGethNode()

Running the demo

From publicDemo run

node demo.js