In the previous lessons, we covered the fundamentals of cross-chain staking and lending, explored the Wormhole SDK’s core features, and discussed transaction finality across different chains.
Now it’s time to get hands-on and start building! 🚀
In this lesson, you will:
✅ Install the Wormhole SDK and required dependencies for cross-chain interaction
✅ Set up project environment variables and connect to both Solana and Ethereum RPC nodes
Step 1: Create the Project and Install Dependencies
Start by creating a new project directory. Then, install the Wormhole SDK along with the necessary packages for interacting with Solana and Ethereum.
Don’t worry if you’re unsure about any steps—complete project code will be provided at the end!
🔹 Install the Wormhole SDK
🔹 Install ethers.js for Ethereum interactions
🔹 Install @solana/web3.js for Solana interactions
🔹 Install dotenv to manage environment variables
💡 After installation, your package.json should include the following dependencies:
Step 2: Set Up Environment Variables
In the root of your project, create a file named .env.local and add the following content:
1
📌 What These Variables Do:
●NEXT_PUBLIC_ETH_RPC_URL – Connects to the Ethereum Sepolia testnet
●NEXT_PUBLIC_SOLANA_RPC_URL – Connects to the Solana Devnet for testing cross-chain functionality
●NEXT_PUBLIC_WORMHOLE_NETWORK – Sets the Wormhole network to Testnet
💡 How to Get an Ethereum Sepolia RPC URL?