Your private key doesn't belong in your terminal. Here's the Foundry fix.

dev.to

You're about to run forge script --broadcast. The command needs a private key. The options that come to mind first all share the same problem: paste it into the terminal and it ends up in .bash_history or .zsh_history. Put it in .env and it's one accidental git add away from the repo. Hardcode it in the deploy script and it's in version history the moment the file is committed. These aren't theoretical risks — they're how keys get exposed. There is a better way built directly into Foundry.

Read Full Article open_in_new
arrow_back Back to News