I'm trying to send this transaction using etthers.js and getting transaction details as output but when I try to put the txnhash on etherscan it shows nothing, I tried rinkeby and kovan. [private key and Web3 provider API keys are hidden]

var ethers = require('ethers');  
var url = 'https url of a web3 provider like QuikNode, Infura etc';
var customHttpProvider = new ethers.providers.JsonRpcProvider(url);

var privateKey = "";
var wallet = new ethers.Wallet(privateKey);
console.log("Address: " + wallet.address);

tx = {
  to: "0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE",
  value: ethers.utils.parseEther("0.5"),
  gasLimit: 10000000,
  gasPrice: "0x07f9acf02",
  nonce: 3,
  chainId: 42,


A quick look at the docs (scroll down a bit to the code examples) show that you should be invoking sendTransaction on the raw tx object - you don't need to call signTransaction first. You can also see this more formally in a little bit above in the docs here.

For the record, you mentioned checking Rinkeby for the tx. You've put in chainId: 42 in the tx object, which is Kovan, as you can see here. I think you already knew that, though, since you mentioned Kovan too.

Another point I can't speak to is if you have to set 'nonce', 'gasPrice', and 'gasLimit' manually. I assume from the Ethers docs code examples that you don't (the tx object in the example only has to and value), in which case you most likely should not try setting them yourself, as it will only increase your chances of a failed tx. I'll try to update this if I find out one way or the other.

  • 1
    Thank you so much for your help. – Sahil Sen Sep 24 '20 at 21:24
  • If the answer helped you, it helps me if you give the answer an upvote (the up arrow), and accept it as the answer (the checkmark under the up and down arrows). It also signals to people that this answer answered your question, in case they're stuck on a similar problem. No pressure, though! It's your choice to make! – The Renaissance Sep 25 '20 at 7:17

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.