Coder Social home page Coder Social logo

polygon-ethereum-nextjs-marketplace's Introduction

Full stack NFT marketplace built with Polygon, Solidity, IPFS, & Next.js

Header

This is the codebase to go along with tbe blog post Building a Full Stack NFT Marketplace on Ethereum with Polygon

Running this project

Gitpod

To deploy this project to Gitpod, follow these steps:

  1. Click this link to deploy

Open in Gitpod

  1. Import the RPC address given to you by GitPod into your MetaMask wallet

This endpoint will look something like this:

https://8545-copper-swordtail-j1mvhxv3.ws-eu18.gitpod.io/

The chain ID should be 1337. If you have a localhost rpc set up, you may need to overwrite it.

MetaMask RPC Import

Local setup

To run this project locally, follow these steps.

  1. Clone the project locally, change into the directory, and install the dependencies:
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
  1. Start the local Hardhat node
npx hardhat node
  1. With the network running, deploy the contracts to the local network in a separate terminal window
npx hardhat run scripts/deploy.js --network localhost
  1. Start the app
npm run dev

Configuration

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.

require("@nomiclabs/hardhat-waffle");
const fs = require('fs');
const privateKey = fs.readFileSync(".secret").toString().trim() || "01234567890123456789";

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

module.exports = {
  defaultNetwork: "hardhat",
  networks: {
    hardhat: {
      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]
    }
  },
  solidity: {
    version: "0.8.4",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  }
};

If using Infura, update .infuraid with your Infura project ID.

polygon-ethereum-nextjs-marketplace's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polygon-ethereum-nextjs-marketplace's Issues

Token Issue

When the owner is buying his own NFT then why does he have to pay the actual price of the NFT and not just the gas price.

Please provide the solution asap.

Thanks.

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.5.3)

I am currently following the step by step video guide and stumbled on this issue regarding the json-rpc-provider.
Has anyone been able to resolve it?

This is the full Error:

Screen Shot 2022-02-16 at 6 07 43 PM
r

This is the Index.js:

`import { ethers } from 'ethers'
import { useEffect, useState } from 'react'
import axios from 'axios'
import Web3Modal from "web3modal"

import {
nftaddress, nftmarketaddress
} from '../config'

import NFT from '../artifacts/contracts/NFT.sol/NFT.json'
import Market from '../artifacts/contracts/NFTMarket.sol/NFTMarket.json'

let rpcEndpoint = null

if (process.env.MUMBAI_URL) {
rpcEndpoint = process.env.MUMBAI_URL
}

export default function Home() {
const [nfts, setNfts] = useState([])
const [loadingState, setLoadingState] = useState('not-loaded')
useEffect(() => {
loadNFTs()
}, [])
async function loadNFTs() {
const provider = new ethers.providers.JsonRpcProvider(rpcEndpoint)
const tokenContract = new ethers.Contract(nftaddress, NFT.abi, provider)
const marketContract = new ethers.Contract(nftmarketaddress, Market.abi, provider)
const data = await marketContract.fetchMarketItems()

const items = await Promise.all(data.map(async i => {
  const tokenUri = await tokenContract.tokenURI(i.tokenId)
  const meta = await axios.get(tokenUri)
  let price = ethers.utils.formatUnits(i.price.toString(), 'ether')
  let item = {
    price,
    itemId: i.itemId.toNumber(),
    seller: i.seller,
    owner: i.owner,
    image: meta.data.image,
    name: meta.data.name,
    description: meta.data.description,
  }
  return item
}))
setNfts(items)
setLoadingState('loaded') 

}`

This is my hardhat config:

`require("dotenv").config();

// require("@nomiclabs/hardhat-etherscan");
require("@nomiclabs/hardhat-waffle");
// require("solidity-coverage");

module.exports = {
solidity: "0.8.8",
networks: {
hardhat: {
chainId: 1337
},
mumbai: {
url: process.env.MUMBAI_URL || "",
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
mainnet: {
url: process.env.MAINNET_URL || "",
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
},

// etherscan: {
// apiKey: process.env.ETHERSCAN_API_KEY,
// },
};`

This is my package.json:

{ "name": "nftix", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@nomiclabs/hardhat-ethers": "^2.0.5", "@nomiclabs/hardhat-waffle": "^2.0.2", "@openzeppelin/contracts": "^4.5.0", "axios": "^0.26.0", "chai": "^4.3.6", "dotenv": "^16.0.0", "ethereum-waffle": "^3.4.0", "ethers": "^5.5.4", "hardhat": "^2.8.4", "ipfs-http-client": "^56.0.1", "next": "12.0.10", "react": "17.0.2", "react-dom": "17.0.2", "web3modal": "^1.9.5" }, "devDependencies": { "autoprefixer": "^10.4.2", "eslint": "8.9.0", "eslint-config-next": "12.0.10", "postcss": "^8.4.6", "tailwindcss": "^3.0.22" } }

Any help would be really appreciated!!

npm run dev issue

Thank you for the tutorial. It is very clear and helpful.

When I put npm run dev as instructed in Running the app section on my console. I get this error

(base) dyn3210-198:nft-minter-tutorial marcamil$ npm run dev
npm ERR! missing script: dev`
npm ERR! A complete log of this run can be found in:

I was researching more about this issue and found it is related to package.json. I tried to find a way through but got my errors. My package.json file is attached below.

{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.2",
    "@nomiclabs/hardhat-waffle": "^2.0.1",
    "chai": "^4.3.4",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.1",
    "hardhat": "^2.6.8"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^4.3.2",
    "axios": "^0.24.0",
    "ipfs-http-client": "^50.1.2",
    "web3modal": "^1.9.4"
  }
}

Invalid BigNumber string

When I activate buyNft(nft) function, this error pops up:
index.ts:225 Uncaught (in promise) Error: invalid BigNumber string (argument="value", value="0.01", code=INVALID_ARGUMENT, version=bignumber/5.5.0)

My code is same as Dabits code. Only difference is network, my NFT is deployed on Rinkeby Test Network.

This is function:
async function buyNft(nft) {
const web3Modal = new Web3Modal()
const connection = await web3Modal.connect()
const provider = new ethers.providers.Web3Provider(connection)
const signer = provider.getSigner()
const contract = new ethers.Contract(marketplaceAddress, marketplace.abi, signer)

    const price = ethers.utils.formatUnits(nft.price.toString(), "ether")

    console.log(price)

    const transaction = await contract.callStatic.createMarketSale(nftaddress, nft.itemId,
      { value: price})
    
    await transaction.wait()
    loadNFTs()
  }

Mumbai deployment issue prevents the demo from working on Mumbai testnet

There's currently a bug on Mumbai where the deployed address is incorrectly output (NomicFoundation/hardhat#2162)

This is causing deploy.js to use the wrong address for deploying the NFT, which is causing setApprovalForAll(contractAddress, true); to be incorrect, because the NFT marketplace contract address is wrong. This is causing a problem when buying NFTs, because the market contract's address is never approved — causing lots of questions on the dev.to article.

This is happening across Infura, maticvigil, and other nodes.

Edit: the workaround here seems to get the right address: NomicFoundation/hardhat#2162 (comment)

Edit 2: The workaround deploy script works! Link: https://gist.github.com/janzheng/99813c042adb83581d0cb3b2d40d6541

Replace main() in deploy.js with:

async function main() {
  const [deployer] = await hre.ethers.getSigners();

  console.log(
    "Deploying contracts with the account:",
    deployer.address
  );

  let txHash, txReceipt
  const NFTMarket = await hre.ethers.getContractFactory("NFTMarket");
  const nftMarket = await NFTMarket.deploy();
  await nftMarket.deployed();

  txHash = nftMarket.deployTransaction.hash;
  txReceipt = await ethers.provider.waitForTransaction(txHash);
  let nftMarketAddress = txReceipt.contractAddress

  console.log("nftMarket deployed to:", nftMarketAddress);

  const NFT = await hre.ethers.getContractFactory("NFT");
  const nft = await NFT.deploy(nftMarketAddress);
  await nft.deployed();


  txHash = nft.deployTransaction.hash;
  // console.log(`NFT hash: ${txHash}\nWaiting for transaction to be mined...`);
  txReceipt = await ethers.provider.waitForTransaction(txHash);
  let nftAddress = txReceipt.contractAddress

  console.log("nft deployed to:", nftAddress);
}

Data Not Uploading to IPFS

Data not uploading to IPFS and existing IPFS URLs are returning
Public Gateway Is Not Supported Anymore - Setup a Dedicated Gateway

The data was uploading perfectly to IPFS a few days ago but now its not working
I'm using the exact code of Nader's Marketplace

Please help

new page for each NFT

Hi, I want to see and buy an NFT on it's own page, how can I implement that, I'm new to next JS. some help is really appreciated here.

First project advice

Hey guys, I've been following this project and I've managed to get the code to run but when displaying my website I am met with a user Interface that seems to not be running as intended
image

This is one of the first projects that I have undertaken and I have limited experience in coding. Any advice would be incredibly appreciated.

after npm run dev, got Error: error:0308010C:digital envelope routines::unsupported

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at BulkUpdateDecorator.hashFactory (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:133863:18)
at BulkUpdateDecorator.update (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:133764:50)
at OriginalSource.updateHash (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack-sources2\index.js:1:21039)
at NormalModule._initBuildHash (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65771:17)
at handleParseResult (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65837:10)
at D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65929:4
at processResult (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65646:11)
at D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65710:5
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at BulkUpdateDecorator.hashFactory (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:133863:18)
at BulkUpdateDecorator.update (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:133764:50)
at OriginalSource.updateHash (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack-sources2\index.js:1:21039)
at NormalModule._initBuildHash (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65771:17)
at handleParseResult (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65837:10)
at D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65929:4
at processResult (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65646:11)
at D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65710:5
node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at BulkUpdateDecorator.hashFactory (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:133863:18)
at BulkUpdateDecorator.update (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:133764:50)
at OriginalSource.updateHash (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack-sources2\index.js:1:21039)
at NormalModule._initBuildHash (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65771:17)
at handleParseResult (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65837:10)
at D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65929:4
at processResult (D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65646:11)
at D:\reactproject\polygon-ethereum-nextjs-marketplace-main\node_modules\next\dist\compiled\webpack\bundle5.js:65710:5 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Cannot fetch nft

Hi all, I've setup project as mentioned in README (local setup without changing hardhat config), then I've connected new account from metamask (should I have do something else?) then I've clicked to My Assets, and it thrown this error:

Uncaught (in promise) Error: call revert exception (method="fetchMyNFTs()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.5.0) at Logger.makeError (index.js?ffb2:185) at Logger.throwError (index.js?ffb2:194) at Interface.decodeFunctionResult (interface.js?a807:341) at Contract.eval (index.js?f179:288) at Generator.next (<anonymous>) at fulfilled (index.js?f179:5)

I am newby on Blockchain part so I dont know if there is something else I should have done, can somebody please direct me

contract.getListingPrice() Not woking it throws a Error always.

const price = ethers.utils.parseUnits(formInput.price, 'ether')
let contract = new ethers.Contract(marketplaceAddress, NFTMarketplace.abi, signer)
let listingPrice = await contract.getListingPrice()

in that above code when i try to log the listing price i got the error

image

Can anyone please help me in that how to resolve it.

Create Item page disfunction

I've made my way through the majority of the project but for some reason with my create item js file. Even though I am fairly certain my code is spot on, its as if that the create-item page was never made in the first place. Upon deploying the local host I am met with a Home page that runs as intended, but then upon clicking to the sell NFT's tab to make an NFT as he does in the video, I get a simple 404 error
image

image

Any assistance would be incredibly appreciated.

Error: nonce has already been used (error={"code":-32603...method="sendTransaction", transaction=undefined, code=NONCE_EXPIRED, version=providers/5.5.0)

I see that Hardhat throws the following:

eth_sendRawTransaction

Nonce too low. Expected nonce to be 2 but got 0.

I notice previously that hardhat sends the transaction to an address that is neither of the contract:

eth_call
WARNING: Calling an account which is not a contract
From: <<>>
To: 0x44691b39d1a75dc4e0a0346cbb15e310e6ed1e86

Any ideas on how to debug this?

NFT's name

hey guys, I have a question, base on the NFT contract file, when we create a NFT its name would be "Metaverse". isn't wrong? this way all the NFTs would have the same name. should we choose a different name for each NFT?

Error uploading file

Following local setup instruction step by step, the service is up and running.

However, when uploading an image, it prints error message as bellow in chrome console:
image

The runtime dependencies are identical with the declarations in yarn.lock.

Would anyone help fix it? Thanks in advance.

Getting Error:Transaction reverted: function selector was not recognized and there's no fallback function

I'm getting following error, and i was looking for a solution to fix this error but it's really hard to find.

I'm new to this solidity and hardhat project.
I hope to get a solution for this.
Help me please!!

Error: Transaction reverted: function selector was not recognized and there's no fallback function at NFT.<unrecognized-selector> (contracts/NFT.sol:8) at processTicksAndRejections (internal/process/task_queues.js:95:5) at HardhatNode.runCall (/Users/{myusername}/nft-test/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:503:20) at EthModule._callAction (/Users/{myusername}/nft-test/node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:353:9) at HardhatNetworkProvider._sendWithLogging (/Users{myusername}/nft-test/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:129:22) at HardhatNetworkProvider.request (/Users/{myusername}/nft-test/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:106:18) at JsonRpcHandler._handleRequest (/Users/{myusername}/nft-test/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:188:20) at JsonRpcHandler._handleSingleRequest (/Users/{myusername}/nft-test/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:167:17)

Unhandled Runtime Error on /create-item

Hey all,

running the project on gitpod with keys provided via ENV variables;

first got a problem on network connection, then changed page/index.js file as Alex Hernandez recommended:
https://dev.to/bleedingeffigy/comment/1icoi

then that error was gone and was able to init create-item.

But now, getting below error:

Source
pages/create-item.js (66:27) @ _callee3$

TypeError: Cannot read properties of undefined (reading '2')

 64 |     let tx = await transaction.wait()
  65 |     let event = tx.events[0]
> 66 |     let value = event.args[2]
....

callstack:


node_modules/regenerator-runtime/runtime.js (63:14)
Generator.invoke [as _invoke]
node_modules/regenerator-runtime/runtime.js (293:0)
Generator.eval [as next]
node_modules/regenerator-runtime/runtime.js (118:0)
asyncGeneratorStep
node_modules/next/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js (3:0)
_next
node_modules/next/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js (25:0)

the event object is as follows, there exists no args arr:

{
  "transactionIndex": 1,
  "blockNumber": 20451934,
  "transactionHash": "0x1e6050c124ef9661e0da3d99a286167f916e78de12f7d1881f967df97eac346c",
  "address": "0x0000000000000000000000000000000000001010",
  "topics": [
    "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
    "0x0000000000000000000000000000000000000000000000000000000000001010",
    "0x0000000000000000000000002ce20e0da6a3615b255b967fde213e91d58c4cc6",
    "0x000000000000000000000000c26880a0af2ea0c7e8130e6ec47af756465452e8"
  ],
  "data": "0x00000000000000000000000000000000000000000000000000003db517f0500000000000000000000000000000000000000000000000000001062a3d936de0000000000000000000000000000000000000000000000001a92c0d7078b033033c0000000000000000000000000000000000000000000000000105ec887b7d90000000000000000000000000000000000000000000000001a92c0dae2dc823533c",
  "logIndex": 2,
  "blockHash": "0x41e8e2ed9841294d59a6b3019cf82a43494100046a3a8f257659e620db59932a"
}

Design pattern with marketplace

Hi, thanks for sharing your work.
I am developing a marketplace with auction, and I am using the inheritance design pattern to develop the contracts. One main contract and two legacy contracts for auction and marketplace. I don't know if the approach I am using is the right one.
I see that your marketplace does not have inheritance, but you link them in the migration. Why did you choose this approach instead of the one I'm trying to do (it's the first time I have to split contracts and I'm not sure which is the best way).

In that case, in an inheritance of contracts how do you link them in the migrations, do you know?

thanks

Rinkeby support

It would be great if rinkeby is supported when switched to rinkeby I'm getting this error 🤔

image

/cc @dabit3

Chai tests not using assertions

I have noticed that the current tests for the smart contract are not testing the expected behavior of the smart contract. They are good, however, for showing how to use the smart contract and execute different functions in the smart contract.

Create NFT troubleshooting

Upon confirming the creation of my NFT I am met with a failed transaction notice as follows
the better one

This is my first project and I am really proud of my progress so far, I'm so close to finishing out this project so any assistance that I could get would incredibly appreciated

CORS bad request while uploading NFT

Getting this error mentioned in the image when i select the image for NFT
image

and this error when i approve the sale of the NFT from the metamask which is related to the error mentioned above. I guess the image is not being uploaded to IPFS properly
image
can someone help fix this? thanks

Error: Expected private key to be an Uint8Array with length 32

I get an error with accounts: [privateKey]

gitpod /workspace/polygon-ethereum-nextjs-marketplace $ npx hardhat run scripts/deploy.js --network matic Error: Expected private key to be an Uint8Array with length 32 at assert (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/secp256k1/lib/index.js:18:20) at isUint8Array (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/secp256k1/lib/index.js:31:7) at Object.publicKeyCreate (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/secp256k1/lib/index.js:113:7) at Object.exports.privateToPublic (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/hardhat/node_modules/ethereumjs-util/src/account.ts:272:22) at exports.privateToAddress (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/hardhat/node_modules/ethereumjs-util/src/account.ts:280:26) at LocalAccountsProvider._initializePrivateKeys (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/hardhat/src/internal/core/providers/accounts.ts:169:43) at new LocalAccountsProvider (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/hardhat/src/internal/core/providers/accounts.ts:45:10) at applyProviderWrappers (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/hardhat/src/internal/core/providers/construction.ts:178:18) at Object.createProvider (/workspace/polygon-ethereum-nextjs-marketplace/node_modules/hardhat/src/internal/core/providers/construction.ts:116:27) at /workspace/polygon-ethereum-nextjs-marketplace/node_modules/hardhat/src/internal/core/runtime-environment.ts:80:14

Here is my configuration :

const privateKeymatic = fs.readFileSync(".secret").toString().trim() || "01234567890123456789";

with in .secret file : 1xxxxxxxxxxxxxxxx....

matic: { url: "https://rpc-mumbai.maticvigil.com/v1/cb00xxxxxxxxxxxxxxxxxxxxxxxxxxxxx...", accounts: [privateKeymatic], }

I have tried everything, notably:

(https://hardhat.org/tutorial/deploying-to-a-live-network.html ) configuration recommendation.

Have you an idea about this ?

Unexpected end of JSON input

I get this error when I deploy via gitpod or locally:

{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"Parse error: Unexpected end of JSON input"}}

from http://127.0.0.1:8545/

Module not found: Can't resolve '../../config'

image

It was working fine, but then I received the error above.

I keep getting this error. I have no idea what to do. I've tried everything I can think of (I am new to this, so everything I can think of isn't much).

thanks in advance :)

Run app on testnet

Hey there, is it possible to run this on testnet so i don't have to pay any gas fees while i'm running the app in dev mode

Do not understand the logic of transfering msg.value

Hi,

I'm trying to learn solidity. I think I misunderstood something.

Here you said that :

payable(idToMarketItem[tokenId].seller).transfer(msg.value);

but just before you said that the seller is address(0) :

idToMarketItem[tokenId].seller = payable(address(0));

So what I understand is that instead of transfering the msg.value to the old owner, you transfer it to address(0). Do you want to do that or I didn't understand it correctly ?

Thank you,
Inaki

Binance smart chain

Hey everyone, please has anyone successfully deployed to the binance smart chain

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.