Compile smart contract in the console browser

w_n1c01a5w_n1c01a5 Member Posts: 1
I will compile the smart contract in the console browser with metamask and web3js.

I use metamask with chrome. In console browser when I run this code
var source = "" + 
    "contract test {\n" +
    "   function multiply(uint a) returns(uint d) {\n" +
    "       return a * 7;\n" +
    "   }\n" +
    "}\n";
var compiled = web3.eth.compile.solidity(source, function(err,res){
  console.log(err);
  console.log(res);
})
I have this error : Error: Error while compiling code.(…)

Is it a way to compile and deploy a smart contract directly in the the console browser ?

Comments

  • maartenmaarten Member Posts: 6
    Hello,

    The console browser/compiler is meant for compiling your smart contract. You can just paste in your solidity code and it will compile.

    There is no need to call web3.eth.compile.solidity from your code.

    Just paste the contract code and press the create button...
Sign In or Register to comment.