Q1: Is there any other way of passing value in a constructor function without using web3js object.

Q2: And in the below code whenever this contract is called will that be recompiled or wil just the value be updated?

  pragma solidity ^ 0.4.8 ; 

  contract lastPrice {
     uint price ; 
     uint lprice ;

     function lastPrice (uint _price) {
        lprice = (_price * 1 ether);

     function showPrice () constant returns (uint) {
        return lprice ;

1 Answer 1


Q1: Yes. You can form the transaction data in a "raw" way and send it from the geth javascript console, and you can deploy the contract from another contract and pass the value in.

Q2: No. Constructors only fire one time on deployment can never be invoked again. Also, contracts can't be amended. Any recompile would, in fact, be another contract. Change the name to something else, e.g. setPrice() to call it multiple times.

Hope it helps.

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.