1

I'm trying to sign transaction and send it to remote node, but I keep getting this error: UnhandledPromiseRejectionWarning: Error: Returned error: invalid sender

This is how I perform signing and then sending actions:

var Deployer = {
TxBuilder: function() {
    var signedTx;
    try{
        web3.eth.getTransactionCount(keyPair.address).then(function(res) {
            web3.eth.accounts.signTransaction({
                nonce: web3.utils.toHex(res + 1),
                from: keyPair.address,
                to: smartContractData.address,
                data: 'some encoded data here',
                gas: '4000000',
                gasPrice: web3.utils.toHex('5000000000'),
                gasLimit: web3.utils.toHex('4000000'),
                chainID: '2487'
            }, keyPair.privateKey).then(signedTx => {
                   //console.log(signedTx.rawTransaction);
                   web3.eth.sendSignedTransaction(signedTx.rawTransaction).on('receipt', console.log);
               });
        });
    } catch(error) {
        console.error('Error while sending signed tx: ' + error);
    }
}

};

Deployer.TxBuilder();

Here is account data, that I refer to in my code:

var keyPair = {
address: '0x413671Ef1633C4e31D07c4D36C92109792133C8a',
privateKey: '0x6ade95688cb8c16a6e6543505a995a3ad37fb93404189228d5f2ed690008a2ce'

};

I'm able to sign the transaction, but I just can't send it, I tried what was described here: Invalid sender error on private chain but it didn't help as well.

I have balance in my account in custom ethers. I can deploy smart contracts and make calls / send transactions to any method in deployed smart contracts to the same private network from the very same account via MyEtherWallet, for instance. The problem is that I can't do it via web3.

I'm using:
- web3 1.0.0 36 beta

Any help with this is much appreciated, thank you!

  • What is the value of keyPair.address? – goodvibration Nov 5 '18 at 14:04
  • @goodvibration, it is a simple object with test keypair for private network deployed on a remote node. Value of the field is 0x413671Ef1633C4e31D07c4D36C92109792133C8a – Vlad Nov 5 '18 at 14:07
  • try to also add the parameter v: 2487 * 2 + 35 to the tx to be signed. – Tudor Constantin Nov 5 '18 at 14:16
  • @TudorConstantin thanks, tried that, but the error still remains the same – Vlad Nov 5 '18 at 14:19
  • How did you configure the private network? – goodvibration Nov 5 '18 at 14:29

Your Answer

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

Browse other questions tagged or ask your own question.