For example:

enum Stages {

Stages public stage = Stages.AcceptingBookings;
function rand ( uint256 param) atStage(Stages.AcceptingBookings) returns (uint256){}

In the above, when the contract is in state 'Stages.AcceptingBookings' only code within that function will run, pretty cool..

I just need to be able to access it via web3.eth though and I cant see clear explanation. If anyone knows please let me know I want to check what stage I am at from web3.eth if it is possible.

The above code is from the Solidity docs on State Machine: https://solidity.readthedocs.org/en/latest/common-patterns.html#state-machine

Works great from geth, just trying to work out the syntax for web3.eth

  • I see various uses of web.eth and web3.eth, can you please make them all the same thing if that's what you meant?
    – linagee
    Commented Feb 10, 2016 at 21:51
  • please fix the title to more generic, e.g. "How do I access member variables of a contract from web3"
    – Paul S
    Commented Feb 10, 2016 at 23:26

1 Answer 1


public members of Solidity contracts have an automatic getter method created, it would look something like this:


For general API on contract methods see See Calling Contract Methods Docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.