Deploy Solidity contracts on Zilliqa using Truffle and Hardhat

Smart contract developers can now begin building dApps on the Zilliqa testnet using Truffle and Hardhat.

Deploy Solidity contracts on Zilliqa using Truffle and Hardhat

EVM compatibility is officially live on the Zilliqa testnet, with plans for a mainnet launch in early 2023.

This opens up the Zilliqa ecosystem to multi-chain applications and allows users to easily connect their MetaMask wallets to the network.

Smart contract developers can also now begin to build dApps on Zilliqa using familiar EVM programming languages like Solidity and tools like Truffle and Hardhat.

Truffle and Hardhat are powerful and popular tools for developing, testing, and deploying Solidity contracts on EVM-compatible chains, which now include the Zilliqa testnet.

Let’s take a look at how Solidity developers can use Truffle or Hardhat to build on the Zilliqa testnet:

Truffle

Truffle is a development framework for Solidity smart contracts that offers a number of useful features.

These include the ability to create a local testnet for debugging Solidity contracts, compile Solidity into deployable bytecode, and improve your Solidity code.

Truffle can also be used to build front-end dApps that interact with your Solidity contracts using a simple web3 library.

The framework helps greatly to streamline the development of Solidity code and ensure that the smart contracts you deploy have been tested and properly integrated with other frameworks.

For instructions on how to install and use Truffle and related tools, visit the official website and follow the Quickstart Guide to start building smart contracts with Solidity.

You can use a local environment in Truffle to test your smart contract and once you’re ready to deploy to the Zilliqa testnet, you will need to edit the “truffle-config.js” file and add a network with the following parameters:

Network name: EVM Test

RPC URL: https://evm-api-dev.zilliqa.com/

Network ID: 33101

You can then specify this new network when deploying your contract within Truffle. To find out more about the process of adding a network to the configuration file and deploying contracts, read the official documentation.

You can also connect MetaMask to Truffle and use web3 injection to interact with your contract on the Zilliqa testnet through your MetaMask wallet by following the guide here.

For more information on deploying contracts from Truffle to the Zilliqa EVM-compatible testnet, visit the Zilliqa Developer Portal. Note that this documentation will be updated as EVM compatibility testing and development progresses on the Zilliqa testnet.

Hardhat

Hardhat is a development environment for Solidity which makes it easy for developers to compile and deploy EVM-compatible smart contracts.

It can be used to write and run automated tests for Solidity smart contracts that help to ensure these are working as designed and to identify and resolve any bugs or other issues in smart contract code.

When used together, Hardhat and Truffle can provide a powerful and flexible development environment for Solidity smart contracts.

For example, you can use Hardhat to compile and deploy your contracts, and then use Truffle to run automated tests and interact with the contracts.

To get started with Hardhat, visit the Hardhat website and follow the instructions to install the development environment.

In a similar manner to Truffle, you can configure Hardhat to deploy smart contracts on the Zilliqa EVM testnet by editing the “hardhat.config.js” file and changing the following fields under the “testnet” network settings:

URL: https://evm-api-dev.zilliqa.com/

ChainID: 33101

More information on configuring Hardhat can be found in the documentation.

If you want to interact with your newly deployed contract on the Zilliqa testnet, you can easily do so using MetaMask by adding the Zilliqa testnet as a custom network.

You can find more information on using Hardhat with the Zilliqa EVM-compatible testnet on the Zilliqa Developer Portal. The information on this page is being updated as testing and development for EVM compatibility continues on the Zilliqa testnet.

Learn to develop smart contracts

If you’re just diving into the world of smart contract development, Zilliqa’s EVM-compatible testnet is the perfect place to start.

You can choose to build Zilliqa dApps using the Solidity smart contract language, originally built for Ethereum and deployable on EVM-compatible protocols, or you can use Zilliqa’s native Scilla programming language, a safe-by-design smart contract language created with safety and security in mind.

To get started learning Solidity, you can get started by following tutorials available on the Ethereum website, or you can learn through an interactive online tutorial called CryptoZombies, which will teach you Solidity as you build a dApp step-by-step.

If you’re interested in building on Zilliqa using Scilla, the best place to start is the official documentation, which offers a number of tutorial options for new developers.

Scilla smart contracts can be deployed on the EVM-compatible Zilliqa testnet as well as on mainnet, and with the launch of EVM compatibility, Scilla contracts deployed on Zilliqa will soon be able to interact with EVM contracts.

This means that Scilla developers will be able to build multi-chain dApps on Zilliqa, greatly improving the interoperability and reach of contracts written using the blockchain’s smart contract language.

Learn more about Scilla and how to build on Zilliqa by visiting our Developer Portal.