Skip to content

Latest commit

 

History

History
129 lines (84 loc) · 12.5 KB

File metadata and controls

129 lines (84 loc) · 12.5 KB

Other Development Tools

Before we dive into these other development frameworks, we wanted to provide an "offramp" to folks who may not be comfortable with JavaScript Frameworks. We'd encourage you to check out the sections on Node and JavaScript Frameworks in the Basic Training course. People uncomfortable with terminal-based development might be interested in JSUI, a GUI-based JavaScript framework development environment. You can also checkout some frontend boilerplate projects here.

Hardhat

Another popular development framework is Hardhat, which actually started as a fork of Truffle. It has since grown to create its own suite of tools and a devoted community.

Hardhat divides itself into "tasks" and "plugins". Running npx hardhat compile is a task, for example. Plugins are extended functionality ported into Hardhat. Gas Reporter and Contract Sizer are two popular plugins for Hardhat.

Why choose Hardhat? Some feel as though the command-line experience of Hardhat is faster than Truffle. Others like the extensive plugin features. One feature popular with Hardhat developers is their use of console.log() in smart contracts. When developing locally with Hardhat, you can import the console.sol contract, like so:

pragma solidity ^0.6.0;

import "hardhat/console.sol";

contract Token {
  //...
}

You can then add it to your contract when developing it locally:

function transfer(address to, uint256 amount) external {
    console.log("Sender balance is %s tokens", balances[msg.sender]);
    console.log("Trying to send %s tokens to %s", amount, to);

    require(balances[msg.sender] >= amount, "Not enough tokens");

    balances[msg.sender] -= amount;
    balances[to] += amount;
}

Which gives you this output when running locally on the Hardhat Network:

$ npx hardhat test

  Token contract
    Deployment
      ✓ Should set the right owner
      ✓ Should assign the total supply of tokens to the owner
    Transactions
Sender balance is 1000 tokens
Trying to send 50 tokens to 0xead9c93b79ae7c1591b1fb5323bd777e86e150d4
Sender balance is 50 tokens
Trying to send 50 tokens to 0xe5904695748fe4a84b40b3fc79de2277660bd1d3
      ✓ Should transfer tokens between accounts (373ms)
      ✓ Should fail if sender doesn’t have enough tokens
Sender balance is 1000 tokens
Trying to send 100 tokens to 0xead9c93b79ae7c1591b1fb5323bd777e86e150d4
Sender balance is 900 tokens
Trying to send 100 tokens to 0xe5904695748fe4a84b40b3fc79de2277660bd1d3
      ✓ Should update balances after transfers (187ms)


  5 passing (2s)

You can learn more about this feature in their documentation here.

Here are some easy ways to get started using Hardhat to see how you like it:

The Hardhat teams recommends "paying attention to see whether any plugins already solve problems [you] may have."

Scaffold-ETH

Scaffold-ETH (docs) is a project from prolific builder Austin Griffith meant to minimize the time between thinking of a decentralized app idea and deploying it to the world.

However, Scaffold-ETH requires an advanced comfortability with tools like Yarn, Solidity, Hardhat, React, etc. It's best for folks who already have a very solid Web 2 or Web 3 workflow. For those folks, Scaffold-ETH is jet fuel! Please note, however, that projects and tutorials in Scaffold-ETH have not been audited in any way and may contain bugs or vulnerabilities!

In the repo, Austin has provided a number of forks that correspond to different template projects or tutorials. Read more about the tutorials and examples here.

As we mentioned, Scaffold-ETH by default serves up a React App, with pre-built components, and hooks. It's also incorporated a third-party UI library called Ant Design to help with the designing of components. It also incorporates Surge, a static-site generator to publish your app.

Scaffold-ETH also has significant infrastructure support for the later parts of the development cycle, such as The Graph, Tenderly, Etherscan, and L2/Sidechain Services (deploying to Optimism and Arbitrum).

Also, there are examples from some great projects in the space, like Aave, The Graph, Chainlink, Optimism and Uniswap. You can also learn about common design patterns such as commit-reveal, ecrecover, multisigs, DEXes, and more!

Last, Austin is an incredibly proflific creator of content, including support videos and walkthroughs of Scaffold-ETH. Below are some recent walkthroughs he's done:

If you follow Austin on twitter or join the Scaffold-ETH Telegram, you'll get updates and assistance there as well.

Brownie

As we mentioned earlier, Brownie{target=_blank} is a Python-based development and testing framework for smart contracts running on the EVM. It uses Web3.py{target=_blank} as well as Solidity. It is most well-known for being the development framework the Yearn.Finance{target=_blank} team uses to build their powerful DeFi platform and CRV.{target=_blank}

Brownie definitely takes some notes from Truffle (they are both "sweet"){target=_blank}, including having a brownie init command and their equivalent of Truffle boxes, "Brownie Mixes."{target=_blank} This makes it an easy tool for a lot of Truffle developers familiar with Truffle.

Here are some tutorials to introduce you to Brownie:

Tenderly

Tenderly provides a way to both be alerted to contract events as well as troubleshoot a contract, including a "Forking Mainnet" feature similar to that of Truffle and Hardhat.

Frontend Tools

For your project, we've also discussed frontend interfaces. There are two services you can use for free to create a frontend instance easily:

  • Heroku is a Platform-as-a-Service, providing a quick way to deploy apps in a number of popular languages, such as Node.js (JavaScript), Python, Ruby and Go. You can connect your GitHub repo to your project for easy deployment. Heroku's basic plan is free and provides basic resources for getting started. Read more here.
  • Netlify also has a Git-based workflow allowing you to deploy your project easily from GitHub. It is also free and has a getting started manual here.

There are so many more amazing tools that we can't get into now, but if you check out the links in this section, you'll be able to dive deeper and learn more on your own!

Additional Material