Cardanoex.Key (cardanoex v0.6.3)

The Key module helps you to work with public keys for a wallet.

Link to this section Summary

Functions

Derive an account public key for any account index. For this key derivation to be possible, the wallet must have been created from mnemonic. It is possible to use the optional purpose field to override that branch of the derivation path with different hardened derivation index. If that field is omitted, the default purpose for Cardano wallets (1852H) will be used.

Retrieve the account public key of this wallet.

Return a public key for a given role and derivation index.

Link to this section Functions

Link to this function

create_account_public_key(wallet_id, options)

@spec create_account_public_key(String.t(), map()) ::
  {:error, String.t()} | {:ok, String.t()}

Derive an account public key for any account index. For this key derivation to be possible, the wallet must have been created from mnemonic. It is possible to use the optional purpose field to override that branch of the derivation path with different hardened derivation index. If that field is omitted, the default purpose for Cardano wallets (1852H) will be used.

Note: Only Hardened indexes are supported by this endpoint.

options

Options

  • wallet_id - hex based string. 40 characters
  • index - Example: 1852H. An individual segment within a derivation path. The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.
  • format - Enum: "extended" "non_extended". Determines whether extended (with chain code) or normal (without chain code) key is requested.
  • purpose - An individual segment within a derivation path. The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.
Link to this function

get_account_public_key(wallet_id)

@spec get_account_public_key(String.t()) :: {:error, String.t()} | {:ok, String.t()}

Retrieve the account public key of this wallet.

options

Options

  • wallet_id - hex based string. 40 characters
Link to this function

get_public_key(wallet_id, role, index)

@spec get_public_key(String.t(), String.t(), String.t()) ::
  {:error, String.t()} | {:ok, String.t()}

Return a public key for a given role and derivation index.

options

Options

  • wallet_id - hex based string. 40 characters
  • role - utxo_external, utxo_internal or mutable_account"
  • index - Example: 1852H. An individual segment within a derivation path. The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.