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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cowrieio/ethers-otterscan

v6.16.0-otterscan.3.10

Published

A fork of Ethers.js with added support for Otterscan/Erigon OTS namespace methods for blockchain explorer functionality.

Readme

Ethers.js + Otterscan

npm (tag) npm bundle size (version) npm (downloads)


A fork of Ethers.js with added support for Otterscan / Erigon's OTS namespace.

This package extends the popular Ethers.js library with specialized provider methods for interacting with Erigon nodes that expose the ots_* JSON-RPC methods. These methods provide efficient access to blockchain explorer data without requiring external indexers.

🆕 Otterscan Features

The OtterscanProvider class extends JsonRpcProvider with the following additional methods:

  • Transaction Analysis

    • traceTransaction() - Get detailed execution traces
    • getInternalOperations() - Get internal operations (transfers, creates, etc.)
    • getTransactionErrorData() - Get raw revert data for failed transactions
    • getTransactionRevertReason() - Get human-readable revert reasons
  • Block Information

    • getBlockDetails() - Get block data with issuance and fee information
    • getBlockTransactions() - Get paginated block transactions with receipts
  • Address History

    • searchTransactionsBefore() - Search transactions before a block
    • searchTransactionsAfter() - Search transactions after a block
    • iterateAddressHistory() - Async iterator for transaction history
  • Utilities

    • hasCode() - Efficiently check if address is a contract
    • getTransactionBySenderAndNonce() - Find transaction by sender/nonce
    • getContractCreator() - Get contract creation details
    • otsApiLevel() - Check supported OTS API level

Installation

npm install @cowrieio/ethers-otterscan

Usage

import { OtterscanProvider } from '@cowrieio/ethers-otterscan';

// Connect to an Erigon node with OTS namespace enabled
const provider = new OtterscanProvider('https://your-erigon-node.com');

// Check OTS availability
await provider.ensureOts(8); // Requires API level 8+

// Get transaction trace
const traces = await provider.traceTransaction('0x...');
console.log(traces); // Array of trace entries

// Search address history between blocks
for await (const { tx, receipt } of provider.iterateAddressHistory(
  '0x...', 
  19000000,  // start block
  19010000   // end block
)) {
  console.log(`Transaction: ${tx.hash}`);
}

// Get internal operations
const ops = await provider.getInternalOperations('0x...');
console.log(ops); // Array of internal operations

TypeScript Support

Full TypeScript support with proper types for all OTS methods:

import { OtterscanProvider, type OtsTraceEntry } from '@cowrieio/ethers-otterscan';

const provider = new OtterscanProvider('https://your-erigon-node.com');
const traces: OtsTraceEntry[] = await provider.traceTransaction('0x...');

Compatibility

  • Ethers.js: Based on Ethers.js v6.15.0
  • Erigon: Compatible with Erigon nodes running OTS namespace
  • Networks: Works with any EVM-compatible network running Erigon

Requirements

Your Erigon node must be configured with the OTS namespace enabled:

# Start Erigon with OTS namespace
erigon --http.api "eth,erigon,trace,ots" --http --http.addr "0.0.0.0"

Upstream Compatibility

This fork maintains full compatibility with the upstream Ethers.js library. All existing Ethers.js functionality works exactly as documented in the official Ethers.js documentation.

Differences from Upstream

  • Added: OtterscanProvider class with OTS namespace support
  • Added: TypeScript interfaces for all OTS response types
  • Added: Comprehensive test coverage for OTS methods
  • No breaking changes to existing Ethers.js functionality

Testing Nodes

OTS methods are supported on any Erigon node with OTS namespace enabled in launch arguments.

Documentation

Contributing

This is a community-maintained fork. Contributions are welcome!

  1. Fork the repository
  2. Make your changes
  3. Add tests for new functionality
  4. Submit a pull request

Relationship to Upstream

This package is a fork of ethers-io/ethers.js with additional functionality. It is not officially endorsed by the Ethers.js maintainers.

  • Upstream: ethers - The official Ethers.js library
  • This fork: @cowrieio/ethers-otterscan - Community fork with Otterscan support

License

MIT License (including all dependencies), same as upstream Ethers.js.

Credits

  • Ethers.js by Richard Moore - The amazing library this fork is based on
  • Otterscan - The blockchain explorer that defines the OTS namespace
  • Erigon - The Ethereum client that implements OTS methods