The Hedera Hardhat Example Project demonstrates how to test and deploy a Hedera smart contract using a community instance of the Hedera JSON RPC Relay. For more information about Hardhat projects check out their docs here.
๐ฅ Check out the step-by-step tutorial here.
-
hardhat.config
- The Hardhat project configuration file reqiured for the project. This includes the Hedera testnet account private key, community JSON-RPC relay URL, and defines the Hardhat tasks. -
/contracts
- The folder that contains the Greeter smart contract. -
/test
- The folder that contains the test file that tests the Greeter.sol smart contract. -
/scripts
- The folder that contains the Hardhat project scripts. -
.env
- The file that stores the environment variables like the testnet account private key and community JSON-RPC url
- Clone this repo to your local machine:
git clone https://github.com/hashgraph/hedera-hardhat-example-project.git
- Once you've cloned the repository, open your IDE terminal and navigate to the root directory of the project.
cd hedera-hardhat-example-project
- Once you've cloned the repository, open your IDE terminal and navigate to the root directory of the project. Run the following command to install all the necessary dependencies:
npm install
- Install the dotenv package used to manage environment variables in a separate
.env
file, which is loaded at runtime
npm install dotenv
-
Get your Hedera testnet account hex encoded private key from the Hedera Developer Portal and update the
.env.example
TESTNET_OPERATOR_PRIVATE_KEY
-
Rename
.env.example
to.env
-
Run the test script from the root directory of the project. The default network is set to "testnet."
npx hardhat test
- Deploy the smart contract
npx hardhat deploy-contract
Contributions are welcome. Please see the contributing guide to see how you can get involved.
This project is governed by the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].