Giter Club home page Giter Club logo

eth-reveal's Introduction

Eth-Reveal

CircleCI npm version

Dive into Ethereum transactions from the CLI or via a module.

Use it live in Codepen: https://codepen.io/justinjmoses/full/vwexLj

Features

  • Decodes method calls, function parameters and logs (with formatted dates and numbers) using ABI from Etherscan (if any)
  • Looks for target of contract if any (i.e. a Proxy) and adds that ABI as well
  • Shows errors and revert reasons

Note: due to storage limitations of popular Ethereum providers, you won't get revert reasons for most transactions more than 128 blocks in the past unless you use an Infura archive node (see https://infura.io/docs/ethereum/add-ons/archiveData)

Browser API

<script src="//cdn.jsdelivr.net/npm/eth-reveal/browser.js"></script>
<script>
	// assumes browser supports modern JS (can use Babel preprocesser for this, see settings in Codepen linked above)
	(async () => {
		const { reveal } = window;
		const {
			hash,
			blockNumber,
			timestamp,
			to,
			from,
			isContract,
			contract,
			underlyingContract,
			method,
			decodedLogs,
			gasPrice,
			gasLimit,
			gasUsed,
			gasFormat, // handy format of gas price, limit and used params
			status,
			errorMessage,
			revertReason,
			value,
			nonce,
		} = await reveal({
			hash: '0x92031f1cafad71bdfaa2d326b222972df2c2dcdc2931b5e8c1a32bda2dc7b2c8',
			network: 'mainnet', // default (supports kovan, ropsten and rinkeby)
			etherscanKey: 'demo', // optionally for better ES performance
			// to access historical data such as previous proxy targets and revert reasons, either supply a provider URI
			providerURI: undefined,
			infuraProjectID: '123321', // or optionally an infura project ID for an archive node
		});
	})();
</script>

Node API

const reveal = require('eth-reveal');

(async () => {
	const {
		hash,
		blockNumber,
		timestamp,
		to,
		from,
		isContract,
		contract,
		underlyingContract,
		method,
		decodedLogs,
		gasPrice,
		gasLimit,
		gasUsed,
		gasFormat, // handy format of gas price, limit and used params
		status,
		errorMessage,
		revertReason,
		value,
		nonce,
	} = await reveal({
		hash: '0x92031f1cafad71bdfaa2d326b222972df2c2dcdc2931b5e8c1a32bda2dc7b2c8',
		network: 'mainnet', // default (supports kovan, ropsten and rinkeby)
		etherscanKey: process.env.ETHERSCAN_API_KEY, // optionally for better ES performance
		// to access historical data such as previous proxy targets and revert reasons, either supply a provider URI
		providerURI: undefined,
		infuraProjectID: '123321', // or optionally an infura project ID for an archive node
	});
})();

CLI Usage:

npx eth-reveal -h [hash]

e.g. npx eth-reveal -h 0x203d9f5ec035ddaa02fc3a61b113bcfc6a8c0ee965fed7508e3627fc39f1a18f (SynthetixFeePool.claimFees)

image

e.g. npx eth-reveal -h 0xa9cfa1dc823f35e230ba1b785f359df0fa3056fe6b3689516216f3c6fc7599ac (Send ETH to NEPay)

image

e.g. npx eth-reveal -h 0x7f370b9f6647762d1a04f55b6a34195da98b749da01bed58d600c87658cf7b90

image (DMSCOIN.transfer)

e.g. npx eth-reveal -h 0x7a8d26e929dba1146cb3eb3ef5ed48883d2460a365f0e7bab2acecbbbdf47f05 (Synthetix.burnSynths)

image

eth-reveal's People

Contributors

jjgonecrypto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eth-reveal's Issues

Issue with Etherscan

ethers/providers/etherscan-provider.js:209
                    throw new Error('EtherscanProvider does not support blockTag for call');

This happen when calling revealer on a tx that failed, for example :

npx eth-reveal -h 0x5f44b08d30a3189a86a73f016890c52e462e9387fdfc5b571c3093312c0f3667

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.