| 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
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;
}
getBalance('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045').catch(console.);