invalid sender error when trying to send signed transaction

+1 vote

Hi!
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 keyPair = {

address: '0x413671Ef1633C4e31D07c4D36C92109792133C8a',

privateKey: '0x6ade95688cb8c16a6e6543505a995a3ad37fb93404189228d5f2ed690008a2ce' //also tried without prefix

};

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 for tx`,

gas: '4000000',

gasPrice: web3.utils.toHex('5000000000'),

gasLimit: web3.utils.toHex('4000000'),

chainID: '2487' // chain ID set to a genesis.json

//v: 28 also tried v: 27, v: chainID, v: chainID * 35 + 2

}, 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();

`

And here is the error I'm getting:
`

(node:31584) UnhandledPromiseRejectionWarning: Error: Returned error: invalid sender
    at Object.ErrorResponse (/home/vlad/projects/TxSigner_Sender/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/vlad/projects/TxSigner_Sender/node_modules/web3-core-requestmanager/src/index.js:140:36
    at XMLHttpRequest.request.onreadystatechange (/home/vlad/projects/TxSigner_Sender/node_modules/web3-providers-http/src/index.js:91:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/vlad/projects/TxSigner_Sender/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/vlad/projects/TxSigner_Sender/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/vlad/projects/TxSigner_Sender/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/home/vlad/projects/TxSigner_Sender/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:31584) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:31584) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

`
I'm able to sign the transaction, but I just can't send it. Also I can call / send transaction to any method in any smart contract on the same private network from the very same account via MyEtherWallet (after connecting to the node of course). The problem is that I just can't do the same via web3.

 

I'm using:
- web3 1.0.0 36 beta

Any help with this is much appreciated, thank you!

Nov 6, 2018 in Blockchain by Vlad
• 130 points

edited Nov 6, 2018 by Vlad 5,189 views
Hello Vlad. I am getting the same error. Did you find a solution for this?

1 answer to this question.

0 votes
Hi, i had the same error and i solve this by fix the config

If you are the owner of the network
When you want to power a network, you must to define the network ID in option in command line for geth to perfom network, it must be equal with chain ID in config.
after this in you transaction object you also must to specify chainId.

And it error should be solves
answered Nov 16, 2018 by bublig737
Thanks bublig737, will try it out.

Hey @bublig737. Did you mean like this:

geth --datadir ./myDataDir --networkid 1114 console 2>> myEth.log

Related Questions In Blockchain

0 votes
1 answer
0 votes
1 answer

'Invalid sender' error after upgrading to geth 1.4.0

Guessing that the JSON RPC stuff changed ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,029 views
0 votes
1 answer

Error when trying to deploy Ethereum smart contract using web3j

Create a new credential based on the Credentials.create ...READ MORE

answered Oct 3, 2018 in Blockchain by slayer
• 29,350 points
1,399 views
0 votes
1 answer

Why is it downloading the blocks when I am trying to deploy the ethereum private network?

Once you have installed the Ethereum wallet, ...READ MORE

answered May 3, 2018 in Blockchain by Shashank
• 10,400 points
434 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,663 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,215 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,450 points
1,129 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP