How the Truffle Suite Is Streamlining Ethereum Development
Initially launched in 2015, Truffle promises to solve a number of key problems experienced by Ethereum developers in the course of building decentralized applications using smart contracts. Functioning with support from development leader ConsenSys, Truffle potentially holds the key to making Ethereum development simple and accessible to a new wave of developers, in line with the goals of ConsenSys to promote Ethereum dApp development and blockchain-based governance around the world.
Why Truffle Exists
In the early days of Ethereum development, dApp developers and smart contract writers faced a number of shared challenges that made the process of building on the network a hit-and-miss affair. Creating each smart contract required interaction with multiple libraries, and the process of deployment onto the Ethereum Virtual Machine (EVM) often took 20 steps or more.
To solve this problem of impractical complexity, Truffle founder Tim Coulter began developing a set of libraries to handle these tasks in 2015, and these libraries became known as the Truffle Suite. The goal of the new framework was to do for Ethereum development what Ruby on Rails did for Javascript and CSS: To simplify the development process enough to make it a manageable entry point for new Ethereum developers while maintaining a powerful set of development tools under the hood.
Since 2015, Truffle has grown in popularity and it is currently on its fourth release. According to Truffle Engineering Lead Nick D’andrea, the key to its meteoric rise lies in its relative ease of use and fun interface, both of which effectively enable it to function as the “WordPress” of Ethereum development frameworks.
(Source: GitHub)
Speaking about his vision for Truffle over the coming few years, D’andrea said:
“In [five] years, Truffle will be a mature suite of tools that provide a one-stop-chocolate-shop for smart contract and decentralized application development. Our products already are built on top of each other, and we expect that this relationship will only get stronger — e.g., Ganache will know about your Truffle projects and provide a GUI for seeing deployed instances, etc. Since the community has been so incredible at building all manners of tools, we expect Truffle to extend this integration even further and allow users to mix-and-match their favorite utilities in an easy-to-use way.”
Under its deceptively simple exterior, Truffle packs a considerable development punch with a set of powerful tools that make Ethereum development much easier than would otherwise be possible. It comes with a built-in smart contract compilation feature than allows developers to compile solidity code into EVM bytecode and create an Application Binary Interface (ABI). It also enables library linking where developers can copy and paste addresses into bytecode.
It also allows for smart contract testing within a testing framework that supports Javascript. For developers who wish to go into uncharted territory, it supports custom builds. In addition, developers using Truffle are given the opportunity to choose any of a number of public and private Ethereum networks on which to deploy. Projects can be migrated onto local testnets, live networks, and the Ethereum mainnet.
Truffle Suite’s Unique Features
Truffle Suite users can manage the entire life cycle of a contract using the framework, which takes the burden off them completely and automates the entire process. This includes custom deployments, library linking, and complex Ethereum applications. The framework also permits them to automate their smart contract testing process, which makes dApp development significantly faster. Tests can be written in Javascript and Solidity according to the user’s needs.
Developers can also script deployment plans into their dApps which account for the expected growth and evolution of the dApp overtime and ensures that they anticipate changes and maintain the smart contracts for a long period of time. Most significantly of all, developers using Truffle no longer have to manage network artifacts, but can leave this to Truffle to automate completely. This frees up more time to focus exclusively on dApp development.
Truffle also comes with a powerful interactive console that enables developers to communicate with their contracts. The console gives developer access to all of their built contracts as well as all available Truffle commands. In addition to this, developers can also take advantage of Truffle’s external script runner which enables scripts to exhibit a measure of network awareness that helps contracts to bootstrap themselves and frees the developer from having to constantly micromanage ever aspect of the dApp’s existence.
New Truffle Additions
Truffle’s new release also comes with a couple of interesting tidbits for Ethereum developers which help with ease of writing contracts and enhanced cryptographic security.
Ganache is a Javascript-based personal development blockchain that is domiciled exclusively on the developer’s computer. According to Truffle, both Ganache and Truffle Develop report significantly faster response times than other clients during the automated testing process, and they both contain special features used by Truffle to speed up test runtime by almost 90 percent.
It comes with detailed mining controls that allow users to customize every aspect of its functionality including setting gas limits and block time. It also has log output, and is fully byzantium compatible, in addition to permitting chain forking, all of which enable developers to closely examine the behaviour of a contract on a live network without spending any ether.
Drizzle on the other hand, is Truffle’s newest collection of front-end libraries that makes writing Ethereum dApp front-ends immeasurably easier. Functioning in a manner similar to Ruby as described above, Drizzle automates important development tasks such as hooking up to the Ethereum blockchain via web3, instantiating contracts, and tracking contract data such as state, transactions, and events.
What is perhaps most striking about the entire Truffle framework is that, like a growing number of development projects within the cryptosphere, it is fully open source with a code repository that is freely available on GitHub. Truffle’s Github code library currently has 103 contributors, 125 releases, 34 branches and 4,1333 commits, which indicate the suite’s huge popularity within the Ethereum developer community.