Tradehub.Wallet.sign

You're seeing just the function sign, go back to Tradehub.Wallet module for more information.

Specs

sign(map(), %Tradehub.Wallet{
  address: term(),
  mnemonic: term(),
  network: term(),
  private_key: term(),
  public_key: term()
}) :: {:ok, String.t()} | {:error, String.t()}

Sign the given message by using a wallet private key, and verify the signed messaged by using the wallet public key.

Due to the nature of blockchain, the message will sign by the curve digital signature algorithm (ECDSA), with curve is secp256k1 and the hash algorithm is sha256.

Examples

iex> wallet = Tradehub.Wallet.create_wallet()
iex> Tradehub.Wallet.sign(%{message: "hello world"}, wallet)