Tenderly's Optimistic Rollup Network Report is live! 🎉 Explore how optimistic rollups help scale Ethereum ecosystem!

Smart Contracts

How DevNets Accelerate Local Smart Contract Development

DevNets accelerate smart contract development by providing a managed, zero-setup environment that integrates with local development frameworks such as Hardhat, Truffle, and Foundry.

Danilo Danicic
Danilo Danicic
May 9, 2023 · 4 min read

In this post

How DevNets Accelerate Local Smart Contract Development

Local development frameworks like Hardhat, Truffle, or Foundry have immensely simplified smart contract development. They give developers an environment and essential tools for easier building and testing of dapps.

But when it comes to deployment, speed bumps are inevitable. Lengthy transaction execution on public testnets, local node management, and waiting on faucets to acquire test ETH — all hindering productivity.

DevNets offer a streamlined, zero-setup development environment for smart contracts that smoothly integrates into your current workflow. This private and isolated development playground enables you to test smart contracts against production data, complete with indispensable debugging tools.

🚀
Sign in to Tenderly and spin up a DevNet in seconds. It's free, so why not give it a go?

Seamless integration with Hardhat, Truffle, and Foundry

DevNets supports all popular local development frameworks, including Hardhat, Foundry, Truffle, and Brownie. There's no need for additional setup or management. Tenderly handles everything in the background.

To show you how DevNets easily fit into your existing workflows, let's use Hardhat as an example. Integrating DevNets into your Hardhat project is as simple as tweaking your hardhat.config.js file.

First, you need to spin up a DevNets via the Tenderly Dashboard, copy the auto-generated RPC URL, and add it to your Hardhat configuration like so:

module.exports = {
  networks: {
    devnet: {
      url: "YOUR_DEVNET_JSON_RPC_URL",
      chainId: 1,
    }
  }
};

This simple change opens the door to Tenderly’s ecosystem of robust development and debugging tooling in your local development, along with access to production data from 30+ networks.

0:00
/

For a more streamlined approach, you can use the tenderly devnet spawn-rpc CLI command. This command will initiate a process that automatically spins up a DevNet and injects the URL into Hardhat.

💡
Get started with DevNets in your local development with this sample Hardhat project from our GitHub repo. It comes with a sample contract, a test for the contract, and a script that deploys the contract.

Execute transactions on production data without delays

DevNets provide a Mainnet-like testing environment that mirrors on-chain conditions. This ensures that your smart contracts behave as expected when deployed to the Mainnet, reducing the risk of unexpected issues arising in production.

You can build, test, and deploy on production data from over 30 networks supported by Tenderly. DevNets also give you complete control over the network state, allowing you to modify the headers, blocks, and other elements to fit your requirements.

0:00
/

Transaction execution on DevNets is instantaneous. Hosted on Tenderly’s lighting-fast infrastructure, DevNets process transactions in milliseconds and eliminate infrastructure management overhead from your pipeline.

When you spin up a DevNets, you automatically get 10 unlocked accounts, each preloaded with 100 test ETH to run any number of transactions. In case you run out, you can use our unlimited faucet to top up the balance to any amount of test ETH you need.

Or you can use custom RPC endpoints tenderly_setBalance and tenderly_addBalance to do so programmatically.

A list of all standard and custom RPC endpoints can be found in the documentation.

Access to Tenderly tooling in local development

In addition to robust development infrastructure, DevNets bring the power of the Tenderly tooling ecosystem to your local development.

You get access to our visual Debugger on top of the tools you get out-of-the-box with your preferred development framework. This means you are no longer limited to console logging as the primary debugging method.

With each DevNet environment, you get access to the following tools:

  • Private block explorer: View all transactions executed within the DevNet environment.
  • Visual Debugger: Get a human-readable representation of errors, function calls, execution traces, emitted events, and expressions directly from the Dashboard.
  • Gas Profiler: Understand how transactions consume compute resources with a detailed breakdown of gas usage by each function call.
  • Transaction Simulator: Re-run failed transactions by changing some or all parameters and observing the outcomes.
  • Collaboration features: Leave comments on problematic lines of code and get the entire team involved in troubleshooting.
  • RPC calls overview: See a detailed breakdown of all RPC calls made to the node within your DevNet to get a deeper understanding of how resources are consumed.
  • Unlimited faucet: Add as much test ETH as you need to any of the 10 unlocked accounts on your DevNet. Use the handy Tenderly Faucet or call our custom RPC methods to top up your accounts.

Why use DevNets in local dapp development?

DevNets bring privacy, flexibility, advanced tooling, and collaborative features to the table, each aspect tailored to optimize your development experience. Here's a closer look at the key benefits of using DevNets in local smart contract development.

1. Complete privacy and isolation

DevNets offer a secure and private environment for developing and testing smart contracts. This is crucial if you’re working on proprietary projects or handling sensitive data that should not be exposed on public networks. By using DevNets, you can ensure that your work remains private throughout the development process.

2. Independence from public testnets

DevNets allow for rapid testing and debugging of smart contracts without the latency of public testnets. Transactions on DevNets are executed blazingly fast, enabling you to test and iterate on smart contracts more efficiently. DevNets also eliminate the overhead of mining for test ETH by providing an easy way to add funds to accounts.

3. Access to Tenderly tooling

DevNets give you access to Tenderly's Debugger, Gas Profiler, Simulator, and other tools in local development. With these tools now available in local development, you can identify issues much faster and optimize your smart contracts for better performance based on data-driven insights.

4. Collaborative development

DevNets are also a collaborative environment where developers can work together, communicate, and exchange feedback directly in the Dashboard. Collaboration is key to eliminating silos and enabling distributed teams to work more efficiently when troubleshooting, something not before possible in local development.

Ready to spin up your first DevNet?

Tenderly DevNets offer a powerful solution to enhance local development and speed up your pipeline by smoothly integrating into your existing workflows.

To get started, log into your Dashboard, navigate to DevNets, and spin up your first completely private and isolated development environment on any of the 30+ supported networks.

If you have questions or need assistance with integrating DevNets, be sure to join our Discord channel or message our support team.