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

  • Use crypto.randomBytes when:
  • You are building Node.js applications without blockchain-specific functionality.
  • You want to avoid adding external dependencies.
  • Use ethers.randomBytes when:
  • You are developing Ethereum-related applications and already have ethers.js in your project.
  • You want the flexibility of generating random bytes with minimal configuration, defaulting to 32 bytes for Ethereum addresses or private keys.

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

Tutorial October 24, 2024

To follow along with this tutorial, you’ll need:

  • Node.js installed on your machine.
  • A basic understanding of JavaScript.
  • An Etherscan API key (explained below).
  • Familiarity with Ethers.js for blockchain interaction.

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

Tutorial October 24, 2024

npm install ethers

Let’s start by sending Ether from one account to another using Ethers.js and Infura.

Getting Wallet Balance Using Ethers.js in Node.js

Tutorial October 24, 2024

Wallet Address: 0xYourEthereumAddress
Wallet Balance: 2.345 ETH
  • Ethers.js: We are using Ethers.js to interact with the Ethereum blockchain. Ethers.js simplifies the process of querying the blockchain and formatting the data for developers.
  • Provider: Whether you use Infura or a public node, the provider allows us to connect to the Ethereum network. Infura is commonly used because of its reliability and scalability, but public nodes can work as well if you're looking for a simple alternative.
  • getBalance(): This function queries the Ethereum network for the balance of the wallet in wei (the smallest unit of ETH). We then use ethers.utils.formatEther() to convert the balance from wei to Ether.

Blockchain Libraries Cheatsheet

Cheatsheet August 23, 2024
solidity

  <dependency>
    <groupId>org.web3j</groupId>
    <artifactId>core</artifactId>
    <version>4.8.7</version>
  </dependency>