Table of Contents

Class Ecdsa

Namespace
SodotSDK.Ecdsa
Assembly
Unity.Temp.dll

Class providing the functionality for the ECDSA protocol via the DKLs19 MPC protocol.

public class Ecdsa : Scheme
Inheritance
MonoBehaviour
Ecdsa
Inherited Members

Constructors

Ecdsa(string)

Initializes a new instance of the Ecdsa class.

public Ecdsa(string hostUrl)

Parameters

hostUrl string

The host URL for the Relay server.

Methods

DerivePrivateKeyFromXpriv(string, uint[])

Derives a private key from an XPUB (extended public key) using the specified derivation path.

public Task<PrivateKey> DerivePrivateKeyFromXpriv(string xpriv, uint[] derivationPath)

Parameters

xpriv string

The XPRV as a hex string.

derivationPath uint[]

The derivation path.

Returns

Task<PrivateKey>

The derived private key as a task.

DerivePubkey(EcdsaSecretShare, uint[])

Derives a public key from a EcdsaSecretShare using the specified derivation path.

public Task<EcdsaPublicKey> DerivePubkey(EcdsaSecretShare secretShare, uint[] derivationPath)

Parameters

secretShare EcdsaSecretShare

The secret share.

derivationPath uint[]

The derivation path.

Returns

Task<EcdsaPublicKey>

The derived public key as a task.

DerivePubkeyFromXpub(string, uint[])

Derives a tweaked public key from an XPUB (extended public key) using a derivation path and an optional tweak.

public Task<EcdsaPublicKey> DerivePubkeyFromXpub(string xpub, uint[] derivationPath)

Parameters

xpub string

The XPUB as a hex string.

derivationPath uint[]

The derivation path.

Returns

Task<EcdsaPublicKey>

The derived public key as a task.

ExportFullPrivateKey(Uuid, EcdsaSecretShare, KeygenId)

Exports the full private key to a single party by combining all of the secret shares.

public Task<string> ExportFullPrivateKey(Uuid uuid, EcdsaSecretShare secretShare, KeygenId keygenId)

Parameters

uuid Uuid

The room UUID.

secretShare EcdsaSecretShare

The secret share.

keygenId KeygenId

The export target keygen ID.

Returns

Task<string>

The exported private key as a hex string.

GetExportId(EcdsaSecretShare)

Gets the export ID from a secret share. The party that expects to receive the private key needs to call this function before exportFullPrivatekey. It must then transmit the ID to threshold-1 parties, this can be done in an untrusted channel (as if the parties use different keys this will break) Once the parties have the exportID of the party they want to export the private key to, the party and the threshold-1 participants need to call exportFullPrivatekey with that ID.

public Task<KeygenId> GetExportId(EcdsaSecretShare secretShare)

Parameters

secretShare EcdsaSecretShare

The secret share.

Returns

Task<KeygenId>

The export ID as a task.

GetXpub(EcdsaSecretShare)

Gets the XPUB (base58 encoded extended public key) from the EcdsaSecretShare. The Xpub can be used either via third party libraries or via DerivePubkeyFromXpub(string, uint[]) [BIP-32]: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format

public Task<EcdsaSecretShare> GetXpub(EcdsaSecretShare secretShare)

Parameters

secretShare EcdsaSecretShare

The secret share.

Returns

Task<EcdsaSecretShare>

The XPUB as a task.

ImportPrivateKeyImporter(Uuid, ushort, string, KeygenSecret, KeygenId[])

Imports a private key as an importer in the key generation process. WARNING: Private key import is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, due to a full private key being imported from a different system. Secret shares generated from imported private keys will always have the risk of the private key having been compromised in the past or in the future in case the private key is not deleted after the import operation. Importing a full private key, and sharing into a T-of-N sharing, the resultant key shares will be of the exact same public key as the full private key. This is the method that an importing party (meaning one the party in possesion of the private key) should use for receiving a key share in the new T-of-N quorum.

