dcrwallet icon indicating copy to clipboard operation
dcrwallet copied to clipboard

Init process optimize

Open vufon opened this issue 11 months ago • 1 comments

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

vufon avatar Jan 22 '25 19:01 vufon

Can anyone review or comment on this for me?

vufon avatar Mar 24 '25 21:03 vufon