Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init process optimize #2459

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

vufon
Copy link

@vufon vufon commented Jan 22, 2025

Related issue: #2458
Upon the first launch, initializing and running dcrwallet requires significant time and effort from users.

  • The configuration file is neither automatically generated nor initialized with the necessary RPC values.
  • If the wallet is not created, the user must re-launch the --create command, as no solution is provided to create the wallet during the initial run.
  • The naming of RPC parameters in dcrwallet remains inconsistent with those in dcrd.
  • Dcrd rpc params: rpcuser - rpcpass
  • Dcrwallet rpc params: username - password
  • Although rpcAuthType is set to "basic," the clientCAs certificate is still checked, and a warning is issued
    "DCRW: gRPC server is configured with listeners, but no trusted client certificates exist (looked in /home/x/.dcrwallet/clients.pem)"

Although Decred provides a dcrinstall binary for quick installation and setup, there remains a need for active and comprehensive support for programs when run individually.

To address these issues:

  • Upon the first launch, the program checks whether the configuration file exists. If it does not, it automatically creates the file using sample content from sample-config.conf.
    Give notice when generating files automatically:
    "DCRW: Config file does not exist. New default file created: C:\Users\UserName\AppData\Local\Dcrwallet\dcrwallet.conf"
  • When creating the configuration file, I set the RPC parameters by retrieving information from the configuration file of the installed dcrd.
    If RPC information cannot be obtained from dcrd, provide the user with the option to run in SPV mode. The RPC username and password will be automatically generated for use in SPV mode.
    “Would you like to launch SPV mode? (If SPV mode is selected, the username and password will be automatically generated.) (n/no/y/yes) [y]: ”
    If SPV mode is enabled in the launch command (--spv), rpcuser and rpcpass are still initialized automatically if their values cannot be obtained from dcrd.
  • The program checks whether the wallet has been initialized. If it has not, it provides the user with instructions and procedures to create a wallet without requiring the command to be executed again.
    Wallet creation notice:
    “The wallet does not exist. Do you want to create a wallet now? (n/no/y/yes) [y]:
    Enter the private passphrase for your new wallet: Password
    Confirm passphrase: Password
    ….
    …..”
  • Once setup is complete, users can launch dcrwallet immediately on the same process.
    “The wallet has been created successfully. Do you want to launch dcrwallet now? (n/no/y/yes) [y]:”
  • Update the RPC parameter names in dcrwallet to ensure consistency with those in dcrd. The parameters are changed to rpcuser and rpcpassword. Legacy users who rely on the old parameters will continue to be supported for backward compatibility. However, a warning will be issued to encourage updating.
    warning msg:
    “ [WRN] DCRW: The 'username' attribute in the config file is outdated. You should update it to 'rpcuser'
    [WRN] DCRW: The 'password' attribute in the config file is outdated. You should update it to 'rpcpass'”
  • Fix the logic for checking the clientCAs certificate. Remove clientCAs checking when rpcAuthType is set to "basic."
    By implementing these solutions, the usability and consistency of dcrwallet can be significantly improved, addressing key challenges faced by users during initialization and configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant