Deploy to Hedera
Summary:
1. Imports and Environment Setup:
const {
Client,
FileCreateTransaction,
ContractCreateTransaction,
PrivateKey,
ContractFunctionParameters
} = require("@hashgraph/sdk");
require('dotenv').config({ path: 'SmartContract_Service/.env' });2. Environment Variables Retrieval and Validation:
const myAccountId = process.env.MY_ACCOUNT_ID;
const myPrivateKey = PrivateKey.fromString(process.env.MY_PRIVATE_KEY);
// If we weren't able to grab it, we should throw a new error
if (myAccountId == null || myPrivateKey == null) {
throw new Error("Environment variables myAccountId and myPrivateKey must be present");
}3. Client Setup:
4. Main Function:
5. Execution:
Last updated