Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing provider in hardhat network using did:ethr #1360

Open
MattiaDellOca opened this issue Mar 12, 2024 · 1 comment
Open

Missing provider in hardhat network using did:ethr #1360

MattiaDellOca opened this issue Mar 12, 2024 · 1 comment
Labels
bug Something isn't working triage

Comments

@MattiaDellOca
Copy link

Bug severity:
2

Describe the bug:
I tried to create a local development environment for Veramo v5.1.2 using did:ethr.
This was the configuration of my agent created following Veramo's guidelines:

this._agent = createAgent({
      plugins: [
...
    new DIDManager({
              store: new DIDStore(dbConnection),
              defaultProvider: "did:ethr:dev",
              providers: {
                "did:ethr:dev": new EthrDIDProvider({
                  defaultKms: "local",
                  ttl: 31104001,
                  networks: [
                    {
                      name: "dev",
                      registry: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
                      chainId: 31337,
                      rpcUrl: process.env.RPC_URL,
                    },
                  ],
                }),
              },
            }),
            new DIDResolverPlugin({
              ...ethrDidResolver({
                networks: [
                  {
                    name: "dev",
                    registry: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
                    chainId: 31337,
                    rpcUrl: process.env.RPC_URL,
                  },
                ],
              }),
            }),
...

At this phase I was able to create/resolve DIDs in my local network.

However, when I tried adding an X25519 key agreement (necessary for encrypting message when using did:ethr), I ran into the following error: Error: missing provider (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=abstract-signer/5.7.0).

To Reproduce
Steps to reproduce the behaviour:

  1. Deploy the EthereumDIDRegistry in a Hardhat local network. You can find the necessary steps here
  2. Configure your Agent integrating my previous example for the DID provider and resolver
  3. Try adding an X25519 key agreement using this:
await agent.didManagerAddKey(
  { 
    did: <your_did>, 
    key: await agent.keyManagerCreate({
      kms: "local",
      type: "X25519"
    })
  }
)

Observed behaviour
When trying to add an X25519 key agreement you will run into an error complaining about a missing provider: Error: missing provider (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=abstract-signer/5.7.0).

Expected behaviour
I would expect the key to be added correctly, as the configuration seems correct

Additional context
@mirceanis helped me solving this issue. He suggested me to remove the networks: [{<config>}] properties and move the <config> at the top level of the provider configuration. Here is my updated provider configuration:

new DIDManager({
          store: new DIDStore(dbConnection),
          defaultProvider: "did:ethr:dev",
          providers: {
            "did:ethr:dev": new EthrDIDProvider({
              defaultKms: "local",
              ttl: 31104001,
              network: "dev",
              name: "dev",
              registry: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
              rpcUrl: process.env.RPC_URL,
            }),
          },
        }),

The key addition now works correctly. Note however that when configuring a provider, [networks](networks: [{<config>}]) should be used instead of using the <config> at the top level of the provider configuration, as described here: https://github.com/decentralized-identity/veramo/blob/ab16cbdad37266f0457251f34446624fbe2ed4c9/packages/did-provider-ethr/src/ethr-did-provider.ts#L56C1-L108C2.

Following @mirceanis suggestion, I've opened this issue for tracking.

Versions:

  • Veramo: v5.1.2
  • Browser: None
  • Node Version: v18.19.0
@MattiaDellOca MattiaDellOca added the bug Something isn't working label Mar 12, 2024
Copy link

stale bot commented May 12, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 12, 2024
@stale stale bot closed this as completed May 30, 2024
@mirceanis mirceanis added triage and removed wontfix This will not be worked on labels May 30, 2024
@mirceanis mirceanis reopened this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants