0

I am using web3 to sign the following transaction and send it to a node using sendSignedTransaction. However I keep getting "invalid sender" error.

I have set the network id to 6454 in genesis.json and the node was started with the same network id. I have used the same for signing the transaction too.

{
"to": "0x609be532b4411da754c55295f9a067819d2b563c",
"value": "0xff",
"gas": "0x61a8",
"gasPrice": "0x1e8f1c10800",
"from": "0x55eb76b1d8ff63ffbe211913a7f91a17cb98063c",
"nonce": "0x0",
"chainId": 6454,
"data": ""

}

EDIT; Here is my genesis.json

{
"config": {
    "chainId": 6454,
    "homesteadBlock": 1,
    "eip150Block": 2,
    "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "eip155Block": 3,
    "eip158Block": 3,
    "byzantiumBlock": 4,
    "clique": {
    "period": 1,
    "epoch": 30000
    }
},
"nonce": "0x0",
"timestamp": "0x5b33af98",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000240ebbd4e36bce0071994d62c78319d028fb651bac65b46b5c6257bd7c790fa51eb54d9f68f559d20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x47b760",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
    "240ebbd4e36bce0071994d62c78319d028fb651b": {
    "balance": "0x500000000000000000000000000000000000000000000000000000000000000"
    },
    "ac65b46b5c6257bd7c790fa51eb54d9f68f559d2": {
    "balance": "0x500000000000000000000000000000000000000000000000000000000000000"
    }
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
0

The most probable error is that you used wrong chainId, or your private chain has not configured EIP155 block number. Set EIP155 block number to 1 to fix this. Also the wallet you are using to send the transaction must be EIP155 enabled.

Otherwise, you have to debug your signing process, because your question doesn't provide any detailed info to make a more certain guess.

From the sources:

// Make sure the transaction is signed properly
from, err := types.Sender(pool.signer, tx)
if err != nil {
    return ErrInvalidSender
}
  • I have edited my question to include the genesis.json file. As you can see, I have set config.eip155Block to 3. "Also the wallet you are using to send the transaction must be EIP155 enabled." How do I do that? I am using private key to sign the transaction and I use the networkId while signing. Is that okay? – Shahul Hameed Jul 18 '18 at 2:59
  • all I can say is that the transaction isn't signed properly, or in other words, geth can't derive the source address from your signature. do a getTransaction() and append the output to your question, maybe somebody will spot some error in your R,S,V fields – Nulik Jul 18 '18 at 13:14
  • btw, when you edit genesis.json you have to recreate the blockchain from block 0, because the genesis block is being read from the LevelDB database, not from genesis.json – Nulik Jul 18 '18 at 13:17
0

One more thing to check is if your POA node is using ssl, if so, please mention https based url while connecting the node. I had the same issue and was struggling with chain id for a long time. Then eventually check the node url was https instead of http and it worked like a charm

0

This looks like an issue with version 2.0.0 of ethereumjs-tx:

https://github.com/ethereumjs/ethereumjs-tx/issues/165 16

You will need to construct your transaction like below:

const tx = new Tx(txObject, {chain:'ropsten', hardfork: 'petersburg'})

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.