Loading...
Hello Folks,
So in this session we will be discussing about the underscore library using web3 from nodejs.
To do that we need to have web3 Node module installed on our system.
We can do this by running the following code on the cmd
npm install web3
Then let's run our node server. Just run the following code on cmd.
node
Then we need web3 module in our server so run the following code
var Web3 = require('web3')
we will be needing a Blockchain network to create an account so get an rpc url from here
Just click on the link -> Login to your account ->Click on ethereum on left side bar ->create project ->settings->keys->endpoints
and choose your respective testnet rpc url
rpc url it will look like this - https://mainnet.infura.io/v3/your_api_key
var url = 'your RPC url here'
Then run this one
var web3 = new Web3(url)
let's have an instance of _ library
const _ = web3.utils._
To see all the methods listed inside the underscore library we can use this code
console.log(_)
let's use "each" method from underscore library methods which takes key value pairs as input and inside callback function we pass arguments in the order "value,key"
_.each({key1:'value1',key2:'value2'},(value,key)=>{console.log(key,value)})
and for other methods you can try yourself.
For test ethers and link tokens. Click Here
For many more exciting tutorials keep following my username @BlockTalks_Raj
!!!!!HAPPY LEARNING!!!!