RAILGUN Reloaded
    Preparing search index...

    The RailgunWallet class provides functionality for managing cryptographic keys and interacting with wallet nodes in a blockchain network. It encapsulates operations related to key management, including spending, viewing, and nullifying keys, as well as deriving master public keys.

    • Key Management: Handles cryptographic keys for signing transactions, viewing encrypted data, and nullifying commitments.
    • Keystore Integration: Stores and retrieves keys securely using an optional keystore.
    • Node Interaction: Derives wallet nodes from a mnemonic phrase and interacts with them for cryptographic operations.
    • Instantiate the wallet using a mnemonic phrase and an optional node index.
    • Access cryptographic keys such as spending, viewing, and nullifying keys through provided methods.
    • Retrieve the master public key for wallet operations.
    const wallet = new RailgunWallet('your mnemonic phrase');
    const spendingPrivateKey = wallet.getSpendingPrivateKey();
    const masterPublicKey = wallet.getMasterPublicKey();

    The RailgunWallet class assumes that the wallet nodes and keystore are properly initialized. Attempting to access keys without initialization will result in errors.

    If the keystore is not initialized when accessing keys.

    Index
    • Constructs an instance of the RailgunWallet class.

      Parameters

      • mnemonic: string

        The mnemonic phrase used to derive wallet nodes.

      • index: number = 0

        The derivation index for the wallet nodes (default is 0).

      Returns RailgunWallet

    • Initializes the key pairs and related cryptographic keys for the wallet node. This method retrieves the spending key pair, nullifying key, and viewing key pair from the respective nodes, and computes the master public key using the spending public key and nullifying key. The keys are then stored in the keystore property.

      • The spendingKeyPair is used for signing transactions.
      • The nullifyingKey is used for nullifying commitments.
      • The viewingKeyPair is used for viewing encrypted data.
      • The masterPublicKey is derived from the spending public key and nullifying key.

      Returns void

    • Retrieves the spending private key from the keystore.

      Returns Uint8Array<ArrayBufferLike>

      The spending private key as a Uint8Array.

      If the keystore is not initialized.

    • Retrieves the master public key from the keystore.

      Returns Uint8Array<ArrayBufferLike>

      The master public key as a Uint8Array.

      If the keystore is not initialized.

    • Retrieves the viewing public key from the keystore.

      Returns Uint8Array<ArrayBufferLike>

      The viewing public key as a Uint8Array.

      If the keystore is not initialized.

    • Retrieves the viewing private key from the keystore.

      Returns Uint8Array<ArrayBufferLike>

      The viewing private key as a Uint8Array.

      If the keystore is not initialized.