Issue generating MPC keys, "must load certificates before validating"

While trying to generate MPC keys I’m getting an error with “must load certificates before validating”, can’t find anything in the docs nor here about what this means, any help?

Here’s the implementation I’m trying to test:

    const ncw = await FireblocksNCWFactory({
      env: 'sandbox',
      deviceId: v4(),
      messagesHandler: {
        handleOutgoingMessage: async message => {
          console.log('Outgoing message', message)
          // eslint-disable-next-line @typescript-eslint/no-unsafe-return
          return {} as any
        },
      },
      eventsHandler: {
        handleEvent: event => {
          console.log('Event', event)
        },
      },
      secureStorageProvider: new InMemorySecureStorageProvider(),
    })

    const algorithms = new Set<TMPCAlgorithm>(['MPC_CMP_ECDSA_SECP256K1'])
    const keyDescriptor = await ncw.generateMPCKeys(algorithms)

Some of the logs:

I think I figured it out :sweat_smile:

You have to implement the backend side for handling rpcs, the messagesHandler needs to be hooked to your backend, basically your frontend needs to send the message to the signerClient.NCW.invokeWalletRpc(walletId, deviceId, message) function in your backend and then send the response back so that the frontend can send it to fireblocks and keep the loop going.

I wish the documentation was a bit more clear on this instead of having to dig through the abstractions of the demos to find what needs to be done.

Hey @roberthq,

Happy that you figured this out and really thanks for the feedback. We’ll make sure to update the docs and make this clearer.

Hey @roberthq ,
Alon from Fireblocks here.
Thanks for your feedback!

At the bottom of these two sections

We refer to the implementation you’ll need to implement on the BE side :slight_smile:

Please remember to use the signer role when you delegate the RPC calls.

Please let us know if you have more questions

We are very keen to hear any additional feedback @roberthq.

Do you think scheduling a short call for us, to go over the difficulties you’ve experienced and some general feedback, would be something that you might be interested in?

Thank you for the reply, my main concern with the docs is the lack of technical examples, it does a good job of going over the concepts and explaining the steps required but it lacks examples of how it’s done.

Here are some examples:

The following page https://ncw-developers.fireblocks.com/docs/outgoingincoming-message-handling goes on great detail on the flow but the only implementation example is a snippet from the demo, if you want to know what the apiService is you have to dig through the source code of the demo to find out, the ideal solution for me would be an implementation example that relies solely on the methods available from the sdk and not on extra abstractions that only exist on the demo.

Another one is Asset Management which lacks any detail of where you get the assetId from, I’m sure someone with more familiarity with fireblocks would quickly figure it out but as a dev that just started implementing fireblocks I found it a bit lacking on context.

Generally my main suggestion would be not relying on the demo for the examples shown in the different sections and show the implementations details directly from the SDK methods that are available.

1 Like