The blockchain ecosystem is growing rapidly, and with it, the need for tools that allow developers to simulate complex environments efficiently. Supersim is one such tool, designed to simulate the Superchain locally. However, in a development environment that involves multiple chains and specialized tools, installing and configuring dependencies can be a challenge. This is why I suggested dockerizing Supersim, aiming to offer a cleaner, more efficient, and conflict-free solution.
This article details the process followed to implement this improvement and why we decided to add Docker support to Supersim. If you're a developer looking to collaborate on open-source projects, you've come to the right place to learn and contribute!
During the development and testing of Supersim, one of the main challenges was managing dependencies. Supersim requires the installation of multiple tools, such as Go, Foundry, and Anvil, which can lead to potential version conflicts and configuration issues. This complexity led me to look for a solution that would allow developers to run Supersim without having to deal with local installations or complex setups.
Docker emerged as a natural solution. By encapsulating Supersim in a Docker container, we can guarantee a consistent development environment, independent of the user’s operating system configuration. This approach offers several advantages:
Consistent Environment: Docker ensures that all developers use the same versions of tools and dependencies, eliminating discrepancies between environments.
Ease of Use: With just a few commands, anyone can run Supersim without worrying about local installations or complex setups.
Security and Isolation: Docker isolates the application from the host operating system, minimizing risks and reducing the permissions needed on the system.
Below is the Dockerfile
developed for Supersim. This file defines the necessary steps to build a Docker image that encapsulates all required dependencies and tools.
FROM golang:1.22
RUN apt-get update && apt-get install -y curl git
WORKDIR /app
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="/root/.foundry/bin:${PATH}"
RUN foundryup
COPY . .
RUN go mod tidy
RUN go build -o supersim cmd/main.go
CMD ["./supersim"]
To facilitate the adoption of this new feature, we also updated Supersim's documentation by adding a section dedicated to running it with Docker. This way, any developer can start using Supersim in minutes without worrying about installing dependencies.
You can now run Supersim using Docker. This approach guarantees a consistent development environment without the need to install dependencies on your local machine. Here are the steps:
docker build -t supersim .
docker run --rm -it --network host supersim:latest
This process encapsulates Supersim in a container, isolating it from the host system. This ensures a clean, conflict-free environment and adds an extra layer of security by reducing the application’s permissions on the host system.
You can now explore the incredible possibilities of Supersim with ready-to-use examples!
This change in Supersim wouldn't have been possible without the collaborative spirit of the community, especially the Mode Network team - CriptoFede (CriptoFede on Twitter). This initiative was born from a small observation that identified the need to simplify the setup process. Based on that, we proposed the dockerization of Supersim, which now makes the work of many developers easier.
I invite you to contribute to open-source projects like Supersim. Every small improvement counts, and your contribution can make a big difference in the community. If you're interested in collaborating, check out the process I followed to make this contribution in this Pull Request: https://github.com/ethereum-optimism/supersim/pull/175, which is now approved and integrated into the main repository.
Also, don’t miss the latest updates from Mode Network and join our growing community!
Supersim Repository: https://github.com/ethereum-optimism/supersim
Mode Network Twitter: https://x.com/modenetwork
Wolfcito's Twitter: https://x.com/AKAwolfcito
Let’s build together!