'failed to deploy solana smart contract (solang compiler)

I run:

  • Solana-keygen new --force
  • solana airdrop 5
  • I have a solidity smart contract that looks like this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

contract ERC20 {
    
    uint public x = 0;

    constructor() {
        x = 30;
    }
}

and I run solang ERC20.sol --target solana --output build to compile it for solana from solidity.

As the last step, I am trying to deploy the program:

solana program deploy build/bundle.so

Problem:

Error: Deploying program failed: Error processing Instruction 1: invalid account data for instruction

Here is the transaction: Link



Solution 1:[1]

Unfortunately you can't use the solana command line tool to deploy a solidity contract. You can use javascript for now: https://solang.readthedocs.io/en/latest/targets.html#solana

We are considering options for making it easier to use from the command line, but that's in the in planning phase.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sean Young