Skip to content

Using Tenderly on Moonbeam

Introduction

Tenderly is a Web3 development platform that contains a suite of tools designed to help developers throughout the DApp development life cycle. With Tenderly, you can build, debug, test, optimize, monitor, set up alerts, and view analytics for your smart contracts on Moonbeam and Moonriver.

The Tenderly platform provides the following features:

  • Contract Verification - as it is essential to verify your smart contracts to take full advantage of all of Tenderly's features, Tenderly provides several methods of verification. You can verify smart contracts through the Tenderly dashboard, the Tenderly CLI and Foundry, or the Tenderly Hardhat plugin

  • Debugger - use the visual debugger to inspect transactions and get better insight into the behavior of your code. With the debugger, you can review a transaction's stack trace, view the calls made in a transaction, step through a contract, and review decoded inputs, outputs, and state variables. You can use the debugger on the Tenderly dashboard or the Tenderly Debugger Chrome Extension

  • Gas Profiler - view how much gas you're spending on a granular level, so you can optimize your smart contracts and reduce transaction gas costs

  • Simulator - simulate transactions in a TestNet development environment to learn how your transactions will behave without having to send them on-chain. This way, you can know the transaction's outcome and ensure it works as expected before sending it to the network. You can experiment with different parameters, simulate historical and current transactions, and edit the contract source code. You can access the simulator from the Tenderly dashboard, or you can use the Tenderly Simulation API to take advantage of the simulator programmatically

  • Virtual TestNets - simulate the live Moonbeam network in an isolated environment to interact with deployed contracts and real-time on-chain data. These test environments enable controlled development, testing, and debugging across smart contracts, UI, backend, and data indexing. They support sequential transaction simulations for complex scenarios. There are some limitations to be aware of when using this feature. Moonbeam precompiled contracts are not supported, as they are part of the Substrate implementation and cannot be replicated in the simulated EVM environment, prohibiting you from interacting with cross-chain assets, staking, and governance.

  • Alerting - configure real-time alerts to notify you whenever a specific event occurs, allowing you to stay informed about what's going on with your smart contracts

  • Web3 Actions - create programmable functions in JavaScript or TypeScript that are executed automatically by Tenderly when a specific smart contract or chain event occurs

  • Sandbox - write, compile, execute, and debug your smart contracts directly in your browser with baked-in JavaScript and Solidity editors. Every time you run your code, Tenderly creates a temporary fork that comes with 10 pre-funded accounts, each with 100 tokens for testing purposes

Note

Tenderly supports Moonbeam, Moonriver, and Moonbase Alpha, except for the Web3 Gateway. For more information, check out Tenderly's documentation on Supported Networks.

Getting Started

The Tenderly dashboard provides access to the all-in-one Web3 development platform. To get started with the dashboard, you'll need to sign up for an account. Once you've signed up, you'll be able to start exploring your Tenderly dashboard.

Tenderly dashboard

If you prefer not to set up an account, you can also access limited features using Tenderly's explorer. Without an account, you can still gain insights into contracts and transactions. However, you won't be able to simulate transactions or create Virtual TestNets.

To interact with Tenderly's features programmatically, you can check out the Tenderly CLI GitHub repository for more information.

The following sections will show you how to get started with Tenderly on Moonbeam. For more detailed documentation, please refer to Tenderly's documentation site.

Create a Sandbox

To deploy contracts to Moonbeam with a Tenderly Sandbox, you can navigate to sandbox.tenderly.co and take the following steps:

  1. Enter your smart contract into the Solidity editor on the left-hand side
  2. Click Configure to select Moonbeam, Moonriver, or Moonbase Alpha as the network to deploy to
  3. Update the JavaScript editor on the right. The Sandbox includes Ethers.js and Web3.js, accessible via ethers and web3. It also provides global variables, so you don’t need to update the RPC URL for Moonbeam
  4. Click on RUN when you're ready to compile your contract and execute your code

If your code contained logic to deploy your contract or send a transaction, you'll see the transaction(s) appear under the Simulated Transactions section on the bottom left-hand side.

Tenderly Sandbox

Add a Contract

A good place to start with the Tenderly dashboard is to add a deployed smart contract. Once you've added a contract, you'll be able to create transaction simulations and Virtual TestNets, use the debugger, set up monitoring and alerts, and more.

To add a new contract, you can click on Contracts on the left-side panel and click Add Contract. A pop-up will appear, and you can take the following steps:

  1. Enter the contract address
  2. (Optional) You can give your contract a name
  3. Choose Moonbeam, Moonriver, or Moonbase Alpha as the network, depending on which network you've deployed your smart contract to
  4. (Optional) Toggle the Add more slider to add additional contracts after the initial one
  5. Finally, to add the contract to the dashboard, click Save

Add a contract

After a contract has been added, it will appear in the list of contracts on the Contracts dashboard. If the contract hasn't been verified yet, the dashboard will display an Unverified status along with a Verify button.

Contract in list of contracts

To take full advantage of the Tenderly tool set, it is recommended that you verify your smart contracts, which you can do by clicking on Verify. You can choose to verify your contract by uploading the contract's JSON, ABI, or source code. For more information, please refer to Tenderly's documentation on Smart Contract Verification.

Create a Virtual TestNet

Tenderly's Virtual TestNets feature simulates the live Moonbeam network in an isolated environment, which enables you to interact with deployed contracts and live on-chain data.

There are some limitations to be aware of when using this feature. You cannot interact with any of the Moonbeam precompiled contracts and their functions. Precompiles are a part of the Substrate implementation and, therefore, cannot be replicated in the simulated EVM environment. This prohibits you from interacting with cross-chain assets on Moonbeam and Substrate-based functionality such as staking and governance.

Tenderly makes creating a TestNet through the dashboard quite simple. To get started, click on Virtual TestNets on the left-side menu and then click Create Virtual TestNet. From there, you can take the following steps:

  1. Select Moonbeam, Moonriver, or Moonbase Alpha from the Parent network dropdown
  2. (Optional) Give your TestNet a name
  3. Select your Chain ID; you can use a custom one or the original network ID. It is recommended to set a custom Chain ID to prevent replay attacks and avoid issues when adding the Virtual TestNet to wallets
  4. Choose whether to turn on or off the Public Explorer
  5. Enable State Sync if you want to keep your Virtual TestNet updated in real-time with the parent network
  6. To limit data, disable Use latest block and enter a block number, or keep it enabled to include all blocks
  7. Click Create

Virtual TestNet Moonbeam

Once you've created your Virtual TestNet, you can start using it by deploying a contract or creating a transaction simulation.

To deploy a contract, go to Contracts in the left menu. Use one from Watched Contracts or add a new one via Watch Contract. Once added, it will appear in Contracts, where you can view its details.

To create a simulation, click the Simulation button and enter the configurations for the simulation. For more information on simulations, please refer to Tenderly's Simulator UI Overview documentation.

TestNet simulations

Now that you've learned how to get started with a few of Tenderly's features on Moonbeam, please feel free to dive in and check out the other tools available in their development platform. You can visit Tenderly's documentation site for more information. You can also check out Moonbeam's tutorial on Using Tenderly to Simulate and Debug Transactions.

The information presented herein has been provided by third parties and is made available solely for general information purposes. Moonbeam does not endorse any project listed and described on the Moonbeam Doc Website (https://docs.moonbeam.network/). Moonbeam Foundation does not warrant the accuracy, completeness or usefulness of this information. Any reliance you place on such information is strictly at your own risk. Moonbeam Foundation disclaims all liability and responsibility arising from any reliance placed on this information by you or by anyone who may be informed of any of its contents. All statements and/or opinions expressed in these materials are solely the responsibility of the person or entity providing those materials and do not necessarily represent the opinion of Moonbeam Foundation. The information should not be construed as professional or financial advice of any kind. Advice from a suitably qualified professional should always be sought in relation to any particular matter or circumstance. The information herein may link to or integrate with other websites operated or content provided by third parties, and such other websites may link to this website. Moonbeam Foundation has no control over any such other websites or their content and will have no liability arising out of or related to such websites or their content. The existence of any such link does not constitute an endorsement of such websites, the content of the websites, or the operators of the websites. These links are being provided to you only as a convenience and you release and hold Moonbeam Foundation harmless from any and all liability arising from your use of this information or the information provided by any third-party website or service.
Last update: February 27, 2025
| Created: December 16, 2022