In this documentation Using Hardhat,
your hardhat-config file
const privateKey = fs.readFileSync(".secret").toString().trim();
should be set to const privateKey=process.env…
and then that variable should be passed into accounts below
and you are missing a require(“dotenv”).config; line above