Skip to main content
added 893 characters in body
Source Link

I changed the script code slightly to have the console.log(Contract.methods.getName().call()); be an async call which looks like this:

async function getOutput(){ const contract_address = "0x6C1750bfDD9D1327AE8c5dBD1Af75dc73C138Fd7"; var Contract = new web3.eth.Contract(contract_abi, contract_address); console.log(await Contract.methods.getName().call()); } 

And now I am getting the following slightly more detailed but still very confusing error:

 var err = new Error('Returned error: ' + message); ^ Error: Returned error: VM Exception while processing transaction: revert at Object.ErrorResponse (/Users/user/node_modules/web3-core-helpers/lib/errors.js:28:19) at /Users/user/node_modules/web3-core-requestmanager/lib/index.js:302:36 at XMLHttpRequest.request.onreadystatechange (/Users/user/node_modules/web3-providers-http/lib/index.js:98:13) at XMLHttpRequestEventTarget.dispatchEvent (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22) at XMLHttpRequest._setReadyState (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14) at XMLHttpRequest._onHttpResponseEnd (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14) at IncomingMessage.<anonymous> (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) { data: { '0x014d2c7d3c399932858fd397142bafb110b513dd82ed746f0ad969961e42ce03': { error: 'revert', program_counter: 70, return: '0x' }, stack: 'c: VM Exception while processing transaction: revert\n' + ' at Function.c.fromResults (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:192416)\n' + ' at /usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:42:50402', name: 'c' } } 

I changed the script code slightly to have the console.log(Contract.methods.getName().call()); be an async call which looks like this:

async function getOutput(){ const contract_address = "0x6C1750bfDD9D1327AE8c5dBD1Af75dc73C138Fd7"; var Contract = new web3.eth.Contract(contract_abi, contract_address); console.log(await Contract.methods.getName().call()); } 

And now I am getting the following slightly more detailed but still very confusing error:

 var err = new Error('Returned error: ' + message); ^ Error: Returned error: VM Exception while processing transaction: revert at Object.ErrorResponse (/Users/user/node_modules/web3-core-helpers/lib/errors.js:28:19) at /Users/user/node_modules/web3-core-requestmanager/lib/index.js:302:36 at XMLHttpRequest.request.onreadystatechange (/Users/user/node_modules/web3-providers-http/lib/index.js:98:13) at XMLHttpRequestEventTarget.dispatchEvent (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22) at XMLHttpRequest._setReadyState (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14) at XMLHttpRequest._onHttpResponseEnd (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14) at IncomingMessage.<anonymous> (/Users/user/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) { data: { '0x014d2c7d3c399932858fd397142bafb110b513dd82ed746f0ad969961e42ce03': { error: 'revert', program_counter: 70, return: '0x' }, stack: 'c: VM Exception while processing transaction: revert\n' + ' at Function.c.fromResults (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:192416)\n' + ' at /usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:42:50402', name: 'c' } } 
added 893 characters in body
Source Link

EDIT:

I confirmed ganache is running on 8545 through the ganache output:

Gas Price ================== 20000000000 Gas Limit ================== 6721975 Call Gas Limit ================== 9007199254740991 Listening on 127.0.0.1:8545 

I also confirmed this through adding the following method that returned the correct block number.

async function getBlockNum(){ console.log(await web3.eth.getBlockNumber()); } 

Also I got the contract address from the truffle output contract address parameter. Is this the correct place to get a contract address?

 Deploying 'Migrations' ---------------------- > transaction hash: 0xd60debe1fa028b95152eb4b32853ba948b172624cdc4615e429cd44c908fa445 > Blocks: 0 Seconds: 0 > contract address: 0x6C1750bfDD9D1327AE8c5dBD1Af75dc73C138Fd7 > block number: 1 

EDIT:

I confirmed ganache is running on 8545 through the ganache output:

Gas Price ================== 20000000000 Gas Limit ================== 6721975 Call Gas Limit ================== 9007199254740991 Listening on 127.0.0.1:8545 

I also confirmed this through adding the following method that returned the correct block number.

async function getBlockNum(){ console.log(await web3.eth.getBlockNumber()); } 

Also I got the contract address from the truffle output contract address parameter. Is this the correct place to get a contract address?

 Deploying 'Migrations' ---------------------- > transaction hash: 0xd60debe1fa028b95152eb4b32853ba948b172624cdc4615e429cd44c908fa445 > Blocks: 0 Seconds: 0 > contract address: 0x6C1750bfDD9D1327AE8c5dBD1Af75dc73C138Fd7 > block number: 1 
edited tags
Link
Yilmaz
  • 51k
  • 19
  • 226
  • 278
Source Link
Loading