Exploring Smart Contract Frameworks for Developers

Written by Ivan on Tech

Jan 24, 2021

Exploring Smart Contract Frameworks for Developers

At its very core, blockchain technology is decentralized, immutable ledgers used to securely transfer information or assets without third-party intermediaries. While Bitcoin is the best-known blockchain application, a common misconception still exists that Bitcoin and blockchain technology are the same thing. Rather, blockchain technology is the technology underpinning different cryptocurrencies and also entire emerging fields like DeFi. The DeFi industry, for example, relies heavily on smart contracts. As such, this article takes a closer look at some of the most popular smart contract frameworks for developers to make the most of blockchain technology.

It’s understandable that those new to crypto might confuse the two terms “Bitcoin” and “blockchain”. And that’s because Bitcoin is a more popular brand name than its parent technology. In reality, Bitcoin is just a cryptocurrency that uses the blockchain to complete transactions. So, if you’re looking for more in-depth knowledge on the blockchain and Bitcoin, check out Ivan on Tech Academy and the vast number of quality courses there.

Now, consider the two types of blockchain: Permissioned and Permissionless. Permissioned blockchains only accommodate a finite number of users with special access. However, Permissionless blockchains can accommodate an infinite number of users who don’t need any special access to join the network.

Ethereum is an example of a permissionless blockchain, and ETH is the world’s second-largest cryptocurrency. Furthermore, the Ethereum blockchain uses smart contracts written in the Solidity programming language.

Why Use Smart Contract Frameworks?

A blockchain developer can code smart contracts on their own, or they can use smart contract development frameworks. The reason for using a framework is that they make life easier by giving the developer a platform to deploy and test their contracts. 

So, while any list of frameworks will be subjective, and developers will always disagree about which frameworks suit them best, this list (while far from exhaustive) can offer an excellent place to start.

When selecting a smart contract framework, the main criteria are to make sure it can deploy a smart contract to a local blockchain and allow for quick and practical testing. When evaluating which framework is best, it will depend upon several factors such as the type of blockchain you’re working with, the programming language, and the framework’s popularity. For example, if you’re looking for a permissionless framework that supports smart contracts and is popular, then frameworks that work on Ethereum will be the option.

Hence, this article will examine some of the top blockchain frameworks exclusively used for the Ethereum blockchain. 

Three Smart Contract Frameworks

Let’s look at three of the more popular frameworks and how they differ.

  1. Truffle Suite 
  2. Brownie 
  3. Hardhat 

Smart Contract Framework – Truffle Suite (JavaScript)

Truffle has been the reigning king of smart contract development frameworks for a few years now. That’s because, as a widespread and robust framework, it has continuously set the standard. And since most smart contract projects use this platform, easy to follow examples are in abundance for any developer in need. 

Also, Drizzle and Ganache are two tools that integrate with Truffle. Drizzle is a collection of frontend libraries, while Ganache provides a way for developers to run a local blockchain. 

So, developers can use Ganache through the development cycle, allowing them to deploy, and test their dApps safely. Further, Ganache is available on Windows, Mac, and Linux.

And with a paid, upgraded team account, developers can access even more tools on Truffle. These tools offer features like visual deployments, smart contract continuous integration, and monitoring. Another plus is direct integration with OpenZeppelin’s plugin.

Truffle’s Features

By using Truffle, developers get access to features like built-in smart contract compilation and automated contract testing for rapid development. Network management is also available for deploying contracts to public and private networks. Moreover, package management includes an interactive console for direct contract communication. Also, an external script runner executes scripts within the Truffle environment.

Developers will need NodeJS to install Truffle, and the first step is to create a project. Then they can begin compiling contracts. Contracts are in the project’s “contracts/” directory. And since Solidity is the programming language, the files and any associated libraries will have the suffix “.sol.” To dig deeper, please see the Truffle Suite docs.

Truffle’s Downside

Truffle does have some negatives, however. For one thing, it’s hard to get support for issues because of the high volume of users, and Hardhat (see below) has eclipsed it in terms of speed. Their documentation can be outdated, so to track down an error, using Google or listing the issue on GitHub can be quicker than using Truffle’s support. However, since so many developers use this platform, peer support is readily available.

