Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 697 Bytes

File metadata and controls

25 lines (18 loc) · 697 Bytes

Loading Credentials Into Scripts

Your credentials stored at .env are required to run transactions on Hedera testnet.

  • dotenv has load_dotenv() to load credentails
  • os has getenv() to read the credentials

We use both, for example:

# Import dotenv and os
from dotenv import load_dotenv
from os import getenv

# Load variables from .env into environment
load_dotenv()

# Read the variables
operator_id_string = getenv("OPERATOR_ID")
operator_key_string = getenv("OPERATOR_KEY")

# Printing confirming loading and reading
print(f"Congratulations! We loaded your operator ID: {operator_id_string}.")
print("Your operator key was loaded successfully (not printed for security).")