I've been struggling for the past couple of days with this. I Can't use object "compiles" in var compiled = web3.eth.compile.solidity(source);
Here is my code in a JS file :
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545"));
var source = 'contract demo {string public name = "Petros"; function changeName(string _newName){name = _newName; } }';
var compiled = web3.eth.compile.solidity(source);
var abi = compiled.info.abiDefinition;
But i get this error Uncaught TypeError: Cannot read property 'info' of undefined
If I output compiled to console console.log(JSON.stringify(compiled));
I get the following:
{"<stdin>:demo":{"code":"0x60a0604052600660608190527f506574726f730000000000000000000000000000000000000000000000000000608090815261003e916000919061004c565b50341561004757fe5b6100ec565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061008d57805160ff19168380011785556100ba565b828001600101855582156100ba579182015b828111156100ba57825182559160200191906001019061009f565b5b506100c79291506100cb565b5090565b6100e991905b808211156100c757600081556001016100d1565b5090565b90565b610286806100fb6000396000f300606060405263ffffffff60e060020a60003504166306fdde03811461002c5780635353a2d8146100bc575bfe5b341561003457fe5b61003c610114565b604080516020808252835181830152835191928392908301918501908083838215610082575b80518252602083111561008257601f199092019160209182019101610062565b505050905090810190601f1680156100ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156100c457fe5b610112600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509496506101a295505050505050565b005b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561019a5780601f1061016f5761010080835404028352916020019161019a565b820191906000526020600020905b81548152906001019060200180831161017d57829003601f168201915b505050505081565b80516101b59060009060208401906101ba565b505b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101fb57805160ff1916838001178555610228565b82800160010185558215610228579182015b8281111561022857825182559160200191906001019061020d565b5b50610235929150610239565b5090565b61025791905b80821115610235576000815560010161023f565b5090565b905600a165627a7a72305820bf5305296c7d741d380b06689600e0514b406331cdf8ce41a58344cb7c00ff690029",
"info":{"source":"contract demo {string public name = \"Petros\"; function changeName(string _newName){name = _newName; } }",
"language":"Solidity","languageVersion":"0.4.9","compilerVersion":"0.4.9",
"compilerOptions":"--combined-json bin,abi,userdoc,devdoc --add-std --optimize",
"abiDefinition":[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newName","type":"string"}],"name":"changeName","outputs":[],"payable":false,"type":"function"}],
"userDoc":{"methods":{}},"developerDoc":{"methods":{}}}}}
I am using meteor version 1.4.2.5, Geth version: Geth/v1.5.8-stable-f58fb322/linux/go1.7.3
, Solc Version: 0.4.9+commit.364da425.Linux.g++, OS: Linux mint
I run my geth node with this command: geth --rpc --rpcaddr="localhost" --rpcport="8545" --rpccorsdomain="http://localhost:3000" --testnet