Skip to content

Commit

Permalink
Update hardhat commands with encrypted deployer pk (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pabl0cks authored Dec 11, 2024
1 parent f5d665a commit 0864e8d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions docs/deploying/deploy-smart-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ You can also add your custom network by following the recipe [here](/recipes/add

The deployer account is the account that will deploy your contracts. Additionally, the deployer account will be used to execute any function calls that are part of your deployment script.

You can generate a random account / private key or add your crypto wallet's private key.

To create a random account and add the `DEPLOYER_PRIVATE_KEY` to the `.env` file, run:
You can generate a random account / private key by running:

```
yarn generate
Expand All @@ -67,7 +65,17 @@ yarn generate
<TabItem value="hardhat" label="Hardhat" default>
```

If you prefer to manually set your own private key, you will need to add `DEPLOYER_PRIVATE_KEY=yourWalletPrivateKey` to `packages/hardhat/.env`.
It will automatically add the encrypted private key (`DEPLOYER_PRIVATE_KEY_ENCRYPTED`) in your `.env` file.

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.**

If you prefer to import your private key, 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 your `.env` file.

```mdx-code-block
</TabItem>
Expand All @@ -79,12 +87,14 @@ If you prefer to manually set your own private key, you will need to add `DEPLOY
</TabItem>
</Tabs>

You can check the configured (generated or manually set) account and balances with:
You can check the configured (generated or imported) account and balances with:

```
yarn account
```

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

## 3. Deploy your smart contract(s)

By default `yarn deploy` will deploy contract to the local network. You can change `defaultNetwork` in:
Expand All @@ -110,7 +120,7 @@ packages/foundry/foundry.toml
</TabItem>
</Tabs>

Run the command below to deploy the smart contract to the target network. Make sure to have some funds in your deployer account to pay for the transaction.
Run the command below to deploy the smart contract to the target network. Make sure to have your encryption password and some funds in your deployer account to pay for the transaction.

```
yarn deploy --network network_name
Expand Down

0 comments on commit 0864e8d

Please sign in to comment.