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: smart-contracts/cookbook/smart-contracts/deploy-erc20/erc20-remix.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ Follow these steps to deploy the contract using Remix:
63
63
3. Configure the contract parameters to enter the address that will own the deployed token contract.
64
64
4. Click the **Deploy** button to initiate the deployment.
65
65
5. Approve the transaction in your MetaMask wallet.
66
-
6. If the deployment process succeeded, you will see the transaction details in the terminal, including the contract address and deployment transaction hash.
66
+
6. You will see the transaction details in the terminal when the deployment succeeds, including the contract address and deployment transaction hash.
Copy file name to clipboardExpand all lines: smart-contracts/cookbook/smart-contracts/deploy-nft/nft-hardhat.md
+45-19Lines changed: 45 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,49 +1,49 @@
1
1
---
2
-
title: Deploy an NFT to Polkadot Hub with Hardhat
2
+
title: Deploy ERC-721 Using Hardhat
3
3
description: Learn how to deploy an ERC-721 NFT contract to Polkadot Hub with Hardhat, a comprehenive development environment with built-in deployment capabilities.
4
4
tutorial_badge: Beginner
5
5
categories: Basics, Smart Contracts
6
6
tools: EVM Wallet, Hardhat
7
7
---
8
8
9
-
# Deploy an NFT with Hardhat
9
+
# Deploy ERC-721 Using Hardhat
10
10
11
11
## Introduction
12
12
13
13
Non-Fungible Tokens (NFTs) represent unique digital assets commonly used for digital art, collectibles, gaming, and identity verification.
14
14
15
-
This guide demonstrates how to deploy an [ERC-721](https://eips.ethereum.org/EIPS/eip-721){target=\_blank} NFT contract to [Polkadot Hub](/smart-contracts/overview/#smart-contract-development){target=\_blank}. You'll use [OpenZeppelin's battle-tested NFT implementation](https://github.com/OpenZeppelin/openzeppelin-contracts){target=\_blank} and [Hardhat](https://hardhat.org/docs/getting-started){target=\_blank}, a comprehensive development environment with built-in testing, debugging, and deployment capabilities. Hardhat uses standard Solidity compilation to generate EVM bytecode, making it fully compatible with Polkadot Hub's EVM environment.
15
+
This guide demonstrates how to deploy an [ERC-721](https://eips.ethereum.org/EIPS/eip-721){target=\_blank} NFT contract to [Polkadot Hub](/smart-contracts/overview/#smart-contract-development){target=\_blank}. You'll use OpenZeppelin's battle-tested [NFT implementation](https://github.com/OpenZeppelin/openzeppelin-contracts){target=\_blank} and [Hardhat](https://hardhat.org/docs/getting-started){target=\_blank}, a comprehensive development environment with built-in testing, debugging, and deployment capabilities. Hardhat uses standard Solidity compilation to generate EVM bytecode, making it fully compatible with Polkadot Hub's EVM environment.
16
16
17
17
## Prerequisites
18
18
19
-
- Basic understanding of Solidity programming and NFT standards.
20
-
- Node.js v22.13.1 or later.
21
-
- A funded account with tokens for transaction fees. This example will deploy the contract to the Polkadot TestNet, so you'll [need some TestNet tokens](/smart-contracts/faucet/#get-test-tokens){target=\_blank} from the [Polkadot Faucet](https://faucet.polkadot.io/?parachain=1111){target=\_blank}.
19
+
Before you begin, ensure you have the following:
20
+
21
+
- A basic understanding of [Solidity](https://www.soliditylang.org/){target=\_blank} programming and [ERC-721](https://ethereum.org/developers/docs/standards/tokens/erc-721/){target=\_blank} non-fungible tokens.
22
+
- Node.js v22.13.1 or later installed.
23
+
- Test tokens for gas fees, available from the [Polkadot faucet](https://faucet.polkadot.io/){target=\_blank}. See [Get Test Tokens](/smart-contracts/faucet/#get-test-tokens){target=\_blank} for a guide to using the faucet.
22
24
- A wallet with a private key for signing transactions.
23
25
24
26
## Set Up Your Project
25
27
26
-
Take the following steps to get started:
27
-
28
-
1. Initialize your Hardhat project:
28
+
1. Use the following terminal commands to create a directory and initialize your Hardhat project inside of it:
29
29
30
30
```bash
31
31
mkdir hardhat-nft-deployment
32
32
cd hardhat-nft-deployment
33
33
npx hardhat --init
34
34
```
35
35
36
-
2. Install OpenZeppelin contracts:
36
+
2. Install the OpenZeppelin contract dependencies using the command:
37
37
38
38
```bash
39
39
npm install @openzeppelin/contracts
40
40
```
41
41
42
42
## Configure Hardhat
43
43
44
-
Edit`hardhat.config.ts`:
44
+
Open`hardhat.config.js` and update to add `polkadotHubTestnet` to the `networks` configuration as highlighted in the following example code:
import type { HardhatUserConfig } from 'hardhat/config';
48
48
49
49
import hardhatToolboxViemPlugin from '@nomicfoundation/hardhat-toolbox-viem';
@@ -97,9 +97,15 @@ export default config;
97
97
!!! tip
98
98
Learn how to use Hardhat's [Config Variables](https://hardhat.org/docs/learn-more/configuration-variables){target=\_blank} to handle your private keys in a secure way.
99
99
100
-
## Create Your Contract
100
+
## Create the Contract
101
+
102
+
Follow these steps to create your smart contract:
103
+
104
+
1. Delete the default contract file(s) in the `contracts` directory.
101
105
102
-
Create `contracts/MyNFT.sol`:
106
+
2. Create a new file named `MyNFT.sol` inside the `contracts` directory.
107
+
108
+
3. Add the following code to create the `MyNFT.sol` smart contract:
103
109
104
110
```solidity title="contracts/MyNFT.sol"
105
111
// SPDX-License-Identifier: MIT
@@ -123,15 +129,33 @@ contract MyNFT is ERC721, Ownable {
123
129
}
124
130
```
125
131
126
-
## Compile
132
+
## Compile the Contract
133
+
134
+
Compile your `MyNFT.sol` contract using the following command:
127
135
128
136
```bash
129
137
npx hardhat compile
130
138
```
131
139
140
+
You will see a message in the terminal confirming the contract was successfully compiled similar to the following:
0 commit comments