Global

Members

(constant) app

Initializes the Express application by setting up middleware, routes, and other necessary configurations.

Source:

(constant) httpsServer :https.Server

Creates and configures the HTTPS server using the initialized Express application. This server is responsible for handling all incoming HTTPS requests.

Type:
  • https.Server
Source:

(constant) port :string|number

Retrieves the server port number from the environment variables, with a default value of 3000. This port number is used for the HTTPS server to listen for incoming requests.

Type:
  • string | number
Source:

Methods

(async) createUTXO(utxoData) → {Promise.<Object>}

Creates a new UTXO record in the database.

Parameters:
Name Type Description
utxoData Object

Data for the new UTXO.

Source:
Returns:

The created UTXO object.

Type
Promise.<Object>

(async) findUTXOsByAddress(address) → {Promise.<Array>}

Finds UTXOs by address.

Parameters:
Name Type Description
address string

The address to find UTXOs for.

Source:
Returns:

An array of UTXO objects.

Type
Promise.<Array>

generateChildAddress(masterPublicKey, childIndex) → {Object}

Generate a child address from the master key using a specified derivation path. This function supports generating P2WPKH addresses.

Parameters:
Name Type Description
masterPublicKey string

The master public key of the HD wallet.

childIndex number

The index of the child key to generate.

Source:
Returns:

An object containing the child address and derivation path.

Type
Object

generateHDSegWitWalletWithSeed() → {Object}

Generates a new HD wallet using BIP84 standard including the seed. Uses BIP39 for mnemonic generation and BIP32 for key derivation.

Source:
Returns:

An object containing the master public key, encrypted master private key, encrypted seed, and derivation path.

Type
Object

(async) markUTXOAsSpent(transactionHash, outputIndex) → {Promise.<Object>}

Marks a UTXO as spent.

Parameters:
Name Type Description
transactionHash string

The transaction hash of the UTXO.

outputIndex number

The output index of the UTXO.

Source:
Returns:

The updated UTXO object.

Type
Promise.<Object>

(async) selectUTXOsForAward(eventId) → {Promise.<Array>}

Selects UTXOs for awarding a winner based on the event's ID. Assumes all UTXOs associated with the event contribute to the prize pool.

Parameters:
Name Type Description
eventId string

The event's ID to select UTXOs for.

Source:
Returns:

An array of selected UTXO objects.

Type
Promise.<Array>

(async) selectUTXOsForTransaction(userId, eventId, requiredAmount) → {Promise.<Array>}

Selects UTXOs for a transaction based on specific criteria.

Parameters:
Name Type Description
userId string

The user's ID to select UTXOs for.

eventId string

The event's ID to select UTXOs for.

requiredAmount number

The minimum total amount needed from the UTXOs.

Source:
Returns:

An array of selected UTXO objects.

Type
Promise.<Array>