0xPolygonID / onchain-issuer-integration-demo

Apache License 2.0
2 stars 1 forks source link

Failed after press "Approve" button, app crash unexpectedly or throws "Error generating proof" #2

Closed kervinct closed 1 year ago

kervinct commented 1 year ago

Platform: MacBook Pro(m1 pro)

Os version: macOS Ventura 13.2.1

Question description: After following the instructions list in README.md, I almost finished all but failed at the last step, after press "Approve" button in app, except crash unexpectedly, always got an "Error generating proof" page as below:

The config in run.sh list below:

ONCHAIN_ISSUER_DID=did:polygonid:polygon:mumbai:2qCU58EJgrEMFbapsV5V79MpbFjFwrYsYas9f6bma1

ONCHAIN_ISSUER_CONTRACT_ADDRESS=0xbC0F0743347a5Eb4ddb6805cf87d7e0dfeABF21d
ONCHAIN_CONTRACT_OWNER=<owner private key, ommited here>
MUMBAI_CONTRACT_STATE_ADDRESS=0x134B1BE34911E39A8397ec6289782989729807a4
MAIN_CONTRACT_STATE_ADDRESS=0xdc2A724E6bd60144Cde9DEC0A38a26C619d84B90
ONCHAIN_ISSUER_CONTRACT_BLOCKCHAIN="polygon"
ONCHAIN_ISSUER_CONTRACT_NETWORK="mumbai"

And the contracts deployment output are list below:

{
 "state": "0xd6CC01505FEf88fDAcb06a1fB1E9E3FdB88AcBA1",
 "smtLib": "0x458f216E6D7cE37BC4A1d9C549Fc849E892141de",
 "identity": "0xbC0F0743347a5Eb4ddb6805cf87d7e0dfeABF21d",
 "poseidon1": "0xFEC0C57336b4A4a9666BEDBCFFA60b377f894bBA",
 "poseidon2": "0x3d68027eE382E76daA4D75b0128F882108dD52BB",
 "poseidon3": "0xf42a65b271Bd21376Dd75566aD57f97e1c390114",
 "poseidon4": "0xBB23239f5e6092C3f90A79d5d7abb20152BDD0fA",
 "network": "mumbai"
}

Also onchain-issuer-demo server logs:

vc: {"id":"https://0665-240e-370-d2d-1f30-6f9-f8ff-fea1-b4e9.ngrok.io/api/v1/identities/did:polygonid:polygon:mumbai:2qCU58EJgrEMFbapsV5V79MpbFjFwrYsYas9f6bma1/claims/d19d71bc-d8a1-4891-bd28-a91a202d45b8","@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/iden3/claim-schema-vocab/cbade52faccea8c386bab0129c0ffffa64393849/core/jsonld/iden3proofs.jsonld","https://gist.githubusercontent.com/ilya-korotya/b06baa37453ed9aedfcb79100b84d51f/raw/balance-v1.jsonld"],"type":["VerifiableCredential","BalanceCredential"],"expirationDate":"2030-01-01T08:00:00+08:00","issuanceDate":"2023-08-15T18:56:00.040683+08:00","credentialSubject":{"balance":600000000,"id":"did:polygonid:polygon:mumbai:2qF5MSMw6YjRNjUNFo3WbaQ8WDoN8fQkxkTC13gUQK","type":"BalanceCredential"},"credentialStatus":{"id":"did:polygonid:polygon:mumbai:2qCU58EJgrEMFbapsV5V79MpbFjFwrYsYas9f6bma1/credentialStatus?revocationNonce=747931166\u0026contractAddress=80001:0xbC0F0743347a5Eb4ddb6805cf87d7e0dfeABF21d","type":"Iden3OnchainSparseMerkleTreeProof2023","revocationNonce":747931166},"issuer":"did:polygonid:polygon:mumbai:2qCU58EJgrEMFbapsV5V79MpbFjFwrYsYas9f6bma1","credentialSchema":{"id":"https://gist.githubusercontent.com/ilya-korotya/26dd57890e61c586e3fd51b4533aadc4/raw/balance-v1.json","type":"JsonSchemaValidator2018"}}
core claim: 31523748d7cc1d8457672dcc052b699c2a000000000000000000000000000000021239748c49241fb565d5f601664669cbdc9c0c0fd4ac1792a5b5582c390c006a270d83dead7ee27cf4050b1acad38d33aaaf8b597a3f4e191acd784294560600000000000000000000000000000000000000000000000000000000000000001e86942c0000000080d8db700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2023/08/15 18:56:17 [kervinctMacBookPro.local/MbQb0wokXT-000001] "POST http://localhost:3333/api/v1/identities/did:polygonid:polygon:mumbai:2qCU58EJgrEMFbapsV5V79MpbFjFwrYsYas9f6bma1/claims HTTP/1.1" from [::1]:65394 - 201 46B in 17.575222875s
2023/08/15 18:56:17 [kervinctMacBookPro.local/MbQb0wokXT-000002] "GET http://localhost:3333/api/v1/identities/did:polygonid:polygon:mumbai:2qCU58EJgrEMFbapsV5V79MpbFjFwrYsYas9f6bma1/claims/d19d71bc-d8a1-4891-bd28-a91a202d45b8 HTTP/1.1" from [::1]:65394 - 200 2714B in 8.975292ms
- wait compiling /offer...
- event compiled client and server successfully in 410 ms (1502 modules)
2023/08/15 18:56:17 [kervinctMacBookPro.local/MbQb0wokXT-000003] "GET http://localhost:3333/api/v1/identities/did:polygonid:polygon:mumbai:2qCU58EJgrEMFbapsV5V79MpbFjFwrYsYas9f6bma1/claims/offer?subject=did:polygonid:polygon:mumbai:2qF5MSMw6YjRNjUNFo3WbaQ8WDoN8fQkxkTC13gUQK&claimId=d19d71bc-d8a1-4891-bd28-a91a202d45b8 HTTP/1.1" from [::1]:65394 - 200 540B in 81.916µs
2023/08/15 18:56:32 [kervinctMacBookPro.local/MbQb0wokXT-000004] "POST http://0665-240e-370-d2d-1f30-6f9-f8ff-fea1-b4e9.ngrok.io/api/v1/agent HTTP/1.1" from 104.234.20.56:29243 - 200 3102B in 325.463166ms

I also have tried switching circuit id to Credential Atomic Query MTP On Chain but got the same error.

So what should I do for generating the proof correctly?

ilya-korotya commented 1 year ago

Hi @kervinct. Could you please, share the proof request you used for generation proof, please? You can copy the request JSON from the browser console.

ilya-korotya commented 1 year ago

Ohhh. I see why you have the error. Your on-chain issuer contract was deployed with the state contract set to 0xd6CC01505FEf88fDAcb06a1fB1E9E3FdB88AcBA1. I think you should deploy the on-chain issuer contract separately from the state contract and pass the initialized on-chain issuer contract the correct state contract address. Mumbai: 0x134B1BE34911E39A8397ec6289782989729807a4 Mainnet: 0xdc2A724E6bd60144Cde9DEC0A38a26C619d84B90

kervinct commented 1 year ago

Ohhh. I see why you have the error. Your on-chain issuer contract was deployed with the state contract set to 0xd6CC01505FEf88fDAcb06a1fB1E9E3FdB88AcBA1. I think you should deploy the on-chain issuer contract separately from the state contract and pass the initialized on-chain issuer contract the correct state contract address. Mumbai: 0x134B1BE34911E39A8397ec6289782989729807a4 Mainnet: 0xdc2A724E6bd60144Cde9DEC0A38a26C619d84B90

Thanks for your reply, I will try that and report the result as soon as possible.

kervinct commented 1 year ago

@ilya-korotya Yeah, your are right, now I can correctly generate the proof, thanks for your help!