Skip to content

Batch generate address enhancements #53

Description

@jojobyte
  • needs to check each accounts addresses for funds and generate 20 past the last address with funds for DashHd.RECEIVE & DashHd.CHANGE
  • needs to generate change addresses (m/44'/5'/0'/${DashHd.CHANGE}/0) in addition to the current receive addresses (m/44'/5'/0'/${DashHd.RECEIVE}/0)
  • needs to pre-generate accounts with some addresses when importing a phrase to start adding contacts after the last account with funds

Batch Interactions

  • Initial Wallet Creation / Page Load
    • batch generate addresses for DashHd.RECEIVE & DashHd.CHANGE
  • Send Dialog
    • selects next addressIndex for contact accountIndex >= 1 or main wallet accountIndex === 0
    • should also select next addressIndex for main account (accountIndex === 0) change
  • Receive Dialog
    • selects next addressIndex for contact accountIndex >= 1 or main wallet accountIndex === 0
  • On...
    • Receive (in websocket)
    • Or on updateAllBalances
    • Or upon opening the Receive Dialog with a new addressIndex
  • we need to check the number of stored addresses after current addressIndex at the accountIndex
    • if its less than or equal to half of the normal batch size, we should generate a new batch
    • We should also detect if the received amount is for a Change Address and generate based on that USE (DashHd.RECEIVE || DashHd.CHANGE)
let batchSize = 20; 
// accountFilteredStoredAddrs.length === 40
// addressIndex === 31
if (accountFilteredStoredAddrs.length - addressIndex <= batchSize / 2) {
  generateMoreAddresses()
}

Activity

  1. added this to the Stage 2 milestone on Feb 28, 2024
  2. self-assigned this
    on Feb 28, 2024
  3. moved this from Backlog to Ready in Wallet UI - Roadmapon Feb 28, 2024
  4. moved this from Ready to In progress in Wallet UI - Roadmapon Feb 28, 2024
  5. moved this from In progress to In review in Wallet UI - Roadmapon Mar 15, 2024
  6. jojobyte commented on Mar 15, 2024

    @jojobyte
    ContributorAuthor

    @riongull this functionality has been added but does not have any opaque visual implementation that can be seen by an end user. It should be working at https://fix-dashwallet-implementation.wallet.dashincubator.dev/.

  7. riongull commented on Mar 15, 2024

    @riongull

    @jojobyte, was there a typo in what you said here:

    needs to generate change addresses (m/44'/5'/0'/${DashHd.CHANGE}/0) in addition to the current receive addresses (m/44'/5'/0'/${DashHd.RECEIVE}/0)

    By memory I thought the BIP44 spec defined what you're calling change and receive as the last two positions in the hd path. I always forget which order, but it's certainly not the same position for each. Have you read that spec and are we implementing it at least roughly per the spec?

    Probably better to have a phone call about this, as it's pretty involved.

  8. jojobyte commented on Mar 16, 2024

    @jojobyte
    ContributorAuthor

    @jojobyte, was there a typo in what you said here:

    needs to generate change addresses (m/44'/5'/0'/${DashHd.CHANGE}/0) in addition to the current receive addresses (m/44'/5'/0'/${DashHd.RECEIVE}/0)

    By memory I thought the BIP44 spec defined what you're calling change and receive as the last two positions in the hd path. I always forget which order, but it's certainly not the same position for each. Have you read that spec and are we implementing it at least roughly per the spec?

    Probably better to have a phone call about this, as it's pretty involved.

    I have not read the spec, I've based the order off what is shown in dashhive/DashHD.js here https://github.com/dashhive/DashHD.js?tab=readme-ov-file#part-2a-hd-path-derivation and off the Constants

    let accountIndex = 0;
    let use = DashHd.RECEIVE;
    let addressIndex = 0;
    let maxTries = 3;
    let hdPartial = `m/44'/5'/${accountIndex}'/${use}`;

    If that is in fact the wrong order we've got a lot bigger of a problem because that is how DashHD.js is implementing it.

  9. riongull commented on Mar 16, 2024

    @riongull

    Please look closer at your comment (that I quoted), and the section in this screenshot from AJ's docs (that you linked to).

    image

    Your comment has both the CHANGE and RECEIVE in the same HD path position. Does you comment have a typo? I don't know because I'm not sure how you implemented account transactions. Really I just want to confirm how we implemented it, but the comment is throwing me off.

  10. riongull commented on Mar 20, 2024

    @riongull

    @jojobyte, as discussed yesterday, there is in fact no typo.

    I was overlooking that change in the HD path is just a boolean that can be 0 or 1, and if it's 0 then it's assumed that it's for receiveing, hence, they should in fact be at the same depth in the path. Your and AJ's naming convention update to usage makes more sense than the BIP change to me, but I see the argument for either.

    Go ahead and close this if everything is done.

  11. moved this from In review to Done in Wallet UI - Roadmapon Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions