deBridge Hardhat plugin is now live!

Safely test your integration with deBridge in an emulated environment

4 min readSep 7, 2022


We’re pleased to announce the release of the deBridge Hardhat plugin, making it easy to fully test an integration with deBridge in a secure emulated environment. The plugin provides a full toolkit for testing and emulating dApps built with, or on top of, the deBridge protocol.

Given the complexity of the deBridge protocol itself and the number of different components involved in the integration flow, until now it has been a more comprehensive process to undergo development and sufficient unit testing when building cross-chain dApps on deBridge.

Our Hardhat plugin abstracts away all of this complexity, as a toolkit for facilitating a lightweight and effective emulation environment. By mirroring the behavior of the deBridge mainnet, the plugin gives developers the ability to validate any cross-chain interactions as follows:

  • Developing unit test cases for your contracts, or developing integration test cases to validate the behavior and the interaction between the contracts intended to reside on the different chains and communicate through the deBridgeGate: deBridge infrastructure emulator is a part of a runtime (runtime emulation);
  • Performing functional tests on the deBridge infrastructure emulator running as a local process.

By making it easier to facilitate an effective emulation environment, the Hardhat plugin streamlines the process of successful integration with deBridge.

How to get started

Hardhat-debridge is an NPM-packaged plugin, meaning it’s easy to hook it up to existing projects with just one command — as long as you’ve installed and configured Hardhat, no additional configuration is needed to get started.

The key concept behind the plugin is a loopback bridge. Here, the emulator deploys a single smart contract for accepting and receiving messages, so when the message is committed to the deBridgeGate contract in the local chain, it is broadcasted and executed back in the same local chain. This design makes it possible to use the battle-tested Hardhat network.

How can I use the deBridge Hardhat plugin?

The plugin offers two options/features to simplify the development of cross-chain dApps.

Writing automated unit tests

For writing unit tests to cover the cross-chain communication between your contracts from top to bottom — the plugin offers a set of handy functions that are useful in writing automated tests in Hardhat:

  1. deployGate() method deploys a fresh instance of the deBridgeGate smart contract and configures it so it reflects the local network peculiarities. The deployed contract behaves the same way as the one deployed on the public mainnet chains, as it is being deployed from the vanilla source code of the deBridge smart contracts, no tricks attached. It is intended to be used in before() and beforeEach() hooks — deploy as many contracts as you need, a fresh instance for every test case.
  2. autoClaim() method reads the messages that were sent to the local deBridgeGate contract, re-packs each and sends back to the same smart contract for execution, effectively emulating the cross-chain operations in just one call.

Emulating the deBridge protocol

The second major use case for the Hardhat plugin is emulating the entire deBridge infrastructure layer.

The plugin provides a ‘deBridge-run-emulator’ daemon script that, when started, attaches itself to the given network (e.g. the local node), deploys a fresh instance of the deBridgeGate smart contract and configures it to reflect the local network peculiarities, and starts capturing messages coming into it.

The deployed contract behaves precisely the same as one deployed on public mainnet chains. Whenever a new message is captured, it re-packs each and sends back to the same smart contract for execution, effectively emulating the cross-chain operations. It also prints the details of its operations to the console in a human-readable format. Thanks to this, the plugin enables you to:

  • Use additional tools with the plugin, for example deSDK: you can write automated tests where submissions (sent to the plugin’s deployment of the deBridgeGate contract) are handled by the deSDK explicitly.
  • Run local nodes forked from mainnet chains to provide access to mainnet-only features, e.g. live LPs, DEXes, etc.

Here’s a video of our Solidity Lead, Alexey Churkin, giving a technical overview of the Hardhat plugin:

Building for Web3 developers

We want to make it as secure and seamless as possible for projects and builders to start transferring value and messages across chains with deBridge. With that, it’s crucial to have development tools that will help facilitate this process. That’s why we’re so excited about the deBridge Hardhat plugin and the other tools we have published in the past like deSDK, deSwap API, and more.

We’re looking forward to hearing your input and feedback, and hope in general that the plugin helps streamline your build by providing a secure environment for testing. deBridge will continue to build out our secure interoperability layer for Web3 and make cross-chain development the best possible experience for Web3 builders.




Generic messaging and cross-chain interoperability protocol that enables decentralized transfers of data and assets between blockchains