# Wallet privatekey formats

Wallets often apply transformations to the raw privatekey to prevent the original text being exposed to malicious third parties. While this does not protect the address's balance, it does protect the address's owner from password reuse attacks. The most common wallet format used is the Kristwallet Format.

# kristwallet Format

This format is the most common format. It is most notably used by kristwallet (opens new window), KWallet (opens new window), Smallet (opens new window) and KristWeb (opens new window).

It applies the following transformations:

  • Prepend KRISTWALLET to the privatekey
  • Hash the whole string with sha256
  • Append -000

# k.lua

If you are using k.lua, you can use k.toKristWalletFormat(privatekey).

# Plain lua

This requires a sha256 API (opens new window). Example code to perform these operations would look like this:

sha256("KRISTWALLET" .. privatekey) .. "-000"

# API Format

This format is usually used by programs. It applies no transformations to the privatekey - it just sends the plain privatekey to the Krist node.

# kristwallet_username Format

This is a legacy format originally implemented in kristwallet_username (opens new window). It requires both a privatekey and a username. It is implemented in KristWeb (opens new window), and kristwallet_username (opens new window).

It applies the following transformations:

  • Prepend KRISTWALLETEXTENSION to the pre-appendhashes algorithm
  • Hash the whole string with sha256
  • Append -000;

# Plain lua

This requires a sha256 API (opens new window). Example code to perform these operations would look like this:

sha256("KRISTWALLETEXTENSION" .. sha256(sha256(username) .. "^" .. sha256(privatekey))) .. "-000"

# jwalelset format

This is a format implemented by jwalelset and KristWeb (opens new window).

It applies the following transformations:

  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256
  • Hash the whole string with sha256

# Plain lua

This requires a sha256 API (opens new window). Example code to perform these operations would look like this:

sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(sha256(privatekey))))))))))))))))))