Getting Avalanche RPC
SDK
caution
Input 📥
- BackEnd
- FrontEnd
// Install lavaSDK with the following command:
// npm i @lavanet/lava-sdk
const { LavaSDK } = require("@lavanet/lava-sdk")
async function useAvalancheMainnet() {
const avalancheMainnet = await LavaSDK.create({
privateKey: process.env.PRIVATE_KEY, //hide your private key in an environmental variable
chainIds: 'AVAX',
});
const avalancheBlockResponse = await avalancheMainnet.sendRelay({
method: "eth_blockNumber",
params: [],
});
console.log(avalancheBlockResponse);
}
(async () => {
await useAvalancheMainnet();
})();
// Install lavaSDK with the following command:
// npm i @lavanet/lava-sdk
const { LavaSDK } = require("@lavanet/lava-sdk")
async function useAvalancheMainnet() {
const avalancheMainnet = await LavaSDK.create({
badge: {
badgeServerAddress: "https://badges.lavanet.xyz", // Or your own Badge-Server URL
projectId: "enter_your_project_id_here"
},
chainIds: 'AVAX',
geolocation: "2"
});
const avalancheBlockResponse = await avalancheMainnet.sendRelay({
method: "eth_blockNumber",
params: [],
});
console.log(avalancheBlockResponse);
}
(async () => {
await useAvalancheMainnet();
})();
Output 📤
To learn more about our SDK visit the Getting Started guide
Gateway
To learn more about using the Lava Gateway visit the Getting Started guide