-
- Installation
- Creating a project
- Choosing an Ethereum client
- Compiling contracts
- Running migrations
- Testing your contracts
- Writing tests in JavaScript
- Writing tests in Solidity
- Interacting with your contracts
- Package management via EthPM
- Package management via NPM
- Debugging your contracts
- Using Truffle Develop and the console
- Writing external scripts
- Using the build pipeline
- Contact the developers
Getting Started
Advanced
Ganache
Creating a project
To use most Truffle commands, you need to run them against an existing Truffle project. This section will show you how to create a new project.
For those just getting started, we have many boilerplates and example applications available to you through Truffle Boxes.
You can start with our MetaCoin example by running the following on the command line:
mkdir MetaCoin
cd MetaCoin
truffle unbox metacoin
See the project structure as shown at the bottom of this page.
Note: The MetaCoin Truffle project used to be created by running truffle init
. Now it exists as a Truffle Box.
You can use the truffle unbox <box-name>
command to download any of the other applications.
If you'd prefer to start from scratch, create a project directory and move into it. You can do this through your favorite file explorer or by running the following on the command line:
mkdir myproject
cd myproject
Next, initialize your Truffle project by running the following command:
truffle init
Once completed, you'll now have a project structure with the following items:
contracts/
: Directory for Solidity contractsmigrations/
: Directory for scriptable deployment filestest/
: Directory for test files for testing your application and contractstruffle.js
: Truffle configuration file