Chapter 11. Improving the development cycle with Truffle

 

This chapter covers

  • Installing Truffle, a smart-contract framework
  • Setting up and compiling an Ethereum contract within Truffle
  • Simplifying contract deployment through Truffle’s migrations
  • Simplifying contract unit testing with Truffle

In the previous chapter, you started to integrate unit testing into your development environment with Mocha. But you might have noticed that the unit test script didn’t look ideal. It has a fairly complex setup, which includes explicit instructions on compiling SimpleCoin and creating a contract factory. Each test also includes an explicit deployment statement that references the contract factory. The main drawback is that all this infrastructural code distracts from the main objective of unit tests, which is to focus on functional aspects of a contract. Another disadvantage is that if you wanted to create a new test suite to cover a different contract, you’d have to duplicate all this infrastructural code.

Wouldn’t it be nice if you had a way to simplify the deployment of a contract? This is the main objective of Truffle, an Ethereum contract development framework that focuses on streamlining deployment and consequently simplifying unit testing.

11.1. Setting up Truffle

11.2. Moving SimpleCoin under Truffle

Summary

sitemap