uport-project / ethr-did-registry

Ethereum registry for ERC-1056 ethr did methods
Apache License 2.0
178 stars 71 forks source link

Error at eth resolver #42

Closed anotherrohit closed 3 years ago

anotherrohit commented 3 years ago

I see this error on the resolver verifier end when I try to verify the DID created by the issuer on identifier 0xabcabc03e98e0dc2b855be647c39abe984193675

Below is the error, unable to resolve did document for did:ethr:0xabcabc03e98e0dc2b855be647c39abe984193675: unknownnetwork

the did resolver does not have a configuration for network: mainnet

I have already signed up using the projectid on the verifier. Can you please help in finding the workaround for this?

mirceanis commented 3 years ago

Can you share the configuration you are using?

andresobandoalfaro commented 3 years ago

Hi @anotherrohit @mirceanis, I resolved this by downgrading the ethr-did-resolver package to the version ^3.0.3. Hope it helps to you : )

mirceanis commented 3 years ago

I would not recommend that since that version no longer complies with the spec and so is incompatible with many other tools.

This is a configuration issue. Please share your config (while masking any private values), so we can find a solution

andresobandoalfaro commented 3 years ago

@mirceanis you were right! I was trying to use an old configuration model on the new ethr-did-resolver package version. I reproduced the error with the latest packages (did-resolver: "^3.1.3", ethr-did: "^2.1.5" and ethr-did-resolver: "^5.0.2") and solved it.

@anotherrohit to solve this problem you must be sure that the issuer includes the property chainNameOrId if you want to use a different network than the mainnet:

const chainNameOrId = 1;
const issuer = new EthrDID({
  identifier: <identifier>,
  privateKey: <private_key>,
  chainNameOrId, // if not included, mainnet (1) is assumed
});

And the resolver must be configured as follows:

const providerConfig =  {
  networks: [
    {
      chainId: 1, // <- important
      name: 'mainnet', // <- important
      rpcUrl: 'https://mainnet.infura.io/v3/<your_project_id>',
      registry: <your_registry>
    },
  ]
};

const resolver = new Resolver(getResolver(providerConfig));

In case you want to use another network, rinkeby for example:

const chainNameOrId = 4;
const issuer = new EthrDID({
  identifier: <identifier>,
  privateKey: <private_key>,
  chainNameOrId, // if not included, mainnet (1) is assumed
});

const providerConfig =  {
  networks: [
    {
      chainId: 4, // <- important
      name: 'rinkeby', // <- important
      rpcUrl: 'https://rinkeby.infura.io/v3/<your_project_id>',
      registry: <your_registry>
    },
  ]
};

const resolver = new Resolver(getResolver(providerConfig));

Hope you find this information useful!

mirceanis commented 3 years ago

That sounds about right, thank you for your reply.

@anotherrohit, I'm closing this as it seems to not be a bug. If you still can't make it work, please share your config and reopen.