Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overview: This is the 6th beta release of the Denaro Wallet Client by the Sycorax, featuring a range of new functionalities and improvements aimed at enhancing the overall efficiency and user experience. This release also marks 100 commits made to the gihub repo! A significant enhancement to the wallet client is the ability to view Denaro balances in real-world monetary values, available in various international fiat currencies and major cryptocurrencies, with USD set as the default. This version also introduces Denaro paper wallets, providing a secure, physical option for wallet storage. Enhancements include backup support for wallet files via the CLI and a more streamlined wallet generation process with the option of a mnemonic phrase for easier recovery. The wallet decryption process has been optimized for better efficiency in accessing and viewing wallet contents. The command-line interface has been updated with newsub-commands and options to accommodate these features. Changelog for the Denaro Wallet Client v0.0.6-beta: - Command-line Interface: - Changes: - Reorganized the command structure for wallet and address generation with a new `generate` sub-command. - The `generatewallet` sub-command has been updated to `generate wallet`. - The `generateaddress` sub-command has been updated to `generate address`. - This change simplifies the command structure and improves usability by grouping related functionalities under a single sub-command. - The `-pretty` option for the `decryptwallet` sub-command has been replaced with `-json`. - The `-filter` option has been removed from the `decryptwallet` sub-command. It has been removed in support of the `decryptwallet filter` sub-command which has the same exact functionality, dose not require a specific syntax, and is easier to use. - Updated help messages for better documentation and consistency. - New Sub-commands and Options: - A `generate paperwallet` sub-command has been added to facilitate the creation of Denaro paper wallets either by using an address that is associated with a wallet file, or directly via a private key that corresponds to a particular address (See Paper Wallet Support for more details). - A `backupwallet` sub-command has been added which allow users to create backups of their wallet files. Users can specify the filepath of a directory to save a wallet backup file. If no specific filepath is provided then wallet backup files will be saved to the `./wallets/wallet_backups/` directory by default. - A `-phrase` option has been added to the `generate wallet` sub-command to allow the creation of wallets based on a 12 word mnemonic phrase. This option will enable deterministic address generation by default, therefore it can be used to recover determinisitic addresses as long as the mnemonic phrase and password are correct. - A `-convert-to` option has been added to the `balance` sub-command which allows users to convert the monetary value of their balances to a specified currency, factoring in current exchange rates against the USD price of DNR. This option supports 161 international currencies and major cryptocurrencies, and requires three letter currency code (See New Balance Checking Features for more details). - `wallet_client.py` Changelog: - The `generateAddressHelper` and `main` functions have been slightly modified to support the creation of wallets based on a 12 word mnemonic phrase. - Added a `custom` parameter to the `ensure_wallet_directories_exist` function. This is used to create a custom directory at a specific filepath. - Various operations that are responsible for retrieving address and private key data in the `prepareTransaction` function have been moved to single `get_address_and_private_key` function. - Added console message when filtering wallet entries by origin. - Fixed various typos throughout the codebase. - Introduced a `generatePaperWallet` function to facilitate paper wallet generation. - See Paper Wallet Support for more details. - Significant improvements have been introduced to the balance checking system. - The `checkBalance` function has been updated. - Added new functions: `is_valid_currency_code` and `get_price_info` - See New Balance Checking Features for more details. - Updated various CLI sub-commands to accommodate the newly added features. - See Command-line Interface more details. - Modified the `check_args` function to accommodate changes made to the CLI. - Refactored `decryptWalletEntries` Function: - This sub-section documents the modifications and enhancements made to the `decryptWalletEntries` function, highlighting significant improvements in it's performance, efficiency, and code structure. - Addressed issues related to code verbosity and structural organization. - Resolved inefficiencies in processing large wallet files. - Implemented more concise and Pythonic determination of wallet type. - Enhanced the function's capability to handle deterministic wallets. - Refined logic for handling both encrypted and non-encrypted wallets. - Replaced the `pretty` parameter with `to_json`. - Introduced a nested function `handle_entry_decryption` for entry processing. - Introduced a nested function `filter_entries` for more efficient filtering of wallet entries. - Improved handling of specific scenarios involving sub-commands (`balance`, `send`, `generate paperwallet`). - Improved conditional output formatting based on user input. - Enhanced the mechanism for sorting and filtering fields in the output. - Removed disorganized address filtering logic. - Applied address filtering separately to generated and imported entries. - Implemented support for non-JSON output, providing a more readable format with clear differentiation between internally generated and imported entry types. - Expanded the use of `DataManipulation.secure_delete`, ensuring enhanced data security. - `wallet_generation_util.py` Changelog: - An `is_valid_mnemonic` function has been added to validate mnemonic phrases. - `data_manipulation_util.py` Changelog: - A `backup_wallet` method has been added to facilitate backing up wallet files. - `cryptographic_util.py` Changelog: - Fixed a none type error in `get_failed_attempts` method. - New Balance Checking Features: - This release of the wallet client introduces significant improvements to the balance checking system. It now allows users to view the real-world value of their Denaro (DNR) balances. Additionally, it introduces the `-convert-to` option in the `balance` sub-command, enabling users to view their balances in over 161 international currencies or the top 100 cryptocurrencies. Detailed technical information about these features are outlined below. - Modified `checkBalance` Function: - New function parameters have been introduced: - `currency_code`: This parameter is used to specify the currency in which the user wants to view the real-world value of their DNR balance. Standard currency abbreviations are used (e.g., 'USD', 'EUR', 'BTC'). - If a currency code is not provided or is invalid, USD is used by default. - `currency_symbol`: This parameter represents the symbol of the currency (e.g., '$', '€', ect...) - This function now integrates with the new `get_price_info` function to retrieve the current price of DNR in the specified currency. This price is then used to calculate the real-world value of user balances. - Improved Balance Information: - Now shows the price of the DNR and the equivalent value of user balances in the specified currency. - For JSON outputs, changes have been made to accommodate the aforementioned features. - Balance data now includes additional fields like: `{currency}_value`,`exchange_rate`, `total_balance`, and `total_{currency}_value`. - `is_valid_currency_code` Function (New): - This function checks if the user provided currency code exists in a pre-defined list of 161 international fiat and top 100 cryptocurrencies. - If the currency code is valid, it returns `True` along with the currency's symbol. This symbol is used to represent the currency in the price and balance information, ensuring readability and user familiarity. - When an unrecognized currency code is provided, the function outputs a message indicating the invalidity and defaults to USD. It then returns `False` and the symbol for USD (`$`). This behavior allows the application to continue operations with a standard currency (USD) in case of invalid user input. - `get_price_info` Function (New): - This function is responsible for fetching the current price of DNR in USD and converting it to a specified fiat or cryptocurrency. - Initially, it requests the price of DNR in USD from the CoinMarketCap API and implements a fallback mechanism using a secondary URL in case of primary API failure. - If the requested `currency_code` is 'USD' (the default option), the function immediately returns the USD price. - When the requested `currency_code` is not 'USD': - For fiat currencies, it queries the Open Exchange Rate API to obtain exchange rates for fiat currencies against USD. It then calculates and returns the price of DNR in the specified fiat currency. - For cryptocurrencies, it queries the Coincap API to obtain cryptocurrency exchange rates in USD. It then calculates and returns the price of DNR in the specified cryptocurrency. - If all API requests fail then the price of DNR will return 0. - Paper Wallet Support: - The wallet client now includes support for paper wallet generation, providing a secure and physical way to store Denaro. This release introduces two key components: a new module `paper_wallet_util.py` and a new function `generatePaperWallet` in `wallet_client.py`. The technical details and file storage mechanism of these new additions are outlined below. - Introduced a new `paper_wallet_util.py` module has been added to facilitate the creation of Denaro paper wallets. The module includes a `PaperWalletGenerator` class with two methods: - `generate_qr_code`: Generates a QR code for a given data string. Utilizes the qrcode library to create QR codes with specific properties such as error correction level and box size. - `overlay_qr_code`: Overlays the generated QR codes for the private key and public address onto a predefined paper wallet template. It includes image manipulation such as resizing QR codes, converting images to RGBA format, drawing scaled and rotated text for private key and address, and pasting QR codes at specified positions on the paper wallet template. - The front and back images used for the paper wallet template are located in the `./denaro/wallet/` directory. - Introduced a new `generatePaperWallet` function to `wallet_client.py`. This function orchestrates the paper wallet generation process. It's primary operations are listed below: - Retrieves address and private key data using the new `get_address_and_private_key` function. - Uses the `paper_wallet_util.py` module which processes address and private key data to generate the corresponding QR codes, and final paper wallet image. - Includes directory and file existence checks, and creates the necessary file paths for paper wallets. If an address - Depending on the `file_type` parameter, the function will create either a single PNG image for the front side of a paper wallet, or a PDF file which includes the front of the paper wallet on the first page and the back design on the second page. - For PDF files, it processes images for transparency, scales them to fit the letter page size, and organizes the layout for front and back pages. - Implements secure deletion of local variables and error handling to maintain data security and integrity throughout the process. - Ensures temporary file clean-up and proper saving of the final output, with console notifications about the wallet generation status. - Paper Wallet Storage: - The `generatePaperWallet` function features an organized mechanism for managing the storage and naming of generated paper wallets. This mechanism ensures that paper wallets are not only stored in an orderly manner but also named in a way that makes them easily identifiable and accessible. Detailed below is how the storage mechanism operates: - When Specifying an Address from a Wallet File: - Directory Creation: - A dedicated directory is created in `./wallets/paper_wallets`. This directory is named after the wallet file ( `./wallets/paper_wallets/[WALLET NAME]`). This dedicated directory segregates paper wallets based on their corresponding wallet files. - File Naming Convention: - Generated paper wallet files are distinctly named according to the specified address. - PNG files are name as: `[ADDRESS]_paper_wallet_front.png` - PDF files as `[ADDRESS]_paper_wallet.pdf.` - When Only a Private Key is Specified: - Centralized Storage: - In this scenario, the paper wallet is directly stored in the `./wallets/paper_wallets` directory, simplifying the storage process when no wallet file is involved. - Consistent Naming Scheme: - The naming convention for paper wallets generated from a private key mirrors the approach used for wallet file addresses. However, the [ADDRESS] in the file names is is derived directly from the provided private key, maintaining consistency across both scenarios.
- Loading branch information