I was able to create a rawTransaction and sign the transaction without issue with the code below.

var rawTransaction = {"from":myAddress, "gasPrice":web3.utils.toHex(yessir),"gasLimit":web3.utils.toHex(210000),"to":contractAddress,"value":"0x0","data":contract.methods.transfer(toAddress, amount).encodeABI(),"nonce":web3.utils.toHex(nonce_sir)} 
var transaction = new Tx(rawTransaction)

Unfortunately, when attempting to send the signed transaction with web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex')).on('receipt', console.log);

I end up getting the following error message.

(node:697) UnhandledPromiseRejectionWarning: Error: Returned error: invalid sender

I am not sure what the error is. I wrote the script a month and a half ago, and at the time, it did work very nicely. The code is supposed to transfer ERC-20 tokens from one wallet to another.

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.