brainwallet

Module for keys generation using a brainwallet (i.e. passphrase chosen by the user).

class Brainwallet(bip44_obj: Bip44Base)

Bases: object

Brainwallet class. It allows to generate a key pair from a passphrase chosen by the user for different coins and with different algorithms.

classmethod Generate(passhrase: str, coin_type: Bip44Coins, algo_type: BrainwalletAlgos, **algo_params: Any) Brainwallet

Generate a brainwallet from the specified passphrase and coin with the specified algorithm.

Parameters:
  • passhrase (str) – Passphrase

  • coin_type (BrainwalletCoins) – Coin type

  • algo_type (BrainwalletAlgos) – Algorithm type

  • **algo_params – Algorithm parameters, if any

Returns:

Algorithm class

Return type:

Brainwallet object

Raises:

TypeError – If algorithm type is not of a BrainwalletAlgos enumerative or coin type is not of a BrainwalletCoins enumerative

classmethod GenerateWithCustomAlgo(passhrase: str, coin_type: Bip44Coins, algo_cls: Type[IBrainwalletAlgo], **algo_params: Any) Brainwallet

Generate a brainwallet from the specified passphrase and coin with a custom algorithm.

Parameters:
  • passhrase (str) – Passphrase

  • coin_type (BrainwalletCoins) – Coin type

  • algo_cls (IBrainwalletAlgo class) – Algorithm class

  • **algo_params – Algorithm parameters, if any

Returns:

Algorithm class

Return type:

Brainwallet object

Raises:

TypeError – If algorithm type is not of a BrainwalletAlgos enumerative or coin type is not of a BrainwalletCoins enumerative

bip44_obj: Bip44Base
PublicKey() Bip44PublicKey

Return the public key.

Returns:

Bip44PublicKey object

Return type:

Bip44PublicKey object

PrivateKey() Bip44PrivateKey

Return the private key.

Returns:

Bip44PrivateKey object

Return type:

Bip44PrivateKey object