Alchemy Install & Auth
Overview
Install the alchemy-sdk npm package and configure API authentication. Alchemy provides blockchain infrastructure (RPC nodes, Enhanced APIs, NFT APIs, webhooks) across Ethereum, Polygon, Arbitrum, Optimism, Base, and Solana.
Prerequisites
- Node.js 18+ (or Python 3.10+ for alchemy-sdk Python)
- Free Alchemy account at alchemy.com
- API key from Alchemy Dashboard
Instructions
Step 1: Install the Alchemy SDK
# JavaScript/TypeScript (official SDK)
npm install alchemy-sdk
# Python (community SDK)
pip install alchemy-sdk
Step 2: Create an Alchemy App
- Go to dashboard.alchemy.com
- Click "Create new app"
- Select chain: Ethereum, Polygon, Arbitrum, Optimism, Base, or Solana
- Select network: Mainnet, Sepolia (testnet), or Mumbai
- Copy the API key
Step 3: Configure Environment
# Set environment variable
export ALCHEMY_API_KEY="your-api-key-here"
# Or create .env file
cat > .env << 'EOF'
ALCHEMY_API_KEY=your-api-key-here
ALCHEMY_NETWORK=ETH_MAINNET
EOF
echo ".env" >> .gitignore
Step 4: Initialize and Verify
// src/alchemy-client.ts
import { Alchemy, Network } from 'alchemy-sdk';
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET,
});
// Verify connection
async function verifyConnection() {
const blockNumber = await alchemy.core.getBlockNumber();
console.log(`Connected! Latest block: ${blockNumber}`);
return blockNumber;
}
verifyConnection().catch(console.error);
Step 5: Multi-Chain Configuration
// src/config/chains.ts
import { Alchemy, Network } from 'alchemy-sdk';
// Create clients for multiple chains
const chains = {
ethereum: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.ETH_MAINNET }),
polygon: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.MATIC_MAINNET }),
arbitrum: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.ARB_MAINNET }),
optimism: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.OPT_MAINNET }),
base: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.BASE_MAINNET }),
};
export default chains;
Supported Networks
| Chain |
Network Enum |
Mainnet |
Testnet |
| Ethereum |
ETH_MAINNET |
Yes |
Sepolia |
| Polygon |
MATIC_MAINNET |
Yes |
Amoy |
| Arbitrum |
ARB_MAINNET |
Yes |
Sepolia |
| Optimism |
OPT_MAINNET |
Yes |
Sepolia |
| Base |
BASE_MAINNET |
Yes |
Sepolia |
| Solana |
SOL_MAINNET |
Yes |
Devnet |
Output
alchemy-sdk installed in node_modules
- API key configured in environment
- Verified connection with latest block number
- Multi-chain client configuration ready
Error Handling
| Error |
Cause |
Solution |
Must provide apiKey |
Missing env var |
Set ALCHEMY_API_KEY in environment |
401 Unauthorized |
Invalid API key |
Verify key in Alchemy Dashboard |
429 Rate Limit |
Free tier exceeded |
Upgrade plan or reduce request rate |
ECONNREFUSED |
Network blocked |
Ensure HTTPS to *.g.alchemy.com allowed |
Resources
Next Steps
Proceed to alchemy-hello-world for your first blockchain query.
1---
2name: alchemy-install-auth
3description: |
4 Install the Alchemy SDK and configure API key authentication for Web3 development.
5 Use when setting up blockchain API access, creating an Alchemy app,
6 or configuring multi-chain RPC endpoints.
7 Trigger: "install alchemy", "setup alchemy", "alchemy auth", "alchemy API key".
8allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep
9version: 1.0.0
10license: MIT
11author: Jeremy Longshore <jeremy@intentsolutions.io>
12tags: [saas, blockchain, web3, alchemy]
13compatible-with: claude-code
14metadata:
15 source: https://skillmd.com/skills/aibot88/alchemy-install-auth
16---
17
18# Alchemy Install & Auth
19
20## Overview
21
22Install the `alchemy-sdk` npm package and configure API authentication. Alchemy provides blockchain infrastructure (RPC nodes, Enhanced APIs, NFT APIs, webhooks) across Ethereum, Polygon, Arbitrum, Optimism, Base, and Solana.
23
24## Prerequisites
25
26- Node.js 18+ (or Python 3.10+ for alchemy-sdk Python)
27- Free Alchemy account at [alchemy.com](https://www.alchemy.com)
28- API key from Alchemy Dashboard
29
30## Instructions
31
32### Step 1: Install the Alchemy SDK
33
34```bash
35# JavaScript/TypeScript (official SDK)
36npm install alchemy-sdk
37
38# Python (community SDK)
39pip install alchemy-sdk
40```
41
42### Step 2: Create an Alchemy App
43
441. Go to [dashboard.alchemy.com](https://dashboard.alchemy.com)
452. Click "Create new app"
463. Select chain: Ethereum, Polygon, Arbitrum, Optimism, Base, or Solana
474. Select network: Mainnet, Sepolia (testnet), or Mumbai
485. Copy the API key
49
50### Step 3: Configure Environment
51
52```bash
53# Set environment variable
54export ALCHEMY_API_KEY="your-api-key-here"
55
56# Or create .env file
57cat > .env << 'EOF'
58ALCHEMY_API_KEY=your-api-key-here
59ALCHEMY_NETWORK=ETH_MAINNET
60EOF
61
62echo ".env" >> .gitignore
63```
64
65### Step 4: Initialize and Verify
66
67```typescript
68// src/alchemy-client.ts
69import { Alchemy, Network } from 'alchemy-sdk';
70
71const alchemy = new Alchemy({
72 apiKey: process.env.ALCHEMY_API_KEY,
73 network: Network.ETH_MAINNET,
74});
75
76// Verify connection
77async function verifyConnection() {
78 const blockNumber = await alchemy.core.getBlockNumber();
79 console.log(`Connected! Latest block: ${blockNumber}`);
80 return blockNumber;
81}
82
83verifyConnection().catch(console.error);
84```
85
86### Step 5: Multi-Chain Configuration
87
88```typescript
89// src/config/chains.ts
90import { Alchemy, Network } from 'alchemy-sdk';
91
92// Create clients for multiple chains
93const chains = {
94 ethereum: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.ETH_MAINNET }),
95 polygon: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.MATIC_MAINNET }),
96 arbitrum: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.ARB_MAINNET }),
97 optimism: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.OPT_MAINNET }),
98 base: new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: Network.BASE_MAINNET }),
99};
100
101export default chains;
102```
103
104## Supported Networks
105
106| Chain | Network Enum | Mainnet | Testnet |
107|-------|-------------|---------|---------|
108| Ethereum | `ETH_MAINNET` | Yes | Sepolia |
109| Polygon | `MATIC_MAINNET` | Yes | Amoy |
110| Arbitrum | `ARB_MAINNET` | Yes | Sepolia |
111| Optimism | `OPT_MAINNET` | Yes | Sepolia |
112| Base | `BASE_MAINNET` | Yes | Sepolia |
113| Solana | `SOL_MAINNET` | Yes | Devnet |
114
115## Output
116
117- `alchemy-sdk` installed in node_modules
118- API key configured in environment
119- Verified connection with latest block number
120- Multi-chain client configuration ready
121
122## Error Handling
123
124| Error | Cause | Solution |
125|-------|-------|----------|
126| `Must provide apiKey` | Missing env var | Set `ALCHEMY_API_KEY` in environment |
127| `401 Unauthorized` | Invalid API key | Verify key in Alchemy Dashboard |
128| `429 Rate Limit` | Free tier exceeded | Upgrade plan or reduce request rate |
129| `ECONNREFUSED` | Network blocked | Ensure HTTPS to *.g.alchemy.com allowed |
130
131## Resources
132
133- [Alchemy Docs](https://www.alchemy.com/docs)
134- [Alchemy SDK GitHub](https://github.com/alchemyplatform/alchemy-sdk-js)
135- [Alchemy Dashboard](https://dashboard.alchemy.com)
136
137## Next Steps
138
139Proceed to `alchemy-hello-world` for your first blockchain query.