Skip to content

Commit

Permalink
Explain Foundry keystore in Generate a new account section (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pabl0cks authored Dec 12, 2024
1 parent 0864e8d commit 88af21d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docs/deploying/deploy-smart-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ It will automatically add the encrypted private key (`DEPLOYER_PRIVATE_KEY_ENCRY

You will be prompted to enter a password which will be used to encrypt your private key. **Make sure to remember this password as you'll need it for future deployments and account queries.**

:::info Info
We are only storing the plain private key in memory, it's never stored in disk files for security reasons. Checkout the code [here](https://github.com/scaffold-eth/create-eth/blob/main/templates/solidity-frameworks/hardhat/packages/hardhat/scripts/generateAccount.ts).
:::info

If you prefer to import your private key, run:

```
Expand All @@ -82,7 +86,21 @@ You will get prompted to paste your private key and set the encryption password.
<TabItem value="foundry" label="Foundry">
```

If you prefer to manually set your own private key, you will need to add `DEPLOYER_PRIVATE_KEY=yourWalletPrivateKey` to `packages/foundry/.env`.
It will automatically generate a new [keystore](https://book.getfoundry.sh/reference/cli/cast/wallet#cast-wallet) with the name `scaffold-eth-custom`.

You will be prompted to enter a password which will be used to encrypt your keystore. **Make sure to remember this password as you'll need it for future deployments and account queries.**

Now you'll need to open your `packages/foundry/.env` file, and update `ETH_KEYSTORE_ACCOUNT=scaffold-eth-custom` to start using the new keystore.

If you prefer to import your private key (you need to delete your `scaffold-eth-custom` keystore first, if exists), run:

```
yarn account:import
```

You will get prompted to paste your private key and set the encryption password. It will store your encrypted private key in the `scaffold-eth-custom` keystore file.

Also if you want to use your existing keystore account you can just update the `ETH_KEYSTORE_ACCOUNT` in your `.env` file, setting the name of your existing keystore.

</TabItem>
</Tabs>
Expand Down

0 comments on commit 88af21d

Please sign in to comment.