
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
eth-trace-inspector
Advanced tools
A zero-config TypeScript library for automatically decoding, tracing, and debugging EVM transactions. Provides human-readable call stacks, event logs, and state changes for any transaction hash across all major EVM networks, even without the contract ABI.
A zero-config TypeScript library for automatically decoding, tracing, and debugging EVM transactions. Provides human-readable call stacks, event logs, and state changes for any transaction hash across all major EVM networks, even without the contract ABI.
npm install eth-trace-inspector
The library supports environment variables for configuration. Copy .env.example to .env and fill in your values:
cp .env.example .env
Available environment variables:
TEST_TX_HASH - Transaction hash for testingETHERSCAN_API_KEY - Etherscan API key (recommended to avoid rate limits)POLYGONSCAN_API_KEY - Polygonscan API keyBSCSCAN_API_KEY - BSCscan API keyARBISCAN_API_KEY - Arbiscan API keyOPTIMISTIC_ETHERSCAN_API_KEY - Optimistic Etherscan API keySNOWTRACE_API_KEY - Snowtrace API keyBASESCAN_API_KEY - Basescan API keyETH_RPC_URL - Custom Ethereum RPC URLPOLYGON_RPC_URL - Custom Polygon RPC URLBSC_RPC_URL - Custom BSC RPC URLARBITRUM_RPC_URL - Custom Arbitrum RPC URLOPTIMISM_RPC_URL - Custom Optimism RPC URLAVALANCHE_RPC_URL - Custom Avalanche RPC URLBASE_RPC_URL - Custom Base RPC URLNote: The .env file is gitignored. Use .env.example as a template.
import { inspectTransaction, prettyPrint } from 'eth-trace-inspector';
const report = await inspectTransaction('0x...', {
chainId: 1, // Ethereum mainnet
apiKey: 'your-api-key', // Optional, but recommended for rate limits
});
prettyPrint(report);
const json = JSON.stringify(report, null, 2);
console.log(json);
import { inspectTransaction } from 'eth-trace-inspector';
const report = await inspectTransaction('0x1234...', {
chainId: 1,
});
import { JsonRpcProvider } from 'ethers';
import { inspectTransaction } from 'eth-trace-inspector';
const provider = new JsonRpcProvider('https://your-rpc-url.com');
const report = await inspectTransaction('0x1234...', {
provider,
});
const report = await inspectTransaction('0x1234...', {
chainId: 1,
customABIs: {
'0xContractAddress': [
],
},
});
interface InspectorOptions {
rpcUrl?: string; // Custom RPC URL
provider?: Provider; // Custom ethers provider
chainId?: number; // Chain ID (auto-detected if not provided)
apiKey?: string; // Block explorer API key
includeGasDetails?: boolean; // Include gas usage (default: true)
includeStorageChanges?: boolean; // Include storage changes (default: false)
customABIs?: Record<string, any[]>; // Custom ABIs by address
fetchABI?: boolean; // Attempt ABI fetching (default: true)
useSignatureDatabase?: boolean; // Use 4-byte signature DB (default: true)
}
The inspectTransaction function returns a TransactionReport object:
interface TransactionReport {
txHash: string;
blockNumber: number;
transactionIndex: number;
from: string;
to: string | null;
value: bigint;
gasPrice: bigint;
gasLimit: bigint;
gasUsed: bigint;
status: boolean;
callStack: DecodedCall[];
events: DecodedEvent[];
revertReason?: string;
chainId: number;
timestamp?: number;
}
interface DecodedCall {
to: string;
functionName: string;
args: any[];
calldata: string;
signature: string;
inferred?: boolean; // true if function name was inferred
gasUsed?: bigint;
value?: bigint;
calls?: DecodedCall[]; // Nested calls
reverted?: boolean;
revertReason?: string;
}
interface DecodedEvent {
address: string;
eventName: string;
args: any[];
data: string;
topics: string[];
signature: string;
inferred?: boolean;
blockNumber: number;
transactionIndex: number;
logIndex: number;
}
debug_traceTransaction (required for full trace analysis)debug_traceTransaction. Public RPC endpoints often don't support this method. Consider using:ABI Availability: While the library attempts to fetch ABIs automatically, not all contracts have verified source code on block explorers.
Signature Database: The built-in 4-byte signature database is limited. For better coverage, the library attempts to fetch from 4byte.directory, but this requires internet connectivity.
const report = await inspectTransaction('0x...', { chainId: 1 });
if (!report.status) {
console.log('Transaction failed!');
console.log('Revert reason:', report.revertReason);
const findRevertedCall = (calls: DecodedCall[]): DecodedCall | null => {
for (const call of calls) {
if (call.reverted) return call;
if (call.calls) {
const nested = findRevertedCall(call.calls);
if (nested) return nested;
}
}
return null;
};
const revertedCall = findRevertedCall(report.callStack);
if (revertedCall) {
console.log('Reverted in:', revertedCall.functionName);
}
}
const report = await inspectTransaction('0x...', { chainId: 1 });
const transfers = report.events.filter(e => e.eventName === 'Transfer');
console.log(`Found ${transfers.length} Transfer events`);
const eventNames = new Set(report.events.map(e => e.eventName));
console.log('Event types:', Array.from(eventNames));
import { inspectTransaction, prettyPrint } from 'eth-trace-inspector';
const report = await inspectTransaction('0x...', { chainId: 1 });
prettyPrint(report);
This will output a formatted, human-readable report to the console.
inspectTransaction(txHash: string, options?: InspectorOptions): Promise<TransactionReport>Main function to inspect a transaction.
Parameters:
txHash: Transaction hash to inspectoptions: Optional configuration (see InspectorOptions)Returns: Promise resolving to TransactionReport
prettyPrint(report: TransactionReport): voidPretty print a transaction report to the console.
toJSON(report: TransactionReport, pretty?: boolean): stringConvert a transaction report to JSON string.
Parameters:
report: Transaction report to convertpretty: Whether to format JSON with indentation (default: true)getSummary(report: TransactionReport): stringGet a one-line summary of the transaction report.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
FAQs
A zero-config TypeScript library for automatically decoding, tracing, and debugging EVM transactions. Provides human-readable call stacks, event logs, and state changes for any transaction hash across all major EVM networks, even without the contract ABI.
We found that eth-trace-inspector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.