All articles
developer-toolsclisolanaevmapialchemytooling

Alchemy CLI: query blockchain data, send transactions, and manage apps from the terminal

The Alchemy CLI installs as a global npm package and covers EVM and Solana chains — balances, token data, NFTs, transfers, swaps, bridges, contract calls, simulations, webhooks, and account admin. Two flags make every command scriptable: --json and --no-interactive.

Share
devrels.xyz/a/122short link

Alchemy runs RPC nodes and data APIs for Ethereum, Solana, and 100+ other networks. The Alchemy CLI wraps those APIs in a terminal interface: install it globally, authenticate once, and you can query balances, pull NFT data, send transactions, simulate contract calls, manage webhooks, and create apps — without writing a script. Two flags (--json and --no-interactive) make every command machine-readable and suitable for CI pipelines or agent loops.

Installation and authentication

bash
npm i -g @alchemy/cli@latest

# Authenticate via browser (recommended)
alchemy auth
# Opens browser → link your Alchemy account → select an app
# API key is saved automatically to ~/.alchemy/config

# Or set an API key directly
export ALCHEMY_API_KEY=your_api_key_here

# Or pass it per-command
alchemy balance 0xd8dA6BF... --api-key your_key -n eth-mainnet

After alchemy auth, the selected app's API key is stored locally. Use alchemy app list and alchemy app select <app-id> to switch between apps. The ALCHEMY_API_KEY environment variable overrides the stored key — useful in CI.

EVM commands

EVM commands live under alchemy evm or as top-level shortcuts. They cover JSON-RPC, the Data API (tokens, NFTs, transfers, pricing), simulation, and wallet-signed operations across 100+ networks.

bash
# ── Network ────────────────────────────────────────────────────────
alchemy evm network list                       # all supported EVM networks
alchemy evm network list --search base         # filter by name

# ── Balances and assets ─────────────────────────────────────────────
alchemy balance 0xd8dA6BF...                   # native ETH balance
alchemy balance 0xd8dA6BF... -n base-mainnet   # on Base

alchemy tokens balances 0xd8dA6BF...           # all ERC-20 holdings
alchemy tokens metadata 0xA0b8...              # token name, symbol, decimals
alchemy nfts 0xd8dA6BF...                      # NFT inventory
alchemy nfts --contract 0xBC4CA...             # filter by contract

# ── Transaction data ────────────────────────────────────────────────
alchemy tx 0x4a0...                            # transaction details
alchemy transfers from 0xd8dA6BF...            # outgoing transfers
alchemy transfers to 0xd8dA6BF...              # incoming transfers
alchemy block latest                           # latest block
alchemy gas                                    # current gas prices

# ── Pricing ─────────────────────────────────────────────────────────
alchemy prices 0xA0b8...                       # current spot price
alchemy prices 0xA0b8... --historical --days 7 # 7-day history

# ── Logs ────────────────────────────────────────────────────────────
alchemy logs --address 0xdAC1... --topic 0xddf...  # event logs by filter

# ── Simulation ──────────────────────────────────────────────────────
alchemy evm simulate \
  --from 0xd8dA6BF... \
  --to 0xA0b8... \
  --data 0xa9059cbb...  # preview outcome before broadcasting

# ── Swap (EVM mainnets) ─────────────────────────────────────────────
alchemy evm swap \
  --from 0xEeee...      \  # use 0xEeee...EEeE for native ETH/MATIC/etc.
  --to 0xA0b8...        \
  --amount 0.1          \
  --signer wallet          # Agent Wallet session or local key

# ── Bridge ──────────────────────────────────────────────────────────
alchemy bridge quote --from eth-mainnet --to base-mainnet --token ETH --amount 0.5
alchemy bridge execute ...  # execute with wallet signing

# ── Raw JSON-RPC ────────────────────────────────────────────────────
alchemy evm rpc eth_getBalance '["0xd8dA6BF...", "latest"]'

Solana commands

Solana commands live under alchemy solana. They cover native SOL transfers, SPL token operations, RPC queries, DAS (Digital Asset Standard) calls for NFTs, and stake delegation.

