Search code examples
polygonmetamaskhardhaterc721

Mint preproduced tokenurl(file size in range 42:50 Kb) , using svg to store full metadata on chain , Erc-721 , polygon (test & main network)


1- i will start by writing the general configurations(system, version, smart contract overall idea).

2- then i will show the main problem(with small code line, that i think it need edit).

3- third part i will show what i try until now and the results

4- at the end of i will add the github link for my full code.

note: the full original code produced by mr. PatrickAlphaC.



a- general configurations(system, version, smart contract overall idea):

  • a1- operation system: opensuse leap 15.3
  • a2- hardhat version: 2.8.3
  • a3- node version: v14.18.3
  • a4- npm version: 8.3.0
  • a5- metamask wallet addone to firefox
  • a6- target block chain: polygon(main net, test net)
  • a7- smart contract overall idea: use svg to create erc-721 nft, where it's metadata totally stored on chain(the smart contract mint tokenurl to polygon chain).


b- the main problem:

every thing work good as the size of minted file (tokenurl) less than 23.8kb(small than 23.8 kb). where i target mint file that twice this size (every tokenurl equal 50kb). so when try mint tokenurl with size (23.8 Kb < size < 50 Kb) i recive next error message.

An unexpected error occurred:
   Error: ERROR processing /home/naive/demos/secondtry/deploy/01_Deploy_SVGNFT.js:
   Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"ProviderError","code":-
   32000,"_isProviderError":true}, method="estimateGas", transaction={"from":"metamask wallet address","to":"contract address",


c- what i try until now and the results:

  • c1- try set the gas limit in "hardhat.config" but did not make any effect(it was during search so i do not remmber the form or values).

  • c2- in "01_Deploy_SVGNFT" add gaslimit to tx, so the code line look like next.

    • c2-0 origonal code line before edit it: tx = await svgNFT.create(svg)
    • c2-1 code line after edit it: tx = await svgNFT.create(svg, {gasLimit: 3000000 })
    • c2-2 the result: give me some error message about wrong syntic (forum, typing)
  • c3- in "01_Deploy_SVGNFT" add gaslimit to tx, so the code line look like next.

    • c3-0 origonal code line before edit it: tx = await svgNFT.create(svg)

    • c3-1 code line after edit it: tx = await svgNFT.create({svg}, {gasLimit: 3000000 })

    • c3-2 the results:

      • 3-2-0 contract deploying, svg uploading, contract verifying, the matic value decrease in metamask wallet(gas value transfer succeed) all thing look good.
      • 3-2-1 when go to opensea there's no image appears.
      • 3-2-2 when go to polygonscan or etherscan and use token id to see the token uri it return nothing (ther's no metadata string appears, nothing appears).


d- the next github link for full code(contracts, deploy, hardhat.config.js, helper-hardhat-config.js and img folder that contains (preproduced tokenurl)

https://github.com/naive2022/onchainfork

hope help me find how can mint preproduced tokenurl(every file size is 50kb) without face this problem when use polygon test or polygon main network.


Solution

  • the final results rinkeby network can not accept(mint token url) with size above 23 kb approximately