2

This question already has an answer here:

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...

marked as duplicate by Richard Horrocks, eth Apr 12 at 0:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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)
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.