Alchemy Hello World

VerifiedSafe

Create a minimal Alchemy Web3 example: get ETH balance, fetch NFTs, read token balances.

Sby Skills Guide Bot
DevelopmentBeginner
7/22/2026
Claude Code
#blockchain#web3#alchemy#nft#typescript

Recommended for

Automated summary

Produces small working TypeScript examples using the Alchemy SDK: ETH balance, a wallet's NFTs, ERC-20 token balances, and latest block details.

Strengths

  • Code snippets are directly runnable with correct Alchemy imports and client configuration
  • Covers four common read queries (ETH, NFTs, ERC-20, block) with readable console output
  • Uses real addresses and an ENS name as test inputs, making quick verification easy
  • Handles amount formatting through Utils.formatEther and token metadata decimals

Limitations

  • Assumes the alchemy-install-auth step is complete and an ALCHEMY_API_KEY is available in the environment
  • Read-only Ethereum mainnet queries; no signed transactions and only minimal console-based error handling
  • The overview mentions subscribing to pending transactions, but no step actually implements it
When to use it

Use it when starting blockchain development or quickly confirming that an Alchemy setup works with basic queries.

When not to use it

Avoid it if you need on-chain writes, wallet management, or smart contract deployment examples.

Security analysis

Safe
Quality score90/100

The skill provides standard Alchemy SDK examples for reading public blockchain data. It does not instruct destructive commands, secret exfiltration, obfuscated payloads, or safety bypasses. The API key is read from process.env and not printed or transmitted, and Bash usage is limited to npm commands.

No concerns found

How this analysis is made

Examples

Quick start with Alchemy
Create an Alchemy hello world example that gets the ETH balance of an address using alchemy-sdk and TypeScript.
Fetch wallet NFTs
Show me how to fetch the NFTs owned by vitalik.eth with Alchemy and print the contract name, token ID and image URL.
Read ERC-20 balances
Write a script using the Alchemy SDK that lists the ERC-20 token balances of a wallet with human-readable symbols and amounts.

name: alchemy-hello-world description: 'Create a minimal Alchemy Web3 example: get ETH balance, fetch NFTs, read token balances.

Use when starting blockchain development, testing Alchemy setup,

or learning basic blockchain query patterns.

Trigger: "alchemy hello world", "alchemy example", "alchemy quick start",

"get ETH balance", "fetch NFTs alchemy".

' allowed-tools: Read, Write, Edit, Bash(npm:*) version: 1.5.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:

  • saas
  • blockchain
  • web3
  • alchemy
  • nft compatibility: Designed for Claude Code

Alchemy Hello World

Overview

Minimal working examples with the real Alchemy SDK: get ETH balance, fetch NFTs for a wallet, read ERC-20 token balances, and subscribe to pending transactions.

Prerequisites

  • Completed alchemy-install-auth setup
  • alchemy-sdk installed (npm install alchemy-sdk)
  • Valid API key configured

Instructions

Step 1: Get ETH Balance

// src/hello-world/get-balance.ts
import { Alchemy, Network, Utils } from 'alchemy-sdk';

const alchemy = new Alchemy({
  apiKey: process.env.ALCHEMY_API_KEY,
  network: Network.ETH_MAINNET,
});

async function getBalance(address: string) {
  const balanceWei = await alchemy.core.getBalance(address);
  const balanceEth = Utils.formatEther(balanceWei);
  console.log(`Balance of ${address}: ${balanceEth} ETH`);
  return balanceEth;
}

// Query Vitalik's address
getBalance('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045').catch(console.error);

Step 2: Fetch NFTs for a Wallet

// src/hello-world/get-nfts.ts
import { Alchemy, Network } from 'alchemy-sdk';

const alchemy = new Alchemy({
  apiKey: process.env.ALCHEMY_API_KEY,
  network: Network.ETH_MAINNET,
});

