Skip to content

Commit aeeddf3

Browse files
committed
raw readme
1 parent f498d1c commit aeeddf3

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

README_raw.md

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
## Full stack NFT marketplace built with Polygon, Solidity, IPFS, & Next.js
2+
3+
![Header](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pfofv47dooojerkmfgr4.png)
4+
5+
### Running this project
6+
7+
#### Gitpod
8+
9+
To deploy this project to Gitpod, follow these steps:
10+
11+
1. Click this link to deploy
12+
13+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#github.com/dabit3/polygon-ethereum-nextjs-marketplace)
14+
15+
2. In __pages/index.js__, pass in the RPC address given to you by GitPod to the call to `JsonRpcProvider` function:
16+
17+
```javascript
18+
/* update this: */
19+
const provider = new ethers.providers.JsonRpcProvider()
20+
21+
/* to this: */
22+
const provider = new ethers.providers.JsonRpcProvider("https://8545-youendpoint.gitpod.io/")
23+
```
24+
25+
3. Import the RPC address given to you by GitPod into your MetaMask wallet
26+
27+
![MetaMask RPC Import](wallet.png)
28+
29+
#### Local setup
30+
31+
To run this project locally, follow these steps.
32+
33+
1. Clone the project locally, change into the directory, and install the dependencies:
34+
35+
```sh
36+
git clone https://github.com/dabit3/polygon-ethereum-nextjs-marketplace.git
37+
38+
cd polygon-ethereum-nextjs-marketplace
39+
40+
# install using NPM or Yarn
41+
npm install
42+
43+
# or
44+
45+
yarn
46+
```
47+
48+
2. Start the local Hardhat node
49+
50+
```sh
51+
npx hardhat node
52+
```
53+
54+
3. With the network running, deploy the contracts to the local network in a separate terminal window
55+
56+
```sh
57+
npx hardhat run scripts/deploy.js --network localhost
58+
```
59+
60+
4. Start the app
61+
62+
```
63+
npm run dev
64+
```
65+
66+
### Configuration
67+
68+
To deploy to Polygon test or main networks, update the configurations located in __hardhat.config.js__ to use a private key and, optionally, deploy to a private RPC like Infura.
69+
70+
```javascript
71+
require("@nomiclabs/hardhat-waffle");
72+
const fs = require('fs');
73+
const privateKey = fs.readFileSync(".secret").toString().trim() || "01234567890123456789";
74+
75+
// infuraId is optional if you are using Infura RPC
76+
const infuraId = fs.readFileSync(".infuraid").toString().trim() || "";
77+
78+
module.exports = {
79+
defaultNetwork: "hardhat",
80+
networks: {
81+
hardhat: {
82+
chainId: 1337
83+
},
84+
mumbai: {
85+
// Infura
86+
// url: `https://polygon-mumbai.infura.io/v3/${infuraId}`
87+
url: "https://rpc-mumbai.matic.today",
88+
accounts: [privateKey]
89+
},
90+
matic: {
91+
// Infura
92+
// url: `https://polygon-mainnet.infura.io/v3/${infuraId}`,
93+
url: "https://rpc-mainnet.maticvigil.com",
94+
accounts: [privateKey]
95+
}
96+
},
97+
solidity: {
98+
version: "0.8.4",
99+
settings: {
100+
optimizer: {
101+
enabled: true,
102+
runs: 200
103+
}
104+
}
105+
}
106+
};
107+
```
108+
109+
If using Infura, update __.infuraid__ with your [Infura](https://infura.io/) project ID.

0 commit comments

Comments
 (0)