Is there any command or utility to deploy contract from .sol file to test-net? I've seen there is JSON API, so I can write some code to implement this. But isn't it done already?
Thanx.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityTruffle Framework is the most popular tool that is available now to perform such a task. All you need is to copy your contract code into contracts
directory, add an entry into migration file and run:
truffle migrate
The procedure is explained in details here.
There are lots of tutorials and good docs available if you get lost.
I hope it helped
default
(eth.accounts[0]) account?
Jul 12, 2017 at 1:40
You can use node or geth to deploy a contract.
Node example:
npm install ethereum-js-testrpc web3
npm install solc
Run the test rpc server
node_modules/.bin/testrpc
Console
Web3 = require('web3')
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
code = fs.readFileSync('Voting.sol').toString()
solc = require('solc')
compiledCode = solc.compile(code)
abiDefinition = JSON.parse(compiledCode.contracts[':NameofYourClass'].interface)
Contract = web3.eth.contract(abiDefinition)
byteCode = compiledCode.contracts[':NameofYourClass'].bytecode
deployedContract = Contract.new(args,to,init,your,contract)
deployedContract.address