My advice would be to use the Browser Solidity:
Just copy paste your contract, and if it compiles without errors you can just copy past the content of Web3 deploy:
var _numProposals = /* var of type uint8 here */ ;
var ballotContract = web3.eth.contract([{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"delegate","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"winningProposal","outputs":[{"name":"winningProposal","type":"uint8"}],"type":"function"},{"constant":false,"inputs":[{"name":"voter","type":"address"}],"name":"giveRightToVote","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"proposal","type":"uint8"}],"name":"vote","outputs":[],"type":"function"},{"inputs":[{"name":"_numProposals","type":"uint8"}],"type":"constructor"}]);
var ballot = ballotContract.new(
_numProposals,
{
from: web3.eth.accounts[0],
data: '60606040*deleted-for-lsibility-6',
gas: 3000000
}, function(e, contract){
console.log(e, contract);
if (typeof contract.address != 'undefined') {
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})
Don't forget that :
- It's javascript ( so address is string )
- You need to fill your params
var _numProposals = /* var of type uint8 here */ ;
here.
--
Another solution is Mix IDE :
Click on Deploy then click on Open Compilation Result and it will provide you with a JS file. Inside there are objects representing your contract. You would then need to call web3.eth.contract(Mycontract.abi)