1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is it possible that Ganache can handle a private key without an "0x" prefix, but Parity cannot?

Discussion in 'Finance' started by goodvibration, Aug 2, 2020.

  1. I am trying to sign and send a transaction as follows:

    let signedTx = await web3.eth.accounts.signTransaction(options, PRIVATE_KEY);
    let txReceipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
    ...


    The PRIVATE_KEY variable is a 40-character long hexadecimal string, without an 0x prefix.

    The options variable is an object containing to, data and gas fields.

    My code completes successfully on Ganache, but when I run it on a fully-synced Parity node connected to ropsten, I get the following error:

    Insufficient funds.
    The account you tried to send transaction from does not have enough funds.
    Required 8000000000000000 and got: 0.


    My account definitely has more than 0 ether on ropsten (see https://ropsten.etherscan.io/address/0x1c492da58f6396be2880576cc513c5b108450429), and I can even verify it locally (via web3.js):

    let balance = await this.web3.eth.getBalance("0x1c492da58f6396be2880576cc513c5b108450429");
    console.log(balance);


    So here is the thing.

    I was able to resolve this problem by adding 0x at the beginning of the PRIVATE_KEY variable.

    Hence my question - is it possible that web3.eth.accounts.signTransaction runs differently on Ganache and on Parity?

    Thank you!

    Login To add answer/comment
     

Share This Page