Skip to content

Commit

Permalink
updated getting started instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
dabit3 committed Jul 6, 2021
1 parent a1b1a6e commit ac18ede
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,49 @@

![Header](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pfofv47dooojerkmfgr4.png)

### Running this project

To run this project locally, follow these steps.

1. Clone the project locally, change into the directory, and install the dependencies:

```sh
git clone https://github.com/dabit3/polygon-ethereum-nextjs-marketplace.git

cd polygon-ethereum-nextjs-marketplace

# install using NPM or Yarn
npm install

# or

yarn
```

2. Create a `.secret` file. Either leave it blank or paste in a test account private key if you are going to be deploying to Matic Mumbai.

_Consider using an environment variable if working on Matic Mainnet with real tokens and not storing them in a file associated with the project._

3. Start the local Hardhat node

```sh
npx hardhat node
```

4. With the network running, deploy the contracts to the local network in a separate terminal window

```sh
npx hardhat run scripts/deploy.js --network localhost
```

5. Rename __config.example.js__ to __config.js__ and copy the `nftmarketaddress` and `nftaddress` values to it.

6. Start the app

```
npm run dev
```

### Configuration

The main configuration for this project to work successfully on Polygon is located in __hardhat.config.js__:
Expand All @@ -10,6 +53,8 @@ The main configuration for this project to work successfully on Polygon is locat
require("@nomiclabs/hardhat-waffle");
const fs = require('fs');
const privateKey = fs.readFileSync(".secret").toString().trim() || "";

// infuraId is optional if you are using Infura RPC
const infuraId = fs.readFileSync(".infuraid").toString().trim() || "";

module.exports = {
Expand All @@ -19,10 +64,13 @@ module.exports = {
chainId: 1337
},
mumbai: {
// Infura
// url: `https://polygon-mumbai.infura.io/v3/${infuraId}`
url: "https://rpc-mumbai.matic.today",
accounts: [privateKey]
},
matic: {
// Infura
// url: `https://polygon-mainnet.infura.io/v3/${infuraId}`,
url: "https://rpc-mainnet.maticvigil.com",
accounts: [privateKey]
Expand Down

0 comments on commit ac18ede

Please sign in to comment.