Using ECDSA and EdDSA

Overview

Fireblocks workspaces support non-custodial wallets with two algorithms: MPC_ECDSA_SECP256K1 (ECDSA) and MPC_EDDSA_ED25519 (EdDSA).

Each algorithm allows the addition of different assets. For example, generating an ECDSA key set will let you add asset such as Bitcoin, or Ethereum, while generating an EdDSA key set will let you add Solana, or Algorand, for example.

A wallet can meet one of the following states:

  • Generate ECDSA keys only.
  • Generate EdDSA keys only.
  • Generate ECDSA & EdDSA keys.
  • Add EdDSA keys to an already existing ECDSA key set.
  • Add ECDSA keys to an already existing EdDSA key set.

🚧

Version Compatibility

To fully utilize an expandable wallet with your preferred algorithms, ensure that you are using Web SDK version >=12.2.0 and Mobile SDK version >=2.6.0.

Extending Your Key Set

Should you face a situation where you already have an existing key set, you can generate another key set for the different algorithm, as shown in MPC Key Generation.

Assuming you have generated an ECDSA key set, you should now trigger the key generation function with the EdDSA algorithm (MPC_EDDSA_ED25519) only.

In cases of extending your key set, you are required to make sure you have performed the same flows you have implemented for your already existing key set, that is:

  1. Backup and Recovery, as seen here. Make sure you back up the new key set after generating the keys. By default, backup enforcement is enabled and you won't be able to add assets to your newly extended key set (e.g. Solana for EdDSA) until you have backed up your key set.
  2. Multiple Devices, as seen here. In case there are multiple devices for the same wallet, and one of them has extended its key set, you are required to run the join wallet operation again, for your newly extended key set.

Retrieving the Device Keys Status

The MPC Keys Generation process is a multi-step operation that can fail or stop in the middle for various reasons, such as a network error or the end user leaving the application midway through the process. If a failure or stoppage occurs, you end up with a device and a deviceId that cannot be used until you complete the MPC key generation process.

To check the current key status for a device, there are two methods you can use:

  1. Call the getKeysStatus function on the web SDK or mobile SDK. When keyStatus returns READY, the MPC key generation process has been completed. Note that READY is the only valid final status for the key.
  2. Call the Get device key setup state endpoint. This endpoint returns the device's current status and includes some additional response parameters:
    1. SetupStatus: Returns as COMPLETE or INCOMPLETE per key that started creation on the device.
    2. Algorithm name: Returns as MPC_ECDSA_SECP256K1 or MPC_EDDSA_ED25519.
    3. backedUp: This boolean flag indicates whether the keys were backed up by any of the wallet's devices. Remember, a wallet can have multiple devices associated with it.

Note that a device's status will only return as COMPLETE when all the keys declared in its workspace have reached the COMPLETE status and the device's backup flag is set to true.

Retrieving the Wallet Key Status

You can also query a wallet's status by calling the Get wallet key setup state endpoint. The response includes the current status of all devices associated with the wallet. Note that a wallet is considered COMPLETE as long as at least one of its devices also has the COMPLETE status.

If you send a request to an incomplete wallet or device, your request will fail and Fireblocks may return error codes to provide context for the request's failure.

Setting Required Algorithms

In certain cases, you may want to set the required algorithms for the initialized wallet.

In an example of a recovery process, you may only want to recover a set of ECDSA keys.

In such scenarios, you can set the required algorithms for the recovery process:

const response = await fireblocksNCW.setWalletRequiredAlgorithms(walletId, SigningAlgorithm.MPC_ECDSA_SECP256K1)

This can usually happen in cases where a certain set of keys was backed up (ECDSA) while a different one wasn't (EdDSA) and you would still like to proceed with the recovery process.