Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendRawTransaction returns "Invalid JSON RPC Response" #1517

Closed
Slals opened this issue Apr 2, 2018 · 2 comments
Closed

sendRawTransaction returns "Invalid JSON RPC Response" #1517

Slals opened this issue Apr 2, 2018 · 2 comments
Assignees
Labels
Bug Addressing a bug
Projects

Comments

@Slals
Copy link

Slals commented Apr 2, 2018

Hi,

I want to sign a raw transaction using an account which is not an account registered by the provider (I use Ganache), but when I send it using web3.eth.sendRawTransaction I get the following error message :

Error: Invalid JSON RPC response: {"id":15,"jsonrpc":"2.0"}

However, when I send a raw transaction signed with an address which is an account listed in Ganache it works. Is it mandatory that the account used to sign the transaction is known to the provider?

account.signTransaction({ to: ENV.contract_address, data: data, gas: '80000', chainId: 1 }, function(err, res) {
        web3.eth.sendSignedTransaction(res.rawTransaction, function(sendErr, sendRes) {
          // When the account used to sign is known to the provider it works
          // When the account used to sign is not known it raises the error
        });
      });

Using Truffle Console (raw transaction signed by an account not listed in the provider)

web3.eth.sendRawTransaction("0xf889808504a817c8008301388094345ca3e014aaf5dca488057592ee47305d9b3e1080a4d5d44d80000000000000000000000000dbe1c28e41dcc894a3af2262181d57afac9d45e425a0c1e5800040e508fcdcf3230936c868002983c4d1e339125b831c8829ea2206e8a04c334096606e091bcf3de7a8bebabf0fc98a11db3eba94a0f054f10c935ab9ac", function(err, res) { console.log(err); });
undefined
truffle(testrpc)> Error: Invalid JSON RPC response: {"id":15,"jsonrpc":"2.0"}
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)

Thanks for the help, I might have missed a point about providers and accounts.

Note that the error could be raised by the smart contract which uses a require, the point is that I have no issue when the account is one that the provider know.


Web3 version : 0.20.4

@thinhlvv
Copy link

Got the same problem. Tried to upgrade web3 version to 1.0.0-beta.34 but it's still there.

@26000
Copy link

26000 commented Aug 7, 2018

Same. It's probably related to #1793signTransaction works incorrectly.

@nivida nivida self-assigned this Aug 9, 2018
@nivida nivida added the Bug Addressing a bug label Aug 9, 2018
@nivida nivida added this to In progress in 1.0 Nov 28, 2018
@nivida nivida moved this from In progress to To do in 1.0 Nov 28, 2018
@nivida nivida mentioned this issue Mar 26, 2019
12 tasks
@nivida nivida closed this as completed Mar 27, 2019
1.0 automation moved this from To do to Done Mar 27, 2019
@nivida nivida mentioned this issue Mar 28, 2019
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
No open projects
1.0
  
Done
Development

No branches or pull requests

4 participants