I’ve gone full circle from Remix > Hardhat > Foundry > Remix
I find that I enjoy coding most when I’m experimenting with ideas and proof of concepts within the Remix IDE at https://remix.ethereum.org
However for more serious projects I inevitably find myself moving out of creative mode and into testing mode in either Hardhat or Foundry and then using a text editor.
Remixd is a NodeJS application which runs on your PC and lets you connect Remix to a local filesystem. With its intuitive interface and powerful Solidity focused features, Remix provides a better developer experience than a text editor.
In this blog post, I’ll explore how to use Remixd to get the most out of your Solidity development environment.
- Remixd Video Demo
- How To Set Up Remixd
- Development Workflow
- Integrating Slither & Foundry
- Useful Plugins
Remixd Video Demo
How To Set Up Remixd
To set up remixd we first need to install nodejs from: https://nodejs.org/
Then open up a console in a new directory by right clicking in the folder and selecting “Open in Terminal” from the menu. Let’s first setup a package.json file and a basic hardhat project.
npm init npm install -s hardhat
From here I prefer to install remixd locally using:-
npm install -s remixd
We can then fire up the remix daemon using:-
npx remixd ./
“./” is the current directory that we want to share with the remix IDE. Now if we go to https://remix.ethereum.org
We can select localhost from the workspace menu which will connect to our local filesystem.
From here any saved changes will modify the data on your local device. You can use Remix to edit local files, compile and deploy them to EVM blockchains.
I’ve laid out an overly simplified workflow of working in Remix from start to finish using different tools along the way to assists with testing and deployment.
- Use remix online to mess around with ideas
- Once it becomes more than “just an experiment” set up a git repository
- Set up local packages and get hardhat running
- Connect remixd and use that to refactor the code
- Write unit tests for functions using Hardhat & Remix
- Use Slither to do some automated security checks
- Write system tests and fuzzing using Foundry in Remix
- Write a deployment script in Hardhat
- Roll it out to a testnet or test in production
- Verify contracts on Etherscan with the Remix plugin
There we go, ten steps to deploying your own smart contracts. I’ve gone over a similar thing before with timeframes and budgets for web3 projects.
Integrating Slither & Foundry
Slither is a Solidity static analysis framework written in Python. It is designed to help developers find vulnerabilities, enhance their code comprehension and quickly prototype custom analyses.
Slither runs a suite of common vulnerability detectors, prints visual information about contract details, and provides an API to easily write custom analyses.
Foundry is a tool suite for Solidity developers to test, fuzz, deploy and do lots of other on-chain things. There’s a full Foundry tutorial here.
Remixd does have a built in installer but I prefer to use Windows Sub-system for Linux (WSL). If you don’t have this installed google “How To Install WSL”, on a Mac you are probably fine in terminal.
Once in linux navigate to the directory and install solc, slither and foundry:
cd /mnt/c/tmp/myrepo sudo su apt install python3-pip add-apt-repository ppa:ethereum/ethereum apt update apt install solc pip3 install slither-analyzer curl -L https://foundry.paradigm.xyz | bash source /root/.bashrc foundryup
Then we can get the man page for these programs using:
There are a number of useful plugins which we can use on Remix with files hosted by Remixd.
A low level debugger where you can step through each stage of a failed transaction and check state variables to see where you messed up
Etherscan Contract Verifier
Add an etherscan API key and it will verify your contracts at the click of a button
One Click Dapp
Creates a really simple frontend for your contract with buttons for each function
Use the GIT plugin to manage changes to your code repository
Execute a transaction using remix and then analyse the broken down gas costs.
There is a bunch more to choose from on the plugin manager tab which can be activated by simply switching them on/off.
Remixd is a simple tool that brings the online IDE to your local work space. It can be used to enable remix as your default editor for Solidity code if you prefer working there to a text editor.
It’s a great innovation that makes a big difference to the capabilities of the tool. For developers remix offers a UI tailored around the needs of a blockchain developer with all the necessary tools and integrations needed in the workflow of creating smart contracts.