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

@nomyx/decentralog

v0.2.4

Published

A decentralized event indexer for EVM blockchains

Downloads

26

Readme

decentralog

Introduction

This project provides a framework for synchronizing and indexing blockchain data, particularly focusing on Ethereum smart contracts events. It is designed to facilitate developers in building Web3 applications by providing a streamlined way to process and index events coming from the Ethereum blockchain.

Components

AbiSyncer

The AbiSyncer class interfaces with Ethereum smart contracts, using provided ABI and contract addresses to sync event data. It efficiently retrieves past events and sets up listeners for ongoing contract activities.

Constructor Properties:

  • abi (Array): The ABI array of the smart contract. This is essential for the AbiSyncer to understand the contract's structure and events.
  • address (String): The Ethereum address of the smart contract. AbiSyncer uses this to pinpoint the exact contract to sync from.
  • provider (Web3 Provider): The Web3 provider instance through which interactions with the Ethereum network will be made.
  • startBlock (Number, optional): The block number from which to start syncing events. If not set, it starts from the latest block.

Example:

const abiSyncer = new AbiSyncer({
  abi: contractAbi,
  address: '0xContractAddress',
  provider: web3Provider,
  startBlock: 1234567
});

DecentralizedIndexer

The DecentralizedIndexer is a React component enhancing the AbiSyncer. It provides real-time visualization of smart contract synchronization, as well as decentralized event indexing. This component operates on GunDB, a decentralized database, creating a user-friendly interface for indexing blockchain events.

Properties:

  • contracts (Object): An object where keys are contract names and values are objects containing contract details that include abi and address.
  • provider (Web3 Provider): The Web3 provider instance to interact with the Ethereum network.

Example:

<DecentralizedIndexer
  contracts={{
    MyContract: {
      abi: contractAbi,
      address: '0xContractAddress'
    }
  }}
  provider={web3Provider}
/>

Web3Button

The Web3Button component allows users to interact with Web3 functionalities through a button interface, enabling seamless integration with smart contracts and transactions.

Properties:

  • provider (Web3 Provider): A Web3 provider instance for interacting with the Ethereum network.
  • contract (Object): An object containing the abi, address, and any contract method details necessary for transaction.
  • method (String): The contract method to call upon button click.
  • args (Array, optional): Arguments to pass to the contract method call.
  • onSuccess (Function, optional): A callback function that is called when the transaction is successful.
  • onError (Function, optional): A callback function that is called when the transaction encounters an error.

Example:

<Web3Button
  provider={web3Provider}
  contract={{
    abi: contractAbi,
    address: '0xContractAddress',
    method: 'transfer',
    args: [recipientAddress, amount]
  }}
  onSuccess={(receipt) => console.log('Transaction success:', receipt)}
  onError={(error) => console.error('Transaction error:', error)}
/>

Installation

To get started with this project, clone the repository and install the required dependencies using npm install.

Usage

To utilize this framework, instantiate AbiSyncer with the necessary contract details and employ DecentralizedIndexer to render the events on a web interface. Here's a simple example:

import React from 'react';
import ReactDOM from 'react-dom';
import { AbiSyncer, DecentralizedIndexer } from './dist/index;

// Smart contract details and provider
const contractDetails = {
  abi: [...], // Contract ABI
  address: '0xContractAddress', // Contract Address
};

const App = () => (
  <DecentralizedIndexer contracts={{ MyContract: contractDetails }} provider={web3Provider} />
);

ReactDOM.render(<App />, document.getElementById('root'));

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to the project.

License

This project is licensed under the MIT License - see the LICENSE file for details.