I am working on truffle and running these codes to run an example:
truffle(development)> var hw
undefined
truffle(development)> HelloWorld.deployed().then(function(deployed){hw=deployed;});
undefined
truffle(development)> hw.SayHello.call()
I am getting the following error:
***Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:41484:16)
at C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:328866:36
at C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:324536:9
at XMLHttpRequest.request.onreadystatechange (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:327565:7)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176407:18)
at XMLHttpRequest._setReadyState (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176697:12)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176852:12)
at IncomingMessage.<anonymous> (C:\Users\dell\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176812:24)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7) ***
My code is as follows:
HelloWorld.sol
pragma solidity ^0.4.8;
contract HelloWorld {
function SayHello() public returns (string) {
return ("SomeHello");
}
}
2_deploy_contracts.js
var ConvertLib = artifacts.require("./ConvertLib.sol");
var MetaCoin = artifacts.require("./MetaCoin.sol");
var HelloWorld = artifacts.require("./HelloWorld.sol");
var second = artifacts.require("./second.sol");
module.exports = function(deployer) {
deployer.deploy(ConvertLib);
deployer.link(ConvertLib, MetaCoin);
deployer.deploy(MetaCoin);
deployer.deploy(HelloWorld);
deployer.deploy(second);
};
My truffle.js
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};
I am working on Ubuntu 14. How do I solve it?