| Cluster | RPC Endpoint |
|---|---|
| mainnet | https://api.mainnet.solana.com |
| devnet | https://api.devnet.solana.com |
| testnet | https://api.testnet.solana.com |
| localhost | http://localhost:8899 |
Connect using RPC URL
Connect to a specific RPC endpoint:@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.Connect using the network moniker
You can also connect to a public RPC endpoint by specifying its network name (moniker):@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.