I've deployed an ERC20 like this:

const fs = require("fs");
const Web3 = require('web3');
const testnet = 'http://localhost:8545';
const PrivateKeyProvider = require("truffle-privatekey-provider");
const privateKey = "privatekey";
const web3 = new Web3(new PrivateKeyProvider(privateKey, testnet));

I've created the json as:

solc TestToken.sol --combined-json abi,asm,ast,bin,bin-runtime,devdoc,interface,opcodes,srcmap,srcmap-runtime,userdoc > contracts.json
let source = fs.readFileSync("contracts.json");
let contracts = JSON.parse(source)["contracts"];

let contractInfo = contracts["TestToken.sol:TestToken"];
let abi = JSON.parse(contractInfo.abi);

let code = '0x' + contractInfo.bin;

let SampleContract = new web3.eth.Contract(abi);

console.log("Unlocking coinbase account");
const walletAddress = '0x123';
let password = "";
try {
    web3.eth.personal.unlockAccount(walletAddress, password);
} catch (e) {

    data: code,
    arguments: [] // no parameter on constructor
    from: 'walletAddress',
    gas: 1500000,
    gasPrice: '30000000000000'
}, function (error, transactionHash) {
    console.log(`error: ${error}`);
    console.log(`transactionHash: ${transactionHash}`);
    .on('error', function (error) {
        console.log(`error: ${error}`);
    .on('transactionHash', function (transactionHash) {
        console.log(`transactionHash: ${transactionHash}`);
    .on('receipt', function (receipt) {
        console.log(`receipt: ${receipt}`);
        console.log(`receipt.contractAddress: ${receipt.contractAddress}`);
    .then(function (newContractInstance) {
        console.log(`newContractInstance: ${newContractInstance}`);
        console.log(`newContractInstance.address: ${newContractInstance.address}`);

After that I try to get the balance for my wallet using that contract address and I get:

const contract = new web3.eth.Contract(minABI, tokenAddress);
    .then(value => show(address, token, value))

And I get:

Error: VM execution error.
Bad instruction 1c
    at Object._fireError 
  • Which network do you use to deploy? It seems to lack 1C opcode. – Ismael Aug 23 '19 at 16:33
  • I'm using Parity dev config, it works with ganache. – Rodolfo Aug 24 '19 at 2:45
  • 1
    Invalid opcode 0x1c means your chain is missing opcodes from constantinople/petersburg, see this ethereum.stackexchange.com/questions/69530/…. Parity should have a way to enable them, check their documentation. – Ismael Aug 24 '19 at 15:09

Browse other questions tagged or ask your own question.