truffle
Develop, test, and deploy smart contracts
TLDR
Download a pre-built Truffle project (Truffle Box)
Compile contract source files in the current directory
Run JavaScript and Solidity tests
Run migrations to deploy contracts
Display help for a subcommand
SYNOPSIS
truffle command [options]
PARAMETERS
init
Initializes a new Truffle project in the current directory.
compile
Compiles the smart contracts in the contracts directory.
migrate
Deploys the smart contracts to the network. Execute smart contract migrations to deploy them on the blockchain.
test
Runs the tests located in the test directory.
debug
Debugs a smart contract transaction using the Truffle debugger.
console
Opens a console for interacting with the blockchain.
develop
Launches a local development blockchain with a built-in console.
deploy
Alias for 'migrate'.
unbox box_name
Downloads a Truffle Box, which is a pre-configured project template.
--network network_name
Specifies the network to use for the command (e.g., development, mainnet, ropsten).
DESCRIPTION
Truffle is a world-class development environment, testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM). It provides tools for smart contract deployment, migration, testing, debugging, and management. Truffle significantly simplifies the process of building decentralized applications (DApps) on Ethereum and other EVM-compatible blockchains.
Truffle provides a consistent and streamlined workflow, including project scaffolding, smart contract compilation, contract migration, automated testing, and network deployment. It integrates with popular Ethereum clients like Ganache, geth, and Parity. Truffle also supports various Solidity compilers and provides a rich ecosystem of plugins and extensions to enhance its functionality. Its focus is on promoting best practices for smart contract development, ensuring code quality and security.
CAVEATS
Truffle requires Node.js and npm (Node Package Manager) to be installed on your system. It assumes a basic understanding of smart contract development and the Ethereum blockchain.
CONFIGURATION
Truffle projects are configured using a `truffle-config.js` file in the root directory. This file specifies network settings, compiler options, and other project-specific configurations.
TESTING
Truffle provides a robust testing environment using Mocha and Chai. Tests can be written in JavaScript or Solidity.
ARTIFACTS
When you compile your contracts, Truffle generates artifacts in the `build/contracts` directory. These artifacts contain the ABI (Application Binary Interface) and bytecode of your contracts, which are needed to interact with them.
HISTORY
Truffle was created by ConsenSys in 2015 and quickly became one of the most popular development frameworks for Ethereum. It has evolved significantly over time, adding new features, improving its performance, and expanding its ecosystem of plugins and tools. Truffle is actively maintained and widely used by blockchain developers around the world.
SEE ALSO
ganache-cli(1), solc(1)