project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5

ContractBridger

A tool for taking a (verified) contract that is already deployed on one chain, and automatically deploying it on another chain

ContractBridger

Created At

ETHOnline 2023

Project Description

Introducing our revolutionary Contract Bridger—a developer's dream tool that streamlines the process of deploying existing contracts from one blockchain to another, making the cumbersome and time-consuming tasks a thing of the past.

Imagine you're deep into a project, and you need a specific contract, like the Multicall contract, on your current blockchain. You're unsure if it's deployed there, and even if it is, hunting down the contract address becomes a daunting task. The traditional approach involves navigating GitHub for source code or copying it from another chain's explorer. Then, you embark on the arduous journey of setting up a development environment, pasting the code, compiling, and deploying—an ordeal that consumes precious time.

Now, enter our Contract Bridger, where this entire process is condensed into a seamless experience that takes less than a minute. Here's how:

Step 1: Copy and paste the address of the contract you desire, along with the chain it currently resides on.

Step 2: Visualize the contract, ensuring it's exactly what you need. A single click initiates the compilation process.

Step 3: Receive the bytecode and conveniently input any constructor arguments if required. Another click and you're ready to compile.

Step 4: Witness the deployment results instantly, complete with a transaction explorer link for a hassle-free review of your deployment.

With Contract Bridger, what used to take considerable time is now a rapid, efficient, and user-friendly process.

How it's Made

Technological Framework: At the heart of the project lies a Next.js app, weaving a seamless and responsive frontend experience. This is complemented by an Express server on the backend, providing the robust foundation for your application.

Core Technologies: The backend leverages the power of the Etherscan API and Solc (Solidity Compiler). This dynamic duo enables the fetching of smart contract source code and the programmatic compilation of the code into bytecode, forming the backbone of your application.

Project Inception: The initial week was a journey of exploration and planning. Delving into major explorer documentation, the team deciphered the intricacies of fetching smart contract code using an address. The subsequent challenge involved programmatic code compilation, where Solc emerged as a promising solution. A proof of concept (POC) validated its feasibility, ensuring the team embarked on a path they could conquer within the time constraints.

Development Workflow: The project kicked off with the initiation of a Next.js project, enriched with Rainbowkit and Wagmi for wallet connections, and Material-Tailwind prebuilt components for accelerated development.

Backend Architecture: The Express server was brought to life, housing two pivotal utility functions. The first utility pulls smart contract source code, while the second compiles the code into bytecode. These utilities find their purpose in two distinct routes:

pull-contract: Fetches contract details based on provided address and chain ID, utilizing the pullContractDetailFromSourceChain utility. compile-contract: Accepts smart contract source code, compiles it into bytecode, this byte code is returned to the frontend and is eventually deployed using Ethers.

Frontend Workflow: The user-friendly frontend journey begins with users providing the contract address and the chain where it currently resides. A request to the pull-contract route follows, bringing back the source code, elegantly formatted with React-Syntax-Highlighter for user verification. A click of the Copimpile button triggers a request to the compile-contract route, fetching bytecode and constructor argument fields. Users then select their destination chain, deploy, and witness the deployment results.

background image mobile

Join the mailing list

Get the latest news and updates