bash
# ── Network ────────────────────────────────────────────────────────
alchemy solana network list
alchemy solana network list --search mainnet

# ── SOL transfer ────────────────────────────────────────────────────
alchemy wallet connect --mode session          # start Agent Wallet session
alchemy solana send <recipient> 0.1 -n solana-mainnet

# ── Transaction status ──────────────────────────────────────────────
alchemy solana status <signature>

# ── Raw RPC ─────────────────────────────────────────────────────────
alchemy solana rpc getBalance '["<pubkey>"]'
alchemy solana rpc getAccountInfo '["<pubkey>", {"encoding": "jsonParsed"}]'
alchemy solana rpc getSignaturesForAddress '["<pubkey>", {"limit": 10}]'

# ── DAS (Digital Asset Standard) ───────────────────────────────────
alchemy solana das getAsset '["<mint>"]'
alchemy solana das getAssetsByOwner '["<pubkey>"]'
alchemy solana das searchAssets '{"ownerAddress": "<pubkey>"}'

# ── SPL token delegation ────────────────────────────────────────────
alchemy solana delegate approve \
  --token-account <ata> \
  --mint <mint> \
  --delegate <delegate-pubkey> \
  --amount 1000

alchemy solana delegate revoke --token-account <ata>

Webhooks

Alchemy Notify webhooks fire on address activity, mined transactions, dropped transactions, and custom GraphQL events. The CLI lets you create and manage them without the dashboard.

bash
# Set webhook API key (separate from app API key)
alchemy config set webhook-api-key <key>
# or: export ALCHEMY_WEBHOOK_API_KEY=<key>

# Create an address activity webhook
alchemy webhook create \
  --type ADDRESS_ACTIVITY \
  --url https://your-endpoint.com/hook \
  --network eth-mainnet \
  --addresses 0xd8dA6BF...,0xA0b8...

# List all webhooks
alchemy webhook list

# Add addresses to an existing webhook
alchemy webhook addresses add <webhook-id> 0xNew...

# Delete a webhook
alchemy webhook delete <webhook-id>

App management

bash
# List and switch apps
alchemy app list
alchemy app select <app-id>

# Create a new app
alchemy app create --name "my-app" --network eth-mainnet

# Configure allowlists
alchemy app allowlist add --type domain --value myapp.com
alchemy app allowlist add --type address --value 0xd8dA...

# API usage stats
alchemy usage summary                          # total calls this period
alchemy usage timeseries --days 7             # daily breakdown

Automation and scripting

Every command supports two flags that make it safe to use in pipelines, CI, and agent loops:

bash
# --json: structured JSON on stdout (errors on stderr)
alchemy balance 0xd8dA6BF... --json
# {"address":"0xd8dA...","balance":"12.34","symbol":"ETH","network":"eth-mainnet"}

# --no-interactive: never block waiting for input (fail instead)
alchemy balance 0xd8dA6BF... --json --no-interactive

# Combine with jq for scripting
BALANCE=$(alchemy balance 0xd8dA6BF... --json --no-interactive | jq -r '.balance')
echo "Balance: $BALANCE ETH"

# Use in a CI step to check a deployer wallet before a release
alchemy balance $DEPLOYER_ADDR --json --no-interactive \
  | jq -e '.balance | tonumber > 0.1' || { echo "insufficient funds"; exit 1; }

For agent workflows, alchemy agent-prompt generates a context string describing the CLI's capabilities — useful for bootstrapping an AI agent that needs to know what commands are available without running alchemy help inline.

Shell completions

bash
# zsh
alchemy completion zsh >> ~/.zshrc && source ~/.zshrc

# bash
alchemy completion bash >> ~/.bashrc && source ~/.bashrc

# fish
alchemy completion fish > ~/.config/fish/completions/alchemy.fish

Keep reading

Get new articles in your inbox

Technical deep-dives on Solana tooling, infrastructure, and ecosystem. No noise.

Alchemy CLI: query blockchain data, send transactions, and manage apps from the terminal | devrels.xyz