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

starchain

v1.0.4

Published

A Node.js library for seamless Ethereum blockchain interaction, facilitating tasks like balance checks, transactions, and more with ease

Downloads

8

Readme

Welcome to StarChain, a comprehensive Node.js library designed to facilitate seamless interaction with the Ethereum blockchain. Whether you're developing decentralized applications (dApps), running automated scripts, or simply exploring the vast landscape of blockchain technology, StarChain provides you with the tools you need to integrate blockchain functionalities with ease.

Features

  • Easy Balance Queries: Quickly fetch the balance of any Ethereum address in Ether units.
  • Effortless Transaction Handling: Send Ether between accounts with minimal setup, handling all the complexities of transaction signing and gas estimation.
  • Utility Functions: Convert between Ether and Wei, or encode and decode data, with our handy utility functions.
  • Robust Error Handling: Designed with error resilience in mind, ensuring your application runs smoothly even when the blockchain doesn't.

Getting Started

Prerequisites

Ensure you have Node.js (version 12 or later) installed on your machine. StarChain is built with compatibility in mind, supporting both traditional Node.js environments and modern async/await patterns.

Installation

To add StarChain to your project, run the following command in your project directory:

npm install StarChain

This command fetches the latest version of StarChain and adds it to your project's dependencies.

Quick Setup

Once installed, you can start using StarChain by requiring it in your Node.js application:

const { getBalance, sendTransaction } = require('StarChain');

// Example usage async function main() { const address = '0xYOUR_ADDRESS_HERE'; const balance = await getBalance(address); console.log(Balance: ${balance} ETH); }

main();

Configuration

To run the StarChain project successfully on your local environment, you need to set up some environment variables. We use a .env file for this purpose, which allows you to define your private and sensitive information without exposing it in your source code.

Setting Up the .env File

  1. Create a .env File: In the root directory of the project, create a file named .env.

  2. Add Environment Variables: Open the .env file with your favorite text editor and add the following environment variables:

    # Ethereum Network Configuration
    INFURA_PROJECT_ID=your_infura_project_id
    ETHERSCAN_API_KEY=your_etherscan_api_key
    
    # Account Information
    WALLET_PRIVATE_KEY=your_wallet_private_key
    
    # General Settings
    PORT=3000

    Replace your_infura_project_id, your_etherscan_api_key, and your_wallet_private_key with your actual Infura project ID, Etherscan API key, and Ethereum wallet private key respectively.

  3. Save the File: After adding the necessary environment variables, save the .env file.

Using Environment Variables in Your Application

To access these environment variables in your application, make sure you have the dotenv package installed. If not, you can install it by running:

npm install dotenv

At the beginning of your main application file (e.g., index.js), add the following line to load the environment variables:

require('dotenv').config();

Now, you can access the environment variables anywhere in your application using 
`process.env.VARIABLE_NAME` , for example, `process.env.INFURA_PROJECT_ID`.

Important Note

Never commit your .env file to your version control system. This file contains sensitive information that should not be shared publicly. Make sure to add .env to your .gitignore file to prevent it from being uploaded to your repository.

Contributing

We welcome contributions from the community! If you're interested in improving StarChain or adding new features, please submit a pull request or open an issue to discuss your ideas.