Skip to content

Commit e52cef8

Browse files
authored
Add yarn account:reveal-pk command explanations (#125)
1 parent 0bbccfb commit e52cef8

File tree

1 file changed

+56
-10
lines changed

1 file changed

+56
-10
lines changed

docs/deploying/deploy-smart-contracts.mdx

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,62 +56,108 @@ The deployer account is the account that will deploy your contracts. Additionall
5656
<Tabs groupId="dev-tool">
5757
<TabItem value="hardhat" label="Hardhat" default>
5858

59-
You can generate a random account / private key by running:
59+
You can **generate a random account / private key** by running:
6060

6161
```
6262
yarn generate
6363
```
6464

6565
It will automatically add the encrypted private key (`DEPLOYER_PRIVATE_KEY_ENCRYPTED`) in your `.env` file.
6666

67-
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.**
67+
You will be prompted to enter a password which will be used to encrypt your private key. <u>**Make sure to remember this password as you'll need it for future deployments and account queries.**</u>
6868

6969
:::info Info
7070
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).
7171
:::info
7272

73-
If you prefer to import your private key, run:
73+
If you prefer to **import your private key**, run:
7474

7575
```
7676
yarn account:import
7777
```
7878

7979
You will get prompted to paste your private key and set the encryption password. It will store your encrypted private key in your `.env` file.
8080

81+
You can **check the configured (generated or imported) account and balances** with:
82+
83+
```
84+
yarn account
85+
```
86+
87+
You will need to enter your password to decrypt the private key and view the account information and balances.
88+
89+
<details>
90+
<summary><strong>Reveal the private key of your deployer account (security risk)</strong></summary>
91+
92+
To reveal the private key of your currently configured deployer account (from `.env`), you can run:
93+
94+
```
95+
yarn account:reveal-pk
96+
```
97+
98+
You will be prompted to enter the password you used during the `yarn generate` or `yarn account:import` process. The command will then display your private key in the terminal.
99+
100+
This command is especially useful if you need to **export your deployer account to another tool, wallet, or environment**.
101+
102+
:::warning Security Warning
103+
Revealing your private key can be risky. Ensure you are in a secure environment and understand the implications. Never share your private key or commit it to version control.
104+
:::
105+
106+
</details>
107+
81108
</TabItem>
82109
<TabItem value="foundry" label="Foundry">
83110

84111
> **Note:** If you already have a foundry keystore account, you can skip the following steps.
85112
86-
You can generate a new keystore account by running:
113+
You can **generate a new keystore account** by running:
87114

88115
```
89116
yarn generate
90117
```
91118

92119
It will automatically generate a new [keystore](https://book.getfoundry.sh/reference/cast/cast-wallet-import) with random private key.
93120

94-
You will be prompted to enter keystore name and 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.**
121+
You will be prompted to enter keystore name and a password which will be used to encrypt your keystore. <u>**Make sure to remember this password as you'll need it for future deployments and account queries.**</u>
95122

96-
If you prefer to import your private key run:
123+
If you prefer to **import your private key** run:
97124

98125
```
99126
yarn account:import
100127
```
101128

102129
You will get prompted to enter [keystore](https://book.getfoundry.sh/reference/cast/cast-wallet-import#cast-wallet-import) name, private key and set the encryption password. It will create a new keystore in `~/.foundry/keystore` directory.
103130

104-
</TabItem>
105-
</Tabs>
106-
107-
You can check the configured (generated or imported) account and balances with:
131+
You can **check the configured (generated or imported) account and balances** with:
108132

109133
```
110134
yarn account
111135
```
112136

113137
You will need to enter your password to decrypt the private key and view the account information and balances.
114138

139+
<details>
140+
<summary><strong>Reveal the private key of a keystore account (security risk)</strong></summary>
141+
142+
To reveal the private key of a specific keystore account, you can run:
143+
144+
```
145+
yarn account:reveal-pk
146+
```
147+
148+
You will be prompted to select the keystore account and then enter the password for that keystore. The command will then display the private key in the terminal.
149+
150+
This command is especially useful if you need to **export your deployer account to another tool, wallet, or environment**.
151+
152+
:::warning Security Warning
153+
Revealing your private key can be risky. Ensure you are in a secure environment and understand the implications. Never share your private key or commit it to version control.
154+
:::
155+
156+
</details>
157+
158+
</TabItem>
159+
</Tabs>
160+
115161
## 3. Deploy your smart contract(s)
116162

117163
<Tabs groupId="dev-tool">

0 commit comments

Comments
 (0)