1

All that the docs have to say about it is that it "lets the Ethereum network know we're not intending to persist any changes." So I get that it's used when not conducting a transaction.

So, I decided to test this:

truffle(development)> gc.then(function(instance){return instance.returnGreeting.call()})
'Hello, Joe'
truffle(development)> gc.then(function(instance){return instance.changeGreeting.call('threes a charm')})
[]

I thought it needed gas in the latter, so I tried but respectively got

truffle(development)> gc.then(function(instance){return instance.call.gas(10000)(bytes4(sha3("changeGreeting(string)")),'threes a charm')})
TypeError: Cannot read property 'gas' of undefined

But then I noticed that the following methods returned the same value, with no apparent difference.

truffle(development)> gc.then(function(instance){return instance.returnGreeting()})
'testing444'
truffle(development)> gc.then(function(instance){return instance.returnGreeting.call()})
'testing444'

To me, it's as useful as adding the keyword public to functions or fields: It only has semantic value. Where's the utility behind it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.