Loading...
Batch request is helpful in many applications where exceuting many requests at a single instant. Batch request can be extremely useful in creating a interactive web3 dapp, like we can send signed multiple transaction without user's involvement in a dapp. For user it will act as a traditional application but perks of any other dapp.
Batch request has two functions,
var web3 = require('web3');
var batch = new web3.BatchRequest();
var contract = new web3.eth.Contract(abi, address);
batch.add(web3.eth.getBalance.request('0x0000000000000000000000000000000000000000', 'latest', callback));
batch.add(contract.methods.balance(address).call.request({from: '0x0000000000000000000000000000000000000000'}, callback2));
batch.execute();