Hedera Smart Contracts Workshop

Hedera Smart Contract Service (HSCS) workshop. Learn how to enable custom logic & processing on Hedera through smart contracts.

Smart contracts are a means to enable custom logic and processing in a DLT. Developers can harness their power to build their own decentralized applications (DApps). Learn how to get started with the Hedera Smart Contract Service (HSCS) in this workshop.

What we will cover

  • Syntax of Solidity, a programming language used to write smart contracts

  • Using the Solidity compiler

  • Using Hedera SDK JS to deploy and interact with smart contracts on Hedera networks

  • Using Hardhat + EthersJs to deploy and interact with smart contracts on Hedera networks

  • Where to go from here

Video

Prerequisites

Prior knowledge:

  • ✅ Javascript syntax

  • ✅ Hedera network core concepts

System setup:

  • git installed

  • ✅ NodeJs + npm installed

    • Minimum version of NodeJs: 18

    • Minimum version of npm: 9.5

    • Recommended for Linux & Mac: nvm

    • Recommended for Windows: nvm-windows

  • ✅ POSIX-compliant shell

    • For Linux & Mac: The shell that ships with the operating system will work. Either bash or zsh will work.

    • For Windows: The shell that ships with the operating system (cmd.exe, powershell.exe) will not work. Recommended alternatives: WSL/2, or git-bash which ships with git-for-windows.

  • ✅ Internet connection

  • ✅ Optionally, jq

    • For Linux: Use OS package manager

    • For Mac: brew install jq

    • For Windows: Install .exe file manually: JQ releases (Github)

Software libraries and developer tools

Before we begin coding, let's take a look at the various software libraries and developer tools that you will need to be familiar with when working with smart contracts on HSCS.

Hedera SDK JS is a software library that contains functions designed to interact the all of the services available on the Hedera network: HCS, HTS, HFS, and HSCS. That includes smart contracts.

Both EthersJs and Web3Js are software libraries that contain functions designed to interact with the Ethereum network, and any other EVM-compatible networks. This means that you can use them to interact with HSCS as well (but not with HCS, HTS, or HFS).

Smart contracts are written using Solidity, but we cannot just take the Solidity code and ask HSCS, or any other EVM implementation, to run it. Instead we need solc, the Solidity compiler, to compile it into EVM bytecode, which can then be executed by any EVM implementation, including the one in HSCS.

Other smart contract programming languages

Solidity is not the only game in town. You can actually write smart contracts in any language, as long as it can compile to EVM bytecode. The most popular alternative smart contract programming language is Vyper.

In this workshop we will be using Solidity.

Truffle Suite, Hardhat, and Foundry are developer frameworks that are designed to make it easier to work with smart contract development workflows by providing various utilities, scripts, structure, and documentation that are useful during development.

In this workshop we will be using Hardhat.

Last updated