DeveloperBreeze

Etherscan Api Development Tutorials, Guides & Insights

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

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

Tutorial October 24, 2024

We will use Ethers.js to interact with the Ethereum blockchain and Axios to make HTTP requests to the Etherscan API.

npm install ethers
npm install axios

Understanding and Using the Etherscan API to Query Blockchain Data

Tutorial October 24, 2024

Once you have written the script, run it from your terminal:

node etherscanBalance.js

Tracking Newly Created Tokens on Ethereum

Tutorial August 09, 2024
javascript nodejs

We will use Etherscan's API to fetch information about newly created tokens. Add the following function to your index.js file:

const axios = require('axios');

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

async function getNewTokens() {
  try {
    const url = `https://api.etherscan.io/api?module=account&action=tokentx&address=0x0&startblock=0&endblock=99999999&sort=asc&apikey=${ETHERSCAN_API_KEY}`;
    const response = await axios.get(url);

    if (response.data.status === '1') {
      const transactions = response.data.result;
      const newTokens = transactions.filter(tx => tx.tokenSymbol && tx.tokenName && tx.from === '0x0000000000000000000000000000000000000000');

      console.log('Newly Created Tokens:');
      newTokens.forEach(token => {
        console.log(`- Token Name: ${token.tokenName}`);
        console.log(`  Token Symbol: ${token.tokenSymbol}`);
        console.log(`  Token Contract Address: ${token.contractAddress}`);
      });
    } else {
      console.error('Error fetching token transactions:', response.data.message);
    }
  } catch (error) {
    console.error('Error:', error);
  }
}

getNewTokens();