Deploy contract using solcjs

+1 vote

I'm trying to deploy a contract using solcjs following that tutorial blog post

here is my code

const web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545"));

async function compileAndDeploy() {
    let ambrosiaContract;
    try {
        let contract = await fs.readFileSync( path.join(__dirname, './Ambrosia.sol') );
        let Ambrosia = contract.toString();
        let input = {};
        input[ path.join(__dirname, './Ambrosia.sol')] = Ambrosia;

        console.log('> Compiling Storage');
        let output = solc.compile({sources: input}, 1);

        console.log(output.contracts, output.formal);
        ambrosiaContract = output.contracts['Ambrosia'];
    catch (e) {
    let ambrosiaInstance = await deployStorage(ambrosiaContract)
    console.log('...deployed at ' + ambrosiaInstance.address)


now when I actually run the script, the compiler send me back that error.

Error: Type "bytes32" not supported for state variable.\n mapping (address => bytes32) restaurants;\n

here is my contract code.

pragma solidity ^0.4.4;

contract Ambrosia {

    mapping (address => bytes32) restaurants;

    address _owner;

    event Transfer(address indexed _from, address indexed _to, uint256 _value); // listen to that event whenever a transfer has been made..

    event Order(address indexed _from, address indexed _to, uint256 _value); // listen to that event whenever an order is triggered

    function Ambrosia() {
        _owner = msg.sender;

I am using solcjs version 0.4.4 the error doesnt depend on the node client, it happen both with geth and js-eth on the development network

Sep 26, 2018 in Blockchain by digger
• 26,680 points

1 answer to this question.

0 votes

Try to add some typo and run this:

const output = solc.compile({sources: input}, 1);
answered Sep 26, 2018 by slayer
• 29,300 points

Related Questions In Blockchain

0 votes
1 answer

How do i deploy a contract using bigchainDB?

Currently BigchainDB v.1.0.0 does not support Smart ...READ MORE

answered Jun 29, 2018 in Blockchain by Shashank
• 10,400 points
0 votes
2 answers
0 votes
1 answer

How can I deploy a HelloWorld contract on my testrpc network?

The problem lies in the command: truffle migrate Your truffle migrate command ...READ MORE

answered Apr 27, 2018 in Blockchain by Perry
• 17,100 points

edited Aug 10, 2018 by Omkar 980 views
0 votes
1 answer

Can I swap an ERC-20 token with a Neo NEP5 token using a smart contract?

Every Blockchain has a separate administration. So, it ...READ MORE

answered Jun 4, 2018 in Blockchain by Perry
• 17,100 points
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,810 points
0 votes
1 answer
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 69,030 points
0 votes
1 answer

Error when trying to deploy Ethereum smart contract using web3j

Create a new credential based on the Credentials.create ...READ MORE

answered Oct 3, 2018 in Blockchain by slayer
• 29,300 points
0 votes
1 answer

How to access member functions of smart contract using web3?

I have implemented a similar feature and ...READ MORE

answered Aug 13, 2018 in Blockchain by slayer
• 29,300 points