Getting issues while Sending signTransaction with web3 js

+1 vote

Hi I am new to Blockchain, I tried making transaction using ropsten network, but I m getting error in my web3.js

enter image description here

exports.sendTransactions = () => {

      var admin = "0xEF9dE245F335e0f3ae8A9563FD54D001de1d3E2D";
      var contract_address = "0x39E2f0E87027093C6Ffe76A4d2f20AEE479E5f64";
      var tx = {
        from: admin,
        to: contract_address,
        gas: 184000,
        data: "",`enter code here`
        chainId: "1337"
      };
      web3.eth.accounts.signTransaction(tx, 'privateKey').then((hash) => {
        web3.eth.sendSignedTransaction(hash.rawTransaction).then((receipt) => {
          resolve();
        }, (error) => {
          console.log(error);
          reject(500);
        });
      }, (error) => {
        reject(500);
      });
    }

 { messageHash: '0x15e3f440015b35151c1343fb9a6be2497c082b47dbce607d32e80c10eff800f1',
      v: '0xa95',
      r: '0x4446233885e382fc9f297dc47fe9294be57623341b781eece94ce28b52bec6ed',
      s: '0x51b096eb07f73d5a30757300caf990b4083d001d2f6aea0fca280aafbea5593d',
      rawTransaction: '0xf8678085012a05f2008302cec09439e2f0e87027093c6ffe76a4d2f20aee479e5f648080820a95a04446233885e382fc9f297dc47fe9294be57623341b781eece94ce28b52bec6eda051b096eb07f73d5a30757300caf990b4083d001d2f6aea0fca280aafbea5593d' }

    Error: Returned error: invalid sender
        at Object.ErrorResponse (/home/ri-8/Desktop/tokenAI/node_modules/web3-core-helpers/src/errors.js:29:16)
        at /home/ri-8/Desktop/tokenAI/node_modules/web3-core-requestmanager/src/index.js:137:36
        at XMLHttpRequest.request.onreadystatechange (/home/ri-8/Desktop/tokenAI/node_modules/web3-providers-http/src/index.js:77:13)
        at XMLHttpRequestEventTarget.dispatchEvent (/home/ri-8/Desktop/tokenAI/node_modules/xhr2/lib/xhr2.js:64:18)
        at XMLHttpRequest._setReadyState (/home/ri-8/Desktop/tokenAI/node_modules/xhr2/lib/xhr2.js:354:12)
        at XMLHttpRequest._onHttpResponseEnd (/home/ri-8/Desktop/tokenAI/node_modules/xhr2/lib/xhr2.js:509:12)
        at IncomingMessage.<anonymous> (/home/ri-8/Desktop/tokenAI/node_modules/xhr2/lib/xhr2.js:469:24)
        at emitNone (events.js:110:20)
        at IncomingMessage.emit (events.js:207:7)
        at endReadableNT (_stream_readable.js:1059:12)
        at _combinedTickCallback (internal/process/next_tick.js:138:11)
        at process._tickCallback (internal/process/next_tick.js:180:9)

Mar 28, 2018 in Blockchain by Shashank
• 10,400 points
3,782 views

1 answer to this question.

+2 votes
Best answer
The chain ID for ropsten is 3. The ID you've used(1337) is wrong. Try with chain ID 3 for the ropsten. It'd work
answered Mar 28, 2018 by Johnathon
• 9,090 points

selected Aug 3, 2018 by Omkar
Thanks! It worked!!
Hi, the error occurred to me also. But the difference is that I've already specified the correct chainID in my tx Object. Maybe you know what else could cause the very same error? Thank you.

Hey @Vlad! Are you running it on Ropsten network? If not, you will have to change the ChainID. Here is a list of ChainID for respective networks:

0: Olympic, Ethereum public pre-release testnet
1: Frontier, Homestead, Metropolis, the Ethereum public main network
1: Classic, the (un)forked public Ethereum Classic main network, chain ID 61
1: Expanse, an alternative Ethereum implementation, chain ID 2
2: Morden, the public Ethereum testnet, now Ethereum Classic testnet
3: Ropsten, the public cross-client Ethereum testnet
4: Rinkeby, the public Geth PoA testnet
8: Ubiq, the public Gubiq main network with flux difficulty chain ID 8
42: Kovan, the public Parity PoA testnet
77: Sokol, the public POA Network testnet
99: Core, the public POA Network main network
7762959: Musicoin, the music blockchain

If this is not the case, then please share your code so that we can have a look at it and see what went wrong. And also share your error log.

Thanks for response, @Omkar :) I'd like to move it to a separate discussion, don't want to post another question with code samples here in comments. Here's the link to my question: https://www.edureka.co/community/29870/invalid-sender-error-when-trying-to-send-signed-transaction

See you there

Did you find a solution for this? I am having same problem

Related Questions In Blockchain

0 votes
2 answers

How do I interact with a smart contract on a private network through web3.js

I found a blog that explains how ...READ MORE

answered Aug 20, 2018 in Blockchain by slayer
• 29,370 points
3,936 views
0 votes
1 answer
0 votes
1 answer
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,901 views
+1 vote
1 answer
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,424 views
0 votes
1 answer
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