2

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

Lomo
  • 103
  • 1
  • 7
  • 1
    See https://stackoverflow.com/questions/53604799/solidity-v0-5-0-compiler-error-invalid-callback-specified/53620065#53620065. – user19510 Dec 21 '18 at 16:56

1 Answers1

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