You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deploying/deploy-smart-contracts.mdx
+56-10Lines changed: 56 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,62 +56,108 @@ The deployer account is the account that will deploy your contracts. Additionall
56
56
<TabsgroupId="dev-tool">
57
57
<TabItemvalue="hardhat"label="Hardhat"default>
58
58
59
-
You can generate a random account / private key by running:
59
+
You can **generate a random account / private key** by running:
60
60
61
61
```
62
62
yarn generate
63
63
```
64
64
65
65
It will automatically add the encrypted private key (`DEPLOYER_PRIVATE_KEY_ENCRYPTED`) in your `.env` file.
66
66
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>
68
68
69
69
:::info Info
70
70
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).
71
71
:::info
72
72
73
-
If you prefer to import your private key, run:
73
+
If you prefer to **import your private key**, run:
74
74
75
75
```
76
76
yarn account:import
77
77
```
78
78
79
79
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.
80
80
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
+
81
108
</TabItem>
82
109
<TabItemvalue="foundry"label="Foundry">
83
110
84
111
> **Note:** If you already have a foundry keystore account, you can skip the following steps.
85
112
86
-
You can generate a new keystore account by running:
113
+
You can **generate a new keystore account** by running:
87
114
88
115
```
89
116
yarn generate
90
117
```
91
118
92
119
It will automatically generate a new [keystore](https://book.getfoundry.sh/reference/cast/cast-wallet-import) with random private key.
93
120
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>
95
122
96
-
If you prefer to import your private key run:
123
+
If you prefer to **import your private key** run:
97
124
98
125
```
99
126
yarn account:import
100
127
```
101
128
102
129
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.
103
130
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:
108
132
109
133
```
110
134
yarn account
111
135
```
112
136
113
137
You will need to enter your password to decrypt the private key and view the account information and balances.
114
138
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.
0 commit comments