I'm trying to obtain estimate gas for an erc20 token contract deployed over kovan network, just like this:
var getCode = web3.eth.getCode(tokenAddress)
var transactionObject = {
from: address,
to: tokenAddress,
value: web3.utils.toWei(data.value.toString()),
data: getCode
}
web3.eth.estimateGas(transactionObject)
The response:
Unhandled rejection Error: Returned error: Transaction execution error. at Object.ErrorResponse (/Users/rstorm/repos/audity/checkBalances/node_modules/web3/packages/web3-core-helpers/src/errors.js:29:16) at /Users/rstorm/repos/audity/checkBalances/node_modules/web3/packages/web3-core-requestmanager/src/index.js:137:36 at XMLHttpRequest.request.onreadystatechange (/Users/rstorm/repos/audity/checkBalances/node_modules/web3/packages/web3-providers-http/src/index.js:64:13) at XMLHttpRequestEventTarget.dispatchEvent (/Users/rstorm/repos/audity/checkBalances/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:64:18) at XMLHttpRequest._setReadyState (/Users/rstorm/repos/audity/checkBalances/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:354:12) at XMLHttpRequest._onHttpResponseEnd (/Users/rstorm/repos/audity/checkBalances/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:509:12) at IncomingMessage.<anonymous> (/Users/rstorm/repos/audity/checkBalances/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:469:24) at emitNone (events.js:110:20) at IncomingMessage.emit (events.js:207:7) at endReadableNT (_stream_readable.js:1059:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickDomainCallback (internal/process/next_tick.js:218:9)