Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Failed to deploy contracts to ethermint with truffle and @truffle/hdwallet-provider. #665

Closed
AaronZgl opened this issue Dec 17, 2020 · 1 comment
Labels
stale stale PRs that will be closed if no further action occurs

Comments

@AaronZgl
Copy link

AaronZgl commented Dec 17, 2020

System info: [Include Ethermint commit, operating system name, and other relevant details]
MacSO 11.0.1
Ethermint commit : c15ba53
Truffle v5.1.51
@truffle/hdwallet-provider@1.2.0

Steps to reproduce:

  1. start node with init.sh
    ./init.sh

  2. run the REST server and JSON-RPC
    ethermintcli rest-server --laddr "tcp://localhost:8545" --unlock-key mykey --chain-id ethermint-1 --trace

  3. Edit contract with truffle

$ mkdir counter && cd counter
$ truffle init
$ cd contracts
$ vim Counter.sol
$ vim migrations/2_deploy_counter.js
$ npm init
$ npm install --save-dev @truffle/hdwallet-provider
$ vim truffle-config.js
  1. deploy contract
    truffle migrate --reset --network development

Expected behavior: [What you expected to happen]
Contract should be deployed to ethermint network successfully.

Actual behavior: [What actually happened]
Contracts can not be successfully deployed to ethermint network.
There is the error:
截屏2020-12-17 下午5 49 40

But the contracts can be successfully deployed to ganache-cli network with same steps.

截屏2020-12-17 下午5 31 03

截屏2020-12-17 下午5 31 11

Additional info: [Include gist of relevant config, logs, etc.]

截屏2020-12-17 下午5 55 33

there is the code of Counter.sol:

pragma solidity ^0.5.11;

contract Counter {
  uint256 counter = 0;

  function add() public {
    counter++;
  }

  function subtract() public {
    counter--;
  }

  function getCounter() public view returns (uint256) {
    return counter;
  }
}

there is the code of 2_deploy_counter.js:

const Counter = artifacts.require("Counter");

module.exports = function (deployer) {
  deployer.deploy(Counter);
};

There is the code of truffle-config.js:

const HDWalletProvider = require('@truffle/hdwallet-provider');
const ethermint_mnemonic = "the mnemonic is generated when the ethermint node starts";

module.exports = {
  
  networks: {
    
    development: {
      provider: () => new HDWalletProvider(ethermint_mnemonic, `http://127.0.0.1:8545`),
      network_id: "*",       // Any network (default: none)
      gas: 5000000,          // Gas sent with each transaction
      gasPrice: 1000000000,  // 1 gwei (in wei)
    },
    
  },
  compilers: {
    solc: {
      version: "0.5.17",    // Fetch exact version from solc-bin (default: truffle's version)
    },
  },
};
@AaronZgl AaronZgl changed the title Failed to deploy contracts to ethermint with truffle. Failed to deploy contracts to ethermint with truffle and @truffle/hdwallet-provider. Dec 17, 2020
@github-actions
Copy link

github-actions bot commented Feb 1, 2021

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale stale PRs that will be closed if no further action occurs label Feb 1, 2021
@github-actions github-actions bot closed this as completed Feb 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale stale PRs that will be closed if no further action occurs
Projects
None yet
Development

No branches or pull requests

1 participant