title: Why is it impossible to deploy a smart contract (to Mainnet) using Truffle?
body: <p><strong>Why is deploying to Mainnet using Truffle so difficult?</strong></p>
  <p>Here is a rundown of trying to deploy to Mainnet...</p>
  <ol>
  <li>Current Gasprice is 110 Wei. Therefore <code>110000000000 wei</code></li>
  </ol>
  <p>Let's plug that in..</p>
  <pre><code>mainnet: {
        provider: () =&gt;
          new HDWalletProvider({
            mnemonic: { phrase: process.env.MNEMONIC },
            providerOrUrl: process.env.RPC_URL_1_WSS,
          }),
        network_id: 1, 
        from: process.env.DEPLOYERS_ADDRESS,
        gasPrice: 110000000000, /*  GAS PRICE!! */
        confirmations: 2,
        timeoutBlocks: 200,
        skipDryRun: false, public nets )
      },
    },
  </code></pre>
  <ol start="2">
  <li>Let's get the gas cost estimate of deploying. This will be set in <code>gas</code> parameter of <code>truffle-config</code>.</li>
  </ol>
  <p><code>NODE_ENV=production truffle migrate --network mainnet --dry-run</code></p>
  <pre><code>Summary
  =======
  &gt; Total deployments:   2
  &gt; Final cost:          0.001403824 ETH
  </code></pre>
  <p>0.001403824 ETH is $2.04.<br />
  So that's probably wrong.</p>
  <p><strong>‼️FAIL‼️</strong></p>
  <hr />
  <ol start="3">
  <li>Second try. Ok the dry run wasn't useful for getting gas estimates. I'll leave <code>gas</code> blank and try to deploy with just <code>gasPrice</code>.</li>
  </ol>
  <p>Results in..
  <code>Message:  insufficient funds for gas * price + value</code>
  <strong>‼️FAIL‼️</strong></p>
  <ol start="4">
  <li>Ok, I'm since the <code>dry-run</code> didn't give a useful estimate for what the contract costs to deploy, I'll just guess based on other contracts. Going to add the <code>gas</code> parameter here.</li>
  </ol>
  <pre><code>mainnet: {
        provider: () =&gt;
          new HDWalletProvider({
            mnemonic: { phrase: process.env.MNEMONIC },
            providerOrUrl: process.env.RPC_URL_1_WSS,
          }),
        network_id: 1, 
        from: process.env.DEPLOYERS_ADDRESS,
        gasPrice: 110000000000, /*  GAS PRICE!! */
        gas: 140000000000000000, / That's about $200 in Wei/
        confirmations: 2,
        timeoutBlocks: 200,
        skipDryRun: false, public nets )
      },
    },
  </code></pre>
  <p><code>RuntimeError: abort(Error: Assertion failed). Build with -s ASSERTIONS=1 for more info.</code>.</p>
  <p><strong>‼️FAIL AGAIN‼️</strong></p>
  <hr />
  <ol start="4">
  <li>Third attempt. Ok, going to try to just leave <code>gas</code> and <code>gasPrice</code> blank..</li>
  </ol>
  <p><code>Block timesout in 750 seconds</code>.</p>
  <p><strong>‼️FAIL‼️</strong></p>
  <hr />
  <p>Trying on Remix..</p>
  <ol>
  <li>Set provider to Injected Web3</li>
  <li>Set network to Mainnet</li>
  <li>Deploy</li>
  <li>Cost $135</li>
  </ol>
  <p>This is great, but now I'm not using Truffle's migrations, and it isn't as easy to use Remix ABI with Truffle.</p>
  <p>I'm really really prefer Truffle to just work.</p>
  <p>Why is Truffle sooooo difficult to use when deploying to Mainnet? It is impossible to deploy to Mainnet.</p>