How to compile contracts in node.js

chrisethchriseth Member Posts: 170 ✭✭✭
edited September 2015 in Solidity
Just download and use the following snippet to compile your contracts:
var soljson = require('./soljson.js');
var compileJSON = soljson.cwrap("compileJSON", "string", ["string", "number"]);
var input = "contract x { function g() {} }";
var output = JSON.parse(compileJSON(input, 1)); // 1 activates the optimiser
for (var contractName in output.contracts)
	console.log(contractName + ': ' + output.contracts[contractName].bytecode);
Output also contains a lot of additional information.
Post edited by GeorgeHallam on


Sign In or Register to comment.