Environment Setup
Last updated
Last updated
This environment setup guide will provide you with the necessary steps to get your development environment ready for building applications on the Hedera Network. You will set up a new project directory, establish a .env
environment variable file to store your Hedera Testnet account ID and private keys and configure your Hedera Testnet client.
Open your IDE of choice and follow the below steps to create your new project directory.
Create a new Gradle project and name it HederaExamples
. Add the following dependencies to your build.gradle
file.
Create a new Java class and name it something like HederaExamples
. Import the following classes to use in your example:
Create the .env
file in your project's root directory. The .env
file stores your environment variables, account ID, and private key (DER encoded).
Next, you will load your account ID and private key variables from the .env
file created in the previous step.
Within the main
method, add your testnet account ID and private key from the environment file.
To avoid encountering the INSUFFICIENT_TX_FEE
error while conducting transactions, you can adjust the maximum transaction fee limit through the .setDefaultMaxTransactionFee()
method. Similarly, the maximum query payment can be adjusted using the .setDefaultMaxQueryPayment()
method.
Your project environment is now set up to submit transactions and queries to the Hedera test network successfully!
Note: You may install the latest version of the Java SDK .
Install the with your favorite package manager npm
or yarn
by running the following command:
Note: Install the Go SDK and the DotEnv package before moving forward.
Note: Testnet HBAR is required for this next step. Please follow the instructions to create a Hedera account on the before you move on to the next step.
Grab the Hedera Testnet account ID and DER-encoded private key from your (see screenshot below) and assign them to the MY_ACCOUNT_ID
and MY_PRIVATE_KEY
environment variables in your .env
file:
Create a Hedera Testnet and set the operator information using the testnet account ID and private key for transaction and query fee authorization. The operator is the default account that will pay for the transaction and query fees in HBAR. You will need to sign the transaction or query with the private key of that account to authorize the payment. In this case, the operator ID is your testnet account ID**.**
and the operator private key is the corresponding testnet account private key.
Next, you will learn how to .
Have a question?
INTRODUCTION