Web3.js integration
Learn how to use Web3.js, a widely-used JavaScript library for connecting to GetBlock nodes.
Install Web3.js
npm install web3yarn add web3dist/web3.min.jsSet up your connection to GetBlock
// Import the Web3 library
const Web3 = require('web3');
// Set GetBlock as the provider (replace ACCESS_TOKEN with your actual token)
var web3 = new Web3('https://go.getblock.io/ACCESS_TOKEN');
// Initialize web3 method
web3.eth.getBlockNumber().then(console.log);Last updated
Was this helpful?