1.0.0 • Published 2 months ago

blockbinder v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

BlockBinder

Welcome to BlockBinder, the ultimate Node.js toolkit for interacting with the Ethereum blockchain. Designed to simplify blockchain integrations for developers, BlockBinder enables easy access to Ethereum's core functionalities, including account balance queries, transactions, and smart contract interactions.

Features

  • Balance Queries: Effortlessly fetch the Ether balance of any Ethereum address.
  • Ether Transactions: Send Ether between accounts with minimal code, handling the complexities of transaction signing behind the scenes.
  • Smart Contract Interactions: Engage with smart contracts directly from your Node.js applications.
  • Environment Flexibility: Works seamlessly with both mainnet and testnets, adapting to your project's needs.

Getting Started

Prerequisites

  • Node.js (v12 or higher recommended)
  • An Ethereum wallet with some Ether for transactions (if interacting with mainnet or testnets)

Installation

  1. Clone the BlockBinder repository to your local machine:

    git clone https://github.com/yourusername/BlockBinder.git

Navigate to the BlockBinder directory:

cd BlockBinder

Install the required dependencies:

npm install

Configuration

Create a .env file in the root of your project and populate it with your Ethereum account details and Infura project ID:

MY_ADDRESS=0xYourEthereumAddress PRIVATE_KEY=YourPrivateKey INFURA_URL=https://mainnet.infura.io/v3/your_project_id

Note: Keep your private key secure and never share it publicly.

Usage

Here's how to get started with some of the core functionalities of BlockBinder:

Querying a Balance:

const { getBalance } = require('./path/to/BlockBinder');

async function checkBalance() { const address = '0x...'; // Ethereum address const balance = await getBalance(address); console.log(${address} balance: ${balance} ETH); }

checkBalance();

Sending Ether:

Sending Ether:

const { sendEther } = require('./path/to/BlockBinder');

async function transferEther() { const fromAddress = process.env.MY_ADDRESS; const privateKey = process.env.PRIVATE_KEY; const toAddress = '0xRecipientAddress'; const amountInEther = '0.01';

const txHash = await sendEther(fromAddress, privateKey, toAddress, amountInEther); console.log(Transaction successful: ${txHash}); }

transferEther();

Contributing

Contributions to BlockBinder are always welcome, whether it's fixing bugs, adding new features, or improving the documentation. Please feel free to fork the repository and submit pull requests.

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.

License

BlockBinder is released under the MIT License. See the LICENSE file for more details.