public Task<(EcdsaPublicKey, EcdsaSecretShare)> ImportPrivateKeyImporter(Uuid uuid, ushort threshold, string privateKeyHex, KeygenSecret keygenSecret, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

threshold ushort

The threshold value.

privateKeyHex string

The private key as a hex string.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

The array of keygen IDs.

Returns

Task<(EcdsaPublicKey, EcdsaSecretShare)>

The public key and secret share.

ImportPrivateKeyRecipient(Uuid, ushort, KeygenSecret, KeygenId[])

Imports a private key as a recipient in the key generation process. WARNING: Private key import is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, due to a full private key being imported from a different system. Secret shares generated from imported private keys will always have the risk of the private key having been compromised in the past or in the future in case the private key is not deleted after the import operation. Importing a full private key, and sharing into a T-of-N sharing, the resultant key shares will be of the exact same public key as the full private key. This is the method that a new party (meaning one that does not currently have the private key) should use for receiving a key share in the new T-of-N quorum. The method takes the same input parameters as keygen since for a new party joining the quorum the import operation is very similar to a keygen operation.

public Task<(EcdsaPublicKey, EcdsaSecretShare)> ImportPrivateKeyRecipient(Uuid uuid, ushort threshold, KeygenSecret keygenSecret, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

threshold ushort

The threshold value.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

The array of keygen IDs.

Returns

Task<(EcdsaPublicKey, EcdsaSecretShare)>

The public key and secret share.

Keygen(Uuid, ushort, ushort, KeygenSecret, KeygenId[])

Starts a distributed key generation for Ecdsa for a given number of parties and threshold.

public Task<(EcdsaPublicKey, EcdsaSecretShare)> Keygen(Uuid uuid, ushort numParties, ushort threshold, KeygenSecret keygenSecret, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

numParties ushort

Number of parties.

threshold ushort

Threshold value.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

Array of keygen IDs.

Returns

Task<(EcdsaPublicKey, EcdsaSecretShare)>

The public key and secret share.

OfflineExportFullPrivateKey(EcdsaSecretShare[])

Exports the full private key offline for a set of secret shares. Requires a threshold amount of parties to participate.

public Task<string> OfflineExportFullPrivateKey(EcdsaSecretShare[] secretShares)

Parameters

secretShares EcdsaSecretShare[]

The array of secret shares.

Returns

Task<string>

The exported private key as a hex string.

Refresh(Uuid, EcdsaSecretShare)

Refreshes the key pair by generating a new public key and secret share. Be careful to delete the EcdsaSecretShare given as input before it is certain that all devices have properly stored the fresh EcdsaSecretShare that is output. Note that the new EcdsaSecretShares may only be used with each other, attempting to use older EcdsaSecretShare with newer ones for signing will result in failure. The motivation for using refresh is to enhance security by switching the secret key material frequently, this means that an adversary will need to compromise multiple devices at the same time in order to compromise the private key.

public Task<(EcdsaPublicKey, EcdsaSecretShare)> Refresh(Uuid uuid, EcdsaSecretShare secretShare)

Parameters

uuid Uuid

The room UUID.

secretShare EcdsaSecretShare

The secret share.

Returns

Task<(EcdsaPublicKey, EcdsaSecretShare)>

The new public key and secret share.

ReshareNewParty(Uuid, ushort, KeygenSecret, KeygenId[])

Reshares the secret share to a new party with a new threshold. WARNING: Key resharing is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, as incorrect usage might lead to the detriment of the private key security. To use the feature correctly, developers using this feature must make sure that at least n - t + 1 parties of the t-of-n signing quorum delete their current shares before using the resharing of the private key. Also, after resharing, the resharing operation must not be considered complete until such deletion has occurred. Since deleting a share cannot be guaranteed cryptographically, it must be guaranteed by the software architecture (hence, by the developers using the SDK). Resharing the private key of the t-of-n quorum of signers, the resultant key shares will be of the exact same public key as the previous quorum. Resharing should be used in cases where we aim to modify the current t-of-n quorum with a new quorum with newT-of-newN signers for the same public key. This is the method that a new party (meaning one that does not currently have a key share) should use for receiving a key share in the new newT-of-newN quorum. The method takes the same input parameters as keygen since for a new party joining the quorum the reshare operation is very similar to a keygen operation. In order to receive the keygenIds of parties that are already a part of the quorum, those parties will need to call exportID() and send the result to the parties in the new quorum.

public Task<(EcdsaPublicKey, EcdsaSecretShare)> ReshareNewParty(Uuid uuid, ushort newThreshold, KeygenSecret keygenSecret, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

newThreshold ushort

The new threshold value.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

The array of keygen IDs.

Returns

Task<(EcdsaPublicKey, EcdsaSecretShare)>

The public key and secret share.

ReshareRemainingParty(Uuid, ushort, EcdsaSecretShare, KeygenId[])

Reshares the remaining party's secret share to a new threshold. WARNING: Key resharing is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, as incorrect usage might lead to the detriment of the private key security. To use the feature correctly, developers using this feature must make sure that at least n - t + 1 parties of the t-of-n signing quorum delete their current shares before using the resharing of the private key. Also, after resharing, the resharing operation must not be considered complete until such deletion has occurred. Since deleting a share cannot be guaranteed cryptographically, it must be guaranteed by the software architecture (hence, by the developers using the SDK).

public Task<(EcdsaPublicKey, EcdsaSecretShare)> ReshareRemainingParty(Uuid uuid, ushort newThreshold, EcdsaSecretShare secretShare, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

newThreshold ushort

The new threshold value.

secretShare EcdsaSecretShare

The secret share.

keygenIds KeygenId[]

The array of keygen IDs.

Returns

Task<(EcdsaPublicKey, EcdsaSecretShare)>

The public key and secret share.

Sign(Uuid, EcdsaSecretShare, MessageHash, uint[])

Sign a message with the secret share. The message must be hashed before signing, this can be done using the MessageHash class.

public Task<EcdsaSignature> Sign(Uuid uuid, EcdsaSecretShare secretShare, SodotUtils.MessageHash msgHash, uint[] derivationPath)

Parameters

uuid Uuid

The room UUID.

secretShare EcdsaSecretShare

The secret share.

msgHash SodotUtils.MessageHash

The message hash.

derivationPath uint[]

The derivation path for the key.

Returns

Task<EcdsaSignature>

The ECDSA signature.