DeveloperBreeze

Blockchain Development Programming Tutorials, Guides & Best Practices

Explore 30+ expertly crafted blockchain development tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Understanding `crypto.randomBytes` and `ethers.randomBytes`: A Comparison

Tutorial October 24, 2024

  • crypto.randomBytes:
  • Library: crypto.randomBytes is part of Node.js’s built-in crypto module. It requires no additional dependencies and is readily available in any Node.js environment.
  • Usage: The function takes a single argument specifying the number of bytes to generate and returns a Buffer object containing the random bytes.
  • Example:
    const crypto = require('crypto');
    const randomBytes = crypto.randomBytes(32);
    console.log(randomBytes.toString('hex')); // Prints a 32-byte random hex string

Working with `BigNumber` in ethers.js: A Guide for Version 6

Tutorial October 24, 2024

  • Greater Than:
  console.log(num1.gt(num2)); // true

How to Query ERC-20 Token Balances and Transactions Using Ethers.js and Etherscan API

Tutorial October 24, 2024

Once you’ve added the code, run the script:

node getTokenBalance.js

Etherscan vs Infura: Choosing the Right API for Your Blockchain Application

Tutorial October 24, 2024

  • Rate Limits: Etherscan’s free tier limits the number of API requests per second (usually around 5 per second). This is fine for querying data but can be limiting for large-scale applications that need to process a lot of data quickly.
  • Pricing: Etherscan offers paid tiers that increase the API request limits.
  • Rate Limits: Infura’s free tier provides a generous number of requests (e.g., 100,000 requests per day) and supports more requests as you scale. This makes it more suitable for real-time dApps.
  • Pricing: Infura’s paid plans offer higher limits and additional features like access to Layer 2 networks.

Sending Transactions and Interacting with Smart Contracts Using Infura and Ethers.js

Tutorial October 24, 2024

  • Node.js installed on your machine.
  • A basic understanding of JavaScript and blockchain concepts.
  • An Ethereum wallet with some test ETH (using testnets like Goerli or Ropsten is recommended for testing).
  • An Infura Project ID to access the Ethereum network.

If you don't have an Infura account yet, follow these steps: