Tenderly
Using Tenderly on Phron
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 Phron.
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 forked development environment to learn how your transactions will behave without having to send them on-chain. This way, you can know the outcome of the transaction and make sure 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
Forks - this feature simulates the live Phron network in an isolated environment, which enables you to interact with deployed contracts and live on-chain data. Forking also takes transaction simulations a step further by enabling you to chain multiple simulations together chronologically. This allows for the testing of complex transaction scenarios where one transaction depends upon another, with the benefit of using live on-chain data. There are some limitations to be aware of when using Tenderly's forking feature. You cannot interact with any of the Phron 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 Phron and Substrate-based functionality such as 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
Analytics - visualize transaction and on-chain data to get useful insights into what's going on with your project. You can use Tenderly's analytics builder or create custom queries and scripts to meet your analytic needs
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
NotePhron is fully supported by Tenderly with the exception of the Web3 Gateway. Phron is not currently supported by Tenderly. 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.
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 for contracts and transactions. However, you won't be able to simulate transactions or create forked environments.
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 Phron. For more detailed documentation, please refer to Tenderly's documentation site.
Create a Sandbox
To deploy contracts to Phron with a Tenderly Sandbox, you can navigate to sandbox.tenderly.co and take the following steps:
Enter your smart contract into the Solidity editor on the left-hand side
Select Phron from the Network menu, adjust any of the compilation settings, and specify the block to run your code on if needed
Update the JavaScript editor on the right-hand side for your contract. Ethers.js and Web3.js are included in the Sandbox by default and can be instantiated with
ethers
andweb3
, respectively. It's also important to note that the Sandbox includes global variables to ease development, so you don't need to worry about updating the RPC URL for PhronClick 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.
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 forks, 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:
Enter the contract address
Choose Phron as the network, depending on which network you've deployed your smart contract to
(Optional) You can give your contract a name
(Optional) You can toggle the Add more slider to on if you'd like to add additional contracts. This will allow you to add more contracts after the initial contract has been added
Finally to add the contract to the dashboard, click Add 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.
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 Fork
Tenderly's forking feature simulates the live Phron 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 Tenderly's forking feature. You cannot interact with any of the Phron 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 Phron and Substrate-based functionality such as staking and governance.
Tenderly makes creating a fork through the dashboard quite simple. To get started, click on Forks on the left-side menu and then click Create Fork. From there, you can take the following steps:
Select Phron from the Network dropdown
(Optional) Give your fork a name
If you only need data up until a specific block, you can toggle the Use Latest Block slider to off and specify the block number. Otherwise, you can leave the slider as is to include all blocks up until the latest block
Click Create
Once you've created your fork, you can start using it by deploying a contract to it or creating a transaction simulation using it.
To deploy a contract to your fork, you can click on the Deploy Contract button, upload your contract's source code, and set the compiler configurations. Once you submit the deployment, you'll see the transaction of your deployment appear under the Simulated Transactions tab and can click on the simulation for more information.
To create additional simulations, you can click the New Simulation button and enter in the configurations for the simulation. For more information on simulations, please refer to Tenderly's Simulator UI Overview documentation.
Now that you've learned how to get started with a few of Tenderly's features on Phron, 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 Phron's tutorial on Using Tenderly to Simulate and Debug Transactions.
This tutorial is for educational purposes only. As such, any contracts or code created in this tutorial should not be used in production.The information presented herein has been provided by third parties and is made available solely for general information purposes. Phron does not endorse any project listed and described on the Phron Doc Website (https://docs.Phron.ai/). Phron does not warrant the accuracy, completeness or usefulness of this information. Any reliance you place on such information is strictly at your own risk. Phron 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 Phron. 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. Phron 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 Phron 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 updated