I was following this guide for compiling my contracts How To: Compile a Solidity Smart Contract Using Node.js but "solc.compile(input, 1)" is not working anymore. I have problems understanding how to fix this...
Asked
Active
Viewed 833 times
1 Answers
2
you need to see the new document. here
that article is too old.
var solc = require('solc')
var input = {
language: 'Solidity',
sources: {
'test.sol': {
content: 'contract C { function f() public { } }'
}
},
settings: {
outputSelection: {
'*': {
'*': [ '*' ]
}
}
}
}
var output = JSON.parse(solc.compile(JSON.stringify(input)))
// `output` here contains the JSON output as specified in the documentation
for (var contractName in output.contracts['test.sol']) {
console.log(contractName + ': ' + output.contracts['test.sol'][contractName].evm.bytecode.object)
}
alincode
- 21
- 1