1

web3.BatchRequest(); does it produce a single transaction with several functions of the (possibly different) contracts or not?

  var batch = new web3.BatchRequest();
  batch.add(web3.eth.sendSignedTransaction.request(raw3, (err,tx3Hash) =>{
  console.log('err:', err, 'tx3Hash:', tx3Hash)  
  }))
  batch.add(web3.eth.sendSignedTransaction.request(raw4, (err,tx4Hash) =>{
  console.log('err:', err, 'tx4Hash:', tx4Hash)  
  }))
  batch.execute()

this code gives me two different transactions, how i can have them in one?

2

BatchRequest batches only JSON-RPC calls for your Ethereum node API. Transactions are independent and separate concern of those. BatchRequest only saves you some modest amount of HTTP traffic.

1
  • 1
    Thanks! I have only 15 rep and cant upvote your answer. – KeepKolmogorov Jan 26 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.