DeveloperBreeze

Dapp Development Tutorials, Guides & Insights

Unlock 3+ expert-curated dapp tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your dapp skills on DeveloperBreeze.

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

Tutorial October 24, 2024

const axios = require('axios');

// Replace with your actual Etherscan API key
const apiKey = 'YOUR_ETHERSCAN_API_KEY';

// Replace with the Ethereum address you want to query
const address = '0xYourEthereumAddress';

// Etherscan API URL to fetch wallet balance
const url = `https://api.etherscan.io/api?module=account&action=balance&address=${address}&tag=latest&apikey=${apiKey}`;

async function getWalletBalance() {
  try {
    const response = await axios.get(url);
    const balanceInWei = response.data.result;

    // Convert balance from Wei to Ether
    const balanceInEther = balanceInWei / 1e18;
    console.log(`Wallet Balance: ${balanceInEther} ETH`);
  } catch (error) {
    console.error('Error fetching balance:', error);
  }
}

getWalletBalance();
  • API: This script sends a GET request to Etherscan's API to fetch the balance of the specified Ethereum wallet.
  • Use Case: Ideal for applications needing read-only access to Ethereum data.

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

Tutorial October 24, 2024

Example output:

Transaction sent: 0xTransactionHash
Transaction confirmed: { transaction details }

Creating a Decentralized Application (dApp) with Solidity, Ethereum, and IPFS: From Smart Contracts to Front-End

Tutorial August 20, 2024
javascript solidity

Update the React component to include IPFS integration:

const updateIPFSHash = async () => {
  const ipfsHash = 'Your IPFS hash here';
  await contract.methods.setIPFSHash(ipfsHash).send({ from: account });
  const updatedIPFSHash = await contract.methods.getIPFSHash().call();
  console.log(updatedIPFSHash);
};