I am using web3 verion 1 (beta) connected to a remote Parity node via websocket.

There is a deployed contract TestContract with a test function that emits a Tested event that simply echoes back msg.sender.

contract TestContract {
    event Tested(address sender);

    function test() {
      require(msg.sender != 0x0);

The following code

const contract = new web3.eth.Contract(testContactAbi, theAddress)
const gasNeeded = await contract.methods.test().estimateGas({ from: SENDER_ADDRESS })
console.log('gasNeeded', gasNeeded)

throws Transaction execution error

I am sure I have a connection to the node

const listening = await web3.eth.net.isListening()

listening is true

How would I debug this?


Worked out the issue. I'd forgotten to export the SENDER_ADDRESS from my constants.js file. Sigh. Now the address is not undefined it works. My bad.

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.