web3dev

Deploy Solidity/EVM contracts with Hardware wallets (Trezor, Ledger)

Deploy Solidity/EVM contracts with Hardware wallets (Trezor, Ledger)

When you have finished testing your contract on testnets and you are ready for mainnet deployments (Ethereum, Arbitrum, Optimism, Fantom, Polygon, etc), you probably want to use your hardware wallet for maximum security.

The most simple way to deploy a contract on an EVM network with your HW is to leverage the support for Injected Providers (e.g. Metamask) within the Remix Ethereum IDE.

Here follows a list of all the necessary steps to deploy your contract with Remix using Metamask as provider, that can be easily used with Trezor wallets:

  • Go to Remix IDE home or preload it with optimized settings (Optimization enabled for deployment, using solc v0.8.16)
  • In File Explorer section, create a new file under contracts folder (e.g. yourcontract.sol)
  • Copy-Paste your contract source and keep the file open in the editor
  • In Solidity Compiler section:
    • Check the compiler version you tested previously
    • In Advanced Configurations, check the Enable Optimization and enter 1 to optimize for gas required for contract deployment or an higher number if you want to optimize for function executions at the cost of a larger bytecode (see docs to know more)
    • Hit on Compile yourcontract.sol to trigger the bytecode generation
  • In Deploy & Run Transaction section:
    • Select Injected Provider - Metamask
    • Select the proper Account from which you want to deploy
    • Select your Contract (ignore dependent contracts listed here, they get automatically included in your contract)
    • Before Deploy, provide the necessary constructor parameters more easily by expanding that section if they are present
    • Once ready, hit on Deploy and confirm the TX will popup on Metamask

In a few moments you should receive the notification from Metamask that the transaction has been executed and so the contract created.

How do you rate this article?

31



web3dev
web3dev

Yet another Web3 developer blog

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.

Page not displaying correctly?