codingwithmanny / polygonid-on-chain-verification

20 stars 6 forks source link

Claim not found #1

Open marija-mijailovic opened 1 year ago

marija-mijailovic commented 1 year ago

Hello, I am getting the error Claim not found.

I downloaded the Polygon ID Wallet and went to verify.polygonid.com, where I scanned the QR code and followed the steps. After that, I got the claims into my Identity wallet.

After I follow up on your tutorials with the change that I want to prove that I have a "Proof of Personhood" claim, so I change set-request.js as follows:

async function main() {

  const circuitId = "credentialAtomicQuerySig";
  const validatorAddress = "0xb1e86C4c687B85520eF4fd2a0d14e81970a15aFB";

  const schemaHash = "bc17cbe68b8dd1868281dd1f23f823e1" // extracted from PID Platform

  const schemaEnd = fromLittleEndian(hexToBytes(schemaHash))

  const query = {
    schema: ethers.BigNumber.from(schemaEnd),
    slotIndex: 2, // slotIndex2 indicates the value stored as Attribute 1 inside the claim
    operator: 1,
    value: [1, ...new Array(63).fill(0).map(i => 0)], // the value must be 1 = true
    circuitId,
  };

  // add the address of the contract just deployed
  ERC20VerifierAddress = "0x28203749F2b67A1989B036d27a1Ba9003a38B5E8" //this is my deployed contract address

  let erc20Verifier = await hre.ethers.getContractAt("ERC20Verifier", ERC20VerifierAddress)

  try {
    await erc20Verifier.setZKPRequest(
      1,
      validatorAddress,
      query
    );
    console.log("Request set");
  } catch (e) {
    console.log("error: ", e);
  }
}

function hexToBytes(hex) {
  for (var bytes = [], c = 0; c < hex.length; c += 2)
      bytes.push(parseInt(hex.substr(c, 2), 16));
  return bytes;
}

function fromLittleEndian(bytes) {
  const n256 = BigInt(256);
  let result = BigInt(0);
  let base = BigInt(1);
  bytes.forEach((byte) => {
    result += base * BigInt(byte);
    base = base * n256;
  });
  return result;
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

And, also I created query request:

// Corresponding QR Code
{  
    "id":"c811849d-6bfb-4d85-936e-3d9759c7f105",
    "typ":"application/iden3comm-plain-json",
    "type":"https://iden3-communication.io/proofs/1.0/contract-invoke-request",
    "body":{
        "transaction_data":{
            "contract_address":"0x28203749F2b67A1989B036d27a1Ba9003a38B5E8", //my contract address
            "method_id":"b68967e2",
            "chain_id":80001,
            "network":"polygon-mumbai"
            },
        "reason":"airdrop participation",
        "scope":[{
            "id":1,
            "circuit_id":"credentialAtomicQuerySig",
            "rules":{
                "query":{
                    "allowed_issuers":["*"],
                    "req":{ 
                        "VerifiedPerson":{
                            "$eq":1
                            }
                        },
                    "schema":{
                            "url":"https://schema.polygonid.com/jsonld/dao.json-ld",
                            "type":"ProofOfPersonhood" 
                            }
                        }
                    }
                }]
            }
}

When I scan the QR code from the frontend, I got inside my Polygon ID wallet - claim can’t be found error.

Photo-error

Thank you in advance!

codingwithmanny commented 1 year ago

Hi @marija-mijailovic let me look on my end. I'll also be updating this repo to make it a bit easier to configure because even now there are still quite a few steps.

sanketsaboo commented 1 year ago

Any Updates here I'm getting the same error I even tried changing the qrcode url in app.tsx