Since Harmony is fully EVM-compatible (Ethereum Virtual Machine), it makes it really easy to port existing contracts to Harmony. Here's a short demo on how to port an existing Ethereum smart contract to the Harmony testnet:
If you have an idea that you'd like to deploy on the Harmony Protocol, you might be interested in learning about the Harmony Grant Program.
The following tools need to be installed:
Node Package Manager (npm)
You might be require to provide super user privileges to install it.
Navigate to the directory where you want to setup you project. For this guide we will be using "demo" as the project name.
(Optional) Install Additional Dependencies if required. We wont be using this for this demo.
Create a .env
file in the project root directory and put your mnemonic code, private key, and rpc url in it. We will be using the following structure for our demo.
In the project root directory, there is a file truffle-config.js
and copy paste the following configuration.
This section covers writing a custom smart contract and deploying it on Harmony Testnet.
In the contracts folder create a new file Counter.sol
and add the following code block to it:
In the migrations folder create another new file called 2_Counter.js
and add the following code block:
If all was done correctly you should see something like this:
This page describes in detail how to deploy a smart contract on to Harmony using an example
The smart contract demo example used in this tutorial can be found in the following repository.
is a Truffle box that will get you quickly up and running deploying smart contracts on Harmony using Truffle & native Ethereum tooling.