- Create an 'app' and select the Goerli test network.
https://dashboard.alchemy.com/
- Copy the API key.
- Create a new project and install the Alchemy SDK.
npm init
npm install alchemy-sdk
- Create a file named index.js and add the following code:
const { Network, Alchemy } = require("alchemy-sdk");
const settings = {
apiKey: "wEDkV89fbvvsbplG8oYhrwnOYG8c3M-C",
network: Network.ETH_GOERLI,
};
const alchemy = new Alchemy(settings);
async function main() {
const latestBlock = await alchemy.core.getBlockNumber();
console.log("The latest block number is", latestBlock);
}
main();
- Start the application!
node index.js