Assertion Error during compiling Solidity

I'm new to Solidity and as any new programmer stuck with error while compiling, so here is my code

pragma solidity ^0.4.17;
contract Inbox {
    string public msg;

    function Inbox(string initialMsg) public {
        msg = initialMsg;
    }

    function setMsg(string newMsg) public {
        msg = newMsg;
    }
}

here is compile.js file looks like

const path = require('path')
const fs = require('fs')
const solc = require('solc')

const inboxPath = path.resolve(__dirname, 'contracts', 'Inbox.sol')
const source = fs.readFileSync(inboxPath, 'utf8')
console.log(solc.compile(source, 1))

file structure

error message

Hope someone also stuck with this problem and found a solution. Thank you before hand)))


Ответы (1 шт):

Автор решения: Mad Jackal

"msg" зарезервированное слово Solidity. Попробуйте изменить его на "my_msg" например.

→ Ссылка