I need to send eth to accounts that have erc20 tokens:
foreth.forEach(function(item,i){
const balance = contractInstance.methods.balanceOf(item).call(function(err, result) {
console.log(result)
if (result>0) {
console.log("success")
web3.eth.getTransactionCount(fromAddress)
.then((count) => {
let rawTransaction = {
'from': fromAddress,
'gasPrice': web3.utils.toHex(10 * 1e9),
'gasLimit': web3.utils.toHex(21000),
'to': item,
'value': web3.utils.toHex(web3.utils.toWei("0.0002")),
'nonce': web3.utils.toHex(count)+i
}
let transaction = new Tx(rawTransaction)
transaction.sign(privateKey)
web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
.on('transactionHash', console.log)
})
}
})
})
But when executing the code, 2 caches are generated for me, which are not on etherscan. Account transactions are also not visible, what's the problem? Some later i get error:
Transaction was not mined w
ithin 750 seconds, please make sure your transaction was properly sent. Be aware
that it might still be mined!
any1 can help me?