async function getNftsForOwner(owner: string) {
  const nfts = await alchemy.nft.getNftsForOwner(owner);
  console.log(`Total NFTs: ${nfts.totalCount}`);

  for (const nft of nfts.ownedNfts.slice(0, 5)) {
    console.log(`  ${nft.contract.name} — ${nft.name || nft.tokenId}`);
    console.log(`    Contract: ${nft.contract.address}`);
    console.log(`    Token ID: ${nft.tokenId}`);
    if (nft.image?.cachedUrl) {
      console.log(`    Image: ${nft.image.cachedUrl}`);
    }
  }

  return nfts;
}

getNftsForOwner('vitalik.eth').catch(console.error);

Step 3: Get ERC-20 Token Balances

// src/hello-world/get-tokens.ts
import { Alchemy, Network } from 'alchemy-sdk';

const alchemy = new Alchemy({
  apiKey: process.env.ALCHEMY_API_KEY,
  network: Network.ETH_MAINNET,
});

async function getTokenBalances(address: string) {
  const balances = await alchemy.core.getTokenBalances(address);

  console.log(`Token balances for ${address}:`);
  for (const token of balances.tokenBalances.slice(0, 10)) {
    if (token.tokenBalance && token.tokenBalance !== '0x0') {
      // Get token metadata for human-readable names
      const metadata = await alchemy.core.getTokenMetadata(token.contractAddress);
      const balance = parseInt(token.tokenBalance, 16) / Math.pow(10, metadata.decimals || 18);
      console.log(`  ${metadata.symbol}: ${balance.toFixed(4)}`);
    }
  }
}

getTokenBalances('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045').catch(console.error);

Step 4: Get Latest Block Info

// src/hello-world/get-block.ts
import { Alchemy, Network } from 'alchemy-sdk';

const alchemy = new Alchemy({
  apiKey: process.env.ALCHEMY_API_KEY,
  network: Network.ETH_MAINNET,
});

async function getLatestBlock() {
  const blockNumber = await alchemy.core.getBlockNumber();
  const block = await alchemy.core.getBlock(blockNumber);

  console.log(`Block #${blockNumber}`);
  console.log(`  Hash: ${block.hash}`);
  console.log(`  Timestamp: ${new Date(block.timestamp * 1000).toISOString()}`);
  console.log(`  Transactions: ${block.transactions.length}`);
  console.log(`  Gas Used: ${block.gasUsed.toString()}`);
}

getLatestBlock().catch(console.error);

Output

  • ETH balance query with Wei → ETH conversion
  • NFT enumeration with metadata and images
  • ERC-20 token balances with symbol resolution
  • Block data with timestamp and gas usage

Error Handling

| Error | Cause | Solution | |-------|-------|----------| | Invalid address | Malformed Ethereum address | Use checksummed 0x-prefixed address | | 429 Too Many Requests | Rate limit exceeded | Add delay between calls or upgrade plan | | ENS name not found | ENS not resolving | Verify ENS name exists on mainnet | | Timeout | Slow node response | Increase timeout in SDK config |

Resources

Next Steps

Proceed to alchemy-local-dev-loop for development workflow setup.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/alchemy-hello-world-mrwakb5t/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/alchemy-hello-world-mrwakb5t' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/alchemy-hello-world-mrwakb5t/download' --output '.skill-downloads/alchemy-hello-world-mrwakb5t/SKILL.md.part' && mv '.skill-downloads/alchemy-hello-world-mrwakb5t/SKILL.md.part' '.skill-downloads/alchemy-hello-world-mrwakb5t/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Environment declared by the author: Designed for Claude Code

Tools declared by the author (check availability in your agent): Read, Write, Edit, Bash(npm:*)

Original excerpt: Prerequisites
  • Completed alchemy-install-auth setup
  • alchemy-sdk installed (npm install alchemy-sdk)
  • Valid API key configured

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/alchemy-hello-world-mrwakb5t/SKILL.md' && test -s '.skill-downloads/alchemy-hello-world-mrwakb5t/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/alchemy-hello-world' && cp -R '.skill-downloads/alchemy-hello-world-mrwakb5t' '.claude/skills/alchemy-hello-world'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/alchemy-hello-world-mrwakb5t'

openskills read 'alchemy-hello-world-mrwakb5t'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/alchemy-hello-world-mrwakb5t/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills