I am running HelloWorld contract.
pragma solidity ^0.4.2;
contract HelloWorld {
uint public balance;
function Helloworld(){
balance = 1000;
}
}
After truffle compile
and truffle migrate
command I ran below command in truffle console:
HelloWorld.balance.call()
Error:
TypeError: Cannot read property 'call' of undefined at evalmachine.:1:19 at ContextifyScript.Script.runInContext (vm.js:35:29) at Object.exports.runInContext (vm.js:67:17) at TruffleInterpreter.interpret (/usr/lib/node_modules/truffle/lib/repl.js:99:17) at bound (domain.js:280:14) at REPLServer.runBound [as eval] (domain.js:293:12) at REPLServer. (repl.js:545:10) at emitOne (events.js:96:13) at REPLServer.emit (events.js:188:7) at REPLServer.Interface._onLine (readline.js:239:10)
truffle(default)> HelloWorld.deployed()
Contract {
contract:
Contract {
_eth:
Eth {
_requestManager: [Object],
getBalance: [Object],
getStorageAt: [Object],
getCode: [Object],
getBlock: [Object],
getUncle: [Object],
getCompilers: [Object],
getBlockTransactionCount: [Object],
getBlockUncleCount: [Object],
getTransaction: [Object],
getTransactionFromBlock: [Object],
getTransactionReceipt: [Object],
getTransactionCount: [Object],
call: [Object],
estimateGas: [Object],
sendRawTransaction: [Object],
sendTransaction: [Object],
sign: [Object],
compile: [Object],
submitWork: [Object],
getWork: [Object],
coinbase: [Getter],
getCoinbase: [Object],
mining: [Getter],
getMining: [Object],
hashrate: [Getter],
getHashrate: [Object],
syncing: [Getter],
getSyncing: [Object],
gasPrice: [Getter],
getGasPrice: [Object],
accounts: [Getter],
getAccounts: [Object],
blockNumber: [Getter],
getBlockNumber: [Object],
iban: [Object],
sendIBANTransaction: [Function: bound transfer] },
transactionHash: null,
address: '0x83367f99f17e89248c32f4a323c027446246e650',
abi: [ [Object], [Object] ],
Helloworld:
{ [Function: bound ]
request: [Function: bound ],
call: [Function: bound ],
sendTransaction: [Function: bound ],
estimateGas: [Function: bound ],
getData: [Function: bound ],
'': [Circular] },
balance:
{ [Function: bound ]
request: [Function: bound ],
call: [Function: bound ],
sendTransaction: [Function: bound ],
estimateGas: [Function: bound ],
getData: [Function: bound ],
'': [Circular] },
allEvents: [Function: bound ] },
Helloworld:
{ [Function]
call: [Function],
sendTransaction: [Function],
request: [Function: bound ],
estimateGas: [Function] },
balance:
{ [Function]
call: [Function],
sendTransaction: [Function],
request: [Function: bound ],
estimateGas: [Function] },
allEvents: [Function: bound ],
address: '0x83367f99f17e89248c32f4a323c027446246e650',
transactionHash: null }