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

@tatumio/mempool-tracker

v1.0.0

Published

Mempool Tracker Extension

Downloads

6

Readme

🌍 Mempool Tracker

Mempool Tracker integrates seamlessly with Tatum SDK to provide mempool tracking capabilities for UTXO-based blockchains.

📖 Description

The MempoolTracker serves as a specialized utility designed to monitor and keep track of new transactions entering the mempool. In the world of blockchain, the mempool represents a holding area for transactions that are waiting to be confirmed by the network. As transactions are broadcasted to the network, they are first placed in the mempool before being included in a block by miners.

Given the dynamic nature of the mempool, where transactions continuously enter and leave, it becomes essential for developers and blockchain enthusiasts to have tools that allow them to monitor this activity. This is where the MempoolTracker steps in.

By leveraging the capabilities of the TatumSdkExtension, the MempoolTracker periodically polls the mempool at defined intervals, capturing and storing new transaction IDs. This enables users to:

  • Real-time Monitoring: Keep a watchful eye on the mempool's current state and understand the influx of new transactions.
  • Data Analysis: Analyze patterns or spikes in mempool activity, which can be indicative of network congestion or other network events.
  • Custom Notifications: Developers can build custom logic on top of the tracker, setting up notifications or alerts for specific transaction patterns or thresholds.

In essence, the MempoolTracker provides a streamlined mechanism for those looking to stay updated with the ever-changing landscape of the blockchain's mempool, ensuring they're always in the loop with the latest transactional activity.

🚀 Quick Start

  1. Installation

    Firstly, ensure that the @tatumio/mempool-tracker package is set as a dependency within your project. Next, import the Mempool Tracker extension:

    import { MempoolTracker } from '@tatumio/mempool-tracker';
  2. Initialization

    Create an instance of Tatum SDK passing MempoolTracker as one of extensions.

    const tatumSdk = await TatumSDK.init<Bitcoin>({
         network: Network.BITCOIN,
         configureExtensions: [
             MempoolTracker,
         ]
     })

🛠️ How to Use

  1. Start Tracking: Call the startTracking method to begin monitoring the mempool for new transactions.

    await tatumSdk.extension(MempoolTracker).startTracking()

    This method will start a periodic check (based on the defined interval) and store any new transactions found in the mempool.

  2. Retrieve New Mempool Transactions: After starting the tracker, you can retrieve a list of new transactions from the mempool using the getNewMempoolTransactions method.

    const newTransactions = await tatumSdk.extension(MempoolTracker).getNewMempoolTransactions();

    This method will return an array of transaction IDs (strings) and will reset the new transaction pool, ensuring that subsequent calls will only return newly discovered transactions.

⚙️️ Configuring Extension

When registering extension in TatumSDK instance you can pass configuration object as a second parameter:

const tatumSdk = await TatumSDK.init<Bitcoin>({
    network: Network.BITCOIN,
    configureExtensions: [
       {type: MempoolTracker, config: {intervalMs: 5_000}},
    ]
})

intervalMs - defines the interval (in milliseconds) at which the tracker will poll the mempool for new transactions. The default value is 10 seconds.

🔗🔗 Supported Networks

Network.BITCOIN,
Network.BITCOIN_TESTNET,
Network.LITECOIN,
Network.LITECOIN_TESTNET,
Network.DOGECOIN,
Network.DOGECOIN_TESTNET