Overview
Tenderly CLI provides native support for Truffle projects, automatically detecting your project structure and reading build artifacts from your Truffle compilation process. This enables seamless contract verification and deployment tracking.Prerequisites
Before integrating Tenderly with your Truffle project:- Have a Truffle project initialized
- Install Truffle globally or locally
- Install and authenticate Tenderly CLI
- Have an active Tenderly account
Supported Configuration Files
Tenderly CLI supports both Truffle configuration file naming conventions:truffle-config.js(recommended, new format)truffle.js(legacy format)
Tenderly CLI automatically detects which configuration file your project uses and reads the compiler settings, networks, and build directory path.
Installation
Install Tenderly CLI
Install the Tenderly CLI for your operating system:
- macOS
- Linux
- Windows
Using Homebrew:Or using cURL:
Authenticate with Tenderly
Log in to your Tenderly account:You can authenticate using email or access key:
Truffle Configuration
Yourtruffle-config.js should contain standard Truffle configuration:
truffle-config.js
Tenderly CLI reads your compiler configuration directly from this file to ensure verification uses the exact same settings.
Contract Deployment Workflow
Write Your Contracts
Create your Solidity contracts in the
contracts/ directory:contracts/MyToken.sol
Create Migration Scripts
Add migration scripts in the
migrations/ directory:migrations/2_deploy_contracts.js
Compile Contracts
Compile your Solidity contracts:This generates build artifacts in the
build/contracts/ directory.Tenderly Configuration
Thetenderly.yaml file stores your project configuration:
Basic Configuration
tenderly.yaml
Multi-Project Configuration
You can push contracts to multiple Tenderly projects by configuring the projects map:tenderly.yaml
When using multi-project configuration, remove the
project_slug property and use the projects map instead.Verification Workflow
Standard Verification
Network-Specific Verification
Verification Process
When you run verification, Tenderly CLI:- Detects your Truffle configuration file
- Reads compiler settings and optimization parameters
- Scans the
build/contracts/directory for artifacts - Extracts deployment addresses from network configurations
- Uploads contract source code and bytecode
- Verifies contracts on the Tenderly platform
Project Structure
A typical Truffle project integrated with Tenderly:Using with Alternative Providers
Tenderly CLI can work alongside other Truffle deployment providers. The CLI automatically detects Truffle projects based on:- Presence of
truffle-config.jsortruffle.js - Standard Truffle directory structure
- Build artifacts in
build/contracts/
Advanced Usage
Tagging Deployments
Tag your contract deployments for better organization:Project-Specific Push
When using multi-project configuration, push to a specific project:Custom Project Directory
Specify a custom project directory:Global Configuration Flags
All Tenderly commands support these global flags:Best Practices
Compile Before Verification
Always run
truffle compile before verifying to ensure build artifacts are up to date.Network ID Consistency
Use standard network IDs in your Truffle config to ensure proper verification.
Version Control
Commit
tenderly.yaml but consider adding build/ to .gitignore.Multi-Network Testing
Test verification on testnets before deploying to mainnet.
Troubleshooting
Configuration Not Found
If Tenderly can’t find your Truffle configuration:Check Configuration File
Ensure you have either
truffle-config.js or truffle.js in your project root.No Contracts Found
If verification reports no contracts:- Run
truffle compileto generate build artifacts - Check that
build/contracts/contains JSON files - Verify contracts are deployed (have network entries in artifacts)
Network Not Supported
If you see network errors:- Verify the network ID is supported by Tenderly
- Check that contracts are deployed to that network
- Ensure network configuration in
truffle-config.jsis correct
Next Steps
Push Contracts
Learn how to push contracts to public networks.
Initialize Projects
Explore advanced project initialization options.
Monitor Contracts
Set up monitoring and alerts in the Tenderly Dashboard.
Truffle Documentation
View the official Truffle documentation.