Meanwhile, ConsenSys acquired Truffle back in November 2020. So, it will be interesting to see if they address some of these issues. Hopefully, they’ll build up a big enough team to allocate the necessary resources to improve their documentation.

Truffle Summary

  1. Popularity: Most widely used platform
  2. Technology: JavaScript
  3. Plugin(s): OpenZeppelin and Etherscan
  4. Blockchain: Ganache
  5. Open Source: Yes

Smart Contract Framework – Brownie (Python)

Truffle inspired Brownie’s development, which is its Python equivalent. Let’s face it, “Pythonistas” don’t like JavaScript, so they welcomed the new option Brownie offered. Brownie is written in Python, removing many of the JavaScript frustrations while providing a user-friendly and straightforward framework for developing and deploying smart contracts.

Moreover, some of the Uber-smart developers at Yearn.Finance gave Brownie the nod of approval. And this project has gained momentum with more developers opting in for Python and the Brownie framework. So, for Pythonistas or other developers looking for a clean and simple framework that’s not JavaScript, Brownie might be the answer.

Brownie Features

The Brownie framework offers full support for Solidity and Vyper and conducts contract testing via pytest. It also has some powerful debugging tools and a built-in console for easier project interaction.

The preferable way to install Brownie is with pipx. Pipx is similar to JavaScript’s npx and is a tool to help install and run applications written in Python. Pipx does not ship with Python, so it needs to be installed separately for first-time users. 

For a deeper dive, please consult the Brownie docs.

Brownie Summary

  1. Popularity: The top Python framework
  2. Technology: Python
  3. Plugin(s): Etherscan with Vyper support
  4. Blockchain: Ganache
  5. Open Source: Yes

Smart Contract Framework – Hardhat (JavaScript)

Hardhat’s popularity is growing as well. And it boasts some of the most effortless integrations, fastest tests, and best tutorials around. For the developers who aren’t married to Truffle but want to stick with a JavaScript framework, Hardhat is a worthy candidate. The framework’s simplicity and blazing-fast tests warrant at least a try. 

Learn how to work with JavaScript frameworks by taking the JavaScript Programming for Blockchain Developers at Ivan on Tech Academy.

Hardhat directly integrates with OpenZeppelin’s plugin and uses Ethers.js and Waffle for testing. Moreover, some developers believe Ethers.js to be superior to web3.js as it adds some ease of use improvements. Also, if you have questions, Hardhat’s Discord channel provides a place to get answers quickly. 

This is a fast and clean framework, and Hardhat’s team is dedicated to constant improvements to make the smart contract developer’s job easier.

Hardhat Features

Like some of the other frameworks, Hardhat provides a development environment to compile, deploy, test, and debug contracts. Additionally, it assists developers in managing and automating these recurring tasks.

Hardhat also comes with a built-in, local Ethereum network created for development with the focus on Solidity debugging.

Furthermore, it uses what’s called their Hardhat Runner, which is an extensible task runner. Tasks can call other tasks, which allows for more complex workflows. And users and plugins can override existing tasks, which makes for customizable workflows. 

Much of Hardhat’s functionality comes from its plugins, and developers get to pick which ones they want to use. Hardhat has some built-in defaults, but they do not override the developer’s choice. Developers can choose to override all of the defaults.

For more technical information on Hardhat, please consult their documentation.

Hardhat Summary

  1. Popularity: It’s behind Truffle but rising
  2. Technology: JavaScript
  3. Plugin(s): OpenZeppelin and Etherscan
  4. Blockchain: Hardhat runtime environment
  5. Open Source: Yes

Alternative Smart Contract Development Frameworks

Other alternative frameworks might be worth checking out as well. Some have implemented cool ideas that the “Big 3” listed above might start incorporating if they grow in popularity. These are: 

  1. Waffle (JavaScript)
  2. Dapp.Tools 

Waffle

The Waffle framework is another JavaScript option that developers might want to consider. Waffle likes to brag that it’s “sweeter, simpler, and faster than Truffle.” However, it’s not recommended as a standalone deployment framework. Developers can use it this way so long as they don’t mind writing their own custom scripts. More often, though, Waffle is used as the default tool for working with Hardhat.

The philosophy at Waffle is that it’s “minimalistic with few dependencies,” and it focuses more on execution speed. Furthermore, it is Typescript compatible, well documented, and users can easily import contracts from npm modules.

If any of this sounds too complicated, don’t worry, it isn’t! Simply click over to Ivan on Tech Academy, and when you join, top blockchain instructors and a vibrant community will be there to answer any of your blockchain-related questions. 

Waffle Summary

  1. Popularity: Alternative framework
  2. Technology: JavaScript
  3. Blockchain: All options included
  4. Open Source: Yes

For more information on Waffle, check out their docs.

Dapp.Tools

The Dapp.Tools framework stands out because MakerDAO uses it. It is unique in that it is written in Haskell while also supporting many plugins like OpenZeppelin. 

Dapp.Tools is a minimalist framework but at the same time powerful enough to meet smart contract developer demands. It is a clean and straightforward framework for those looking for a minimalist, command-line-friendly framework.

Dapp.Tools Summary

  1. Popularity: MakerDAO uses it
  2. Technology: Haskell
  3. Blockchain: Ganache
  4. Open Source: Yes

Some Non-Framework Tools

We should also mention some of the non-framework tools out there that can be used with smart contract frameworks. Here are a few:

  1. OpenZeppelin Plugin
  2. Etherscan Block Explorer Verifier
  3. Create Eth App

OpenZeppelin Plugin

If you read our article, “DeFi Deep Dive – What Is OpenZeppelin?” you know that OpenZeppelin creates tools for smart contract developers. Devs can quickly create an ERC20 with OpenZeppelin just by adding an import statement and inheritance like so:

import “@openzeppelin/contracts/token/ERC20/ERC20.sol”;

contract GLDToken is ERC20 { // code goes here }

If you want to learn more about writing import statements and inheritance in the Solidity programming language, take the Smart Contract Programming course at Ivan on Tech Academy.

OpenZeppelin is open source, and the team dedicates itself to making sure that developers don’t have to reinvent the wheel when building smart contracts continually. But OpenZeppelin also has what’s called an “upgradable contracts functionality.” Developers can use this function to deploy a proxy contract they’ll need to update whenever making changes. In conclusion, OpenZeppelin has many excellent tools to be explored. 

Etherscan Block Explorer Verifier

Etherscan is the world’s most popular block explorer. What’s more, anyone desiring to check out a deployed smart contract will need the contract’s address and the Application Binary Interface (ABI). The ABI is how to call functions in a contract to get data back. And while locating the contract address is usually not difficult, finding the ABI can be.

Therefore, to make it easier for others to interact with a smart contract, the developer needs to verify it. Most frameworks utilize a verification plugin for developers to deploy a smart contract and then verify it on Etherscan. This verification plugin should be part of any smart contract developer’s arsenal.

Create ETH App

Creating smart contracts on the backend is excellent, but they won’t do any good if nobody can access them. That’s why its creators built create-eth-app. It’s for those looking to quickly crank out a frontend for their smart contracts using ReactJS. It makes frontend building so much easier.

Smart Contract Frameworks for Developers – Conclusion

Like everything else in the blockchain industry, the wonderful world of Smart Contract Frameworks is fast-paced. The hottest tools can fade away quickly, only to be replaced by new ones. Truffle is still on top, but other projects tackle the same problems differently and may challenge them one day.

That’s why if you’re a smart contract developer on the fast track, you’ll want to check out these tools and frameworks to see which ones you prefer. 

But if you really want to up your game, you’ll need to get the best Ethereum blockchain education possible. And the place for that is Ivan on Tech Academy. Be sure to check out the list of courses today!

Author MindFrac

Search
Generic filters
Filter by Categories

Share this article

Share on facebook
Share on twitter
Share on linkedin
Share on reddit

Subscribe to our blog

Get the latest posts in your email



Become Blockchain Certified Today

CLAIM YOUR

20% OFF

DISCOUNT

Log In

Sign in to your account and start learning!

IOT icon header