Get access to Alchemy for free here.
Estimated time to complete this guide: ~5 minutes
For a quick start, you can interact with Ethereum nodes using JSON RPC shell commands. This can be quite manual, and you can write POST requests, GET requests, or others. See examples here.
First, install Homebrew. Homebrew is a great installation software for macs so you can easily download other packages in the future. To install Homebrew, open Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install node
There are tons of Web3 libraries you can integrate with Alchemy, however, we recommend using Alchemy Web3, a drop-in replacement for web3.js, built and configured to work seamlessly with Alchemy. This provides multiple advantages such as automatic retries and robust WebSocket support.
In Terminal on the command line:
npm install @alch/alchemy-web3
WebSockets are a great way to subscribe to events and changes, learn more through our Using WebSockets page. To use WebSockets, first install WebSocket cat.
npm install -g wscat
Now connect to Alchemy's blockchain infrastructure using WebSockets:
Using Alchemy's demo:
wscat -c wss://eth-mainnet.ws.alchemyapi.io/ws/demo
Using your own key:
wscat -c wss://eth-mainnet.alchemyapi.io/ws/<api-key>
Create a Web3 instance and set your provider as Alchemy:
const web3 = new Web3("wss://eth-mainnet.ws.alchemyapi.io/ws/demo");
Now that you have everything you need installed, start building your first app. Here are a couple great starting points: