Ethereum nodejs: Unhandled rejection Error: Invalid JSON RPC response

0 votes

Is there something wrong with my command?

contract.methods.thu().send(
   { from: senderAddress, 
     gasPrice: web3.utils.toHex(GAS_PRICE), 
     gasLimit: web3.utils.toHex(GAS_LIMIT)
   }
);

When I execute it, I get this error:

Unhandled rejection Error: Invalid JSON RPC response: ""

Need to help

Oct 15, 2018 in Blockchain by digger
• 27,640 points
372 views

1 answer to this question.

0 votes

gasLimit is actually represented by gas as the gas limiter according to the docs: http://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-send

contract.methods.thu().send(
   { from: senderAddress, 
     gasPrice: web3.utils.toHex(GAS_PRICE), 
     gas: web3.utils.toHex(GAS_LIMIT)
   }
)

Also, it's probably best to use the parameter types of gasPrice (String) and gas (Number) from the docs.

answered Oct 15, 2018 by Omkar
• 67,380 points

Related Questions In Blockchain

0 votes
1 answer

Ethereum client-go RPC response 403 “invalid host specified”

Adding --rpcvhosts=* should solve the issue READ MORE

answered Oct 1, 2018 in Blockchain by slayer
• 29,050 points
61 views
0 votes
1 answer

NodeJS POST Request Over JSON-RPC

You're missing the --header option: curl --request POST \ ...READ MORE

answered Sep 28, 2018 in Blockchain by digger
• 27,640 points
430 views
0 votes
1 answer

Error connecting due to rpc error

In the previous version, this problem was ...READ MORE

answered Jul 6, 2018 in Blockchain by slayer
• 29,050 points
164 views
0 votes
1 answer

How to transact custom token instead of ethers using JSON rpc?

First create your custom token. Then develop ...READ MORE

answered Jul 10, 2018 in Blockchain by digger
• 27,640 points
35 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
138 views
0 votes
1 answer
0 votes
1 answer

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

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
75 views
0 votes
1 answer

UnhandledPromiseRejectionWarning: Insufficient funds error in Ethereum: NodeJS web3

sendSignedTransaction returns a promiEvent onto which you can chain then and catch: web3.eth.sendSignedTransaction('0x' + ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 67,380 points
174 views