() ()
Truffle is a development environment, testing framework, and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. With Truffle you get:
- Built-in smart contract compilation, linking, deployment and binary management.
- Automated contract testing with Mocha and Chai.
- Configurable build pipeline with support for custom build processes.
- Scriptable deployment & migrations framework.
- Network management for deploying to many public & private networks.
- Interactive console for direct contract communication.
- Instant rebuilding of assets during development.
- External script runner that executes scripts within a Truffle environment.
Install
$ npm install -g truffle
Note: To avoid any strange permissions errors, we recommend using nvm.Quick Usage
For a default set of contracts and tests, run the following within an empty project directory:$ truffle init
From there, you can run
truffle compile
, truffle migrate
and truffle test
to compile your contracts, deploy those contracts to the network, and run their associated unit tests.Truffle comes bundled with a local development blockchain server that launches automatically when you invoke the commands above. If you'd like to configure a more advanced development environment we recommend you install the blockchain server separately by running
npm install -g ganache
at the command line.- ganache: a command-line version of Truffle's blockchain server.
- Ganache UI: A GUI for the server that displays your transaction history and chain state.