Set up Remix IDE for Solidity development

Fred ,  

Remix IDE is a “batteries-included” Ethereum development environment. Hosted and funded by the Ethereum foundation.

It works well, connects to Metamask, and is easy to set up. At the time of writing, apart from some minor UI quirks, both the Web and Desktop versions had a pretty solid overall dev experience.

Documentation: https://remix-ide.readthedocs.io/en/latest/

Deploy with Metamask and the Web IDE

  1. Click Deploy & Run Transactions
  2. Select environment: Injected Web3
  3. Connect the IDE to your MetaMask.

Remix IDE gas warning

Gas requirements of function printInfo is infinite: If the gas requirements of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage.

The compiler warns because you are executing on the Javascript virtual blockchain. Change the environment to a test net to calculate more accurate gas consumption.

Install plugins

Some useful plugins for Solidity development:

  • Solidity Static Analysis
  • Solidity Unit Testing
  • Wallet Connect

You can activate these plugins from the plugin manager.

Load examples from Github

In the Home tab, you’ll find a button to load files from Github repos. Check out the kbsb birth certificate examples.

Note: You can open the Home tab by clicking on the Remix logo.

Saving your work

So long as you don’t delete your browser history, you can return to your project. The files you create are saved in the browser cache. You can also connect to Github for storage or store files on your local file system. Last option, you can always download the files you’ve created to your computer. And restore them when you want to continue working.

Connect to localhost

With the NPM package remixd, you can connect the web IDE to a daemon running on localhost. The web IDE needs the remixd plugin from the plugin manager. The plugin is active by default.

https://remix-ide.readthedocs.io/en/latest/remixd.html

# add Node package to project
# with NPM
npm install @remix-project/remixd
npm install -g @remix-project/remixd # global

# with PNPM
pnpm add @remix-project/remixd --save-dev
pnpm add @remix-project/remixd --global

remixd -s <absolute-path> --remix-ide https://remix.ethereum.org

Some limitations at the time of writing:

  • Creating a new file from within Remix IDE did not work.
  • If a folder does not contain any files, the folder is not displayed in the explorer.
  • Symbolic links are not followed.

The desktop version

You can download an electron version of the IDE from Github.

  • It also needs the remixd NPM package.
  • You can connect to local Git repo’s

One difference and benefit of the browser IDE is that it talks directly to the Metamask browser plugin. However, with the Wallet Connect plugin and a (free) Infura.io account you can connect Metamask or other wallets.

Create an Infura account

  • Create an account on the website
  • Create a new project. Goerli is on the Web3/Ethereum key.
  • You can select it in the Network endpoints widget
  • The API key is the same for every network

Connect MetaMask with the WalletConnect QR

  • Export your Goerli account’s private key from MetaMask.
  • Import the key on your Phone.
  • Activate WalletConnect from the Remix plugin manager.
  • Enter Your Infura.io project ID (API key)
  • Scan the WalletConnect QR code from Remix.

Note: In the mobile app, if you don’t see the Goerli Ethers make sure you set the network to Goerli. Select the network at the top of the screen.

Keep the WalletConnect tab in the Remix IDE open so that the IDE and Metamask stay connected. Select WalletConnect in the Deploy and Run Transactions tab.

Comments

Coming soon: "post your comment with support for markdown".

Name Email Reply