ethereum / sourcify

Decentralized Solidity contract source code verification service
https://sourcify.dev
MIT License
769 stars 378 forks source link

MetadataFile.json not found when using the API endpoints of sourcify #1468

Closed saineshnakra closed 1 month ago

saineshnakra commented 1 month ago

I tried to use multiple calls to do so and I get the following error : "Verification failed: 400, {"error":"Metadata file not found. Did you include \"metadata.json\"?","message":"Metadata file not found. Did you include \"metadata.json\"?"} "

tried to do it using this json : "{ "address": "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413", "chain": "1", "files": { "metadata.json": "{\n \"compiler\": {\n \"version\": \"0.4.24+commit.e67f0147\"\n },\n \"language\": \"Solidity\",\n \"output\": {\n \"abi\": [],\n \"devdoc\": {},\n \"userdoc\": {}\n },\n \"settings\": {\n \"optimizer\": {\n \"enabled\": false,\n \"runs\": 200\n },\n \"evmVersion\": \"byzantium\"\n },\n \"sources\": {\n \"TheDAO.sol\": {\n \"content\": \"// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.4.24;\n\ncontract TheDAO {\n // Simplified version of The DAO contract\n address public owner;\n\n constructor() public {\n owner = msg.sender;\n }\n\n function contribute() public payable {\n // Contribution logic\n }\n\n function withdraw() public {\n // Withdrawal logic\n }\n}\n\"\n }\n },\n \"version\": 1\n}", "TheDAO.sol": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.4.24;\n\ncontract TheDAO {\n address public owner;\n\n constructor() public {\n owner = msg.sender;\n }\n\n function contribute() public payable {\n // Contribution logic\n }\n\n function withdraw() public {\n // Withdrawal logic\n }\n}\n" } }" just to test (This is the DAO contract, didnt reach the verify part simply said metadata doesnt exist) Am I calling it wrong or is it an issue? also tried using the web version image

am I doing something wrong or is it a bug?

kuzdogan commented 1 month ago

Hey can you please share it as a file (you can add fileName.json.txt to upload it here. From what you've pasted the JSON doesn't seem to be a valid one.

saineshnakra commented 1 month ago

Okay, I just went through it, the metadata file is not valid. Thank you