question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Address Switching - Generating and using new Address in Light Wallet

See original GitHub issue

What would you like to be added:

Currently, on the Light Wallet, only index:0 addresses are used. The internal implementation of jellyfish-wallet allows multi addresses to be used. This issue calls for implementing wallet management with multi addresses supported.

  1. Listing all the active addresses within the wallet.
  2. Generating a new Address n+1 and storing the max index to know how many addresses have been generated.
  3. Discovering all addresses on the wallet via https://github.com/DeFiCh/jellyfish/blob/47c3dabe7995bbfe8e7812ea1dfd1e885a6355f7/packages/jellyfish-wallet/src/wallet.ts#L69-L77 and storing the max indexes.

Assumptions:

  • We are not using Node-like address management where all addresses are pooled together with one balance, for simplicity reasons each address is an account within the wallet system that the user can switch to.
  • We are following a Metamask like experience
  • We are not going to store all addresses like a wallet.dat file, we just need to track where the max index is.

Max Index Length determines the maximum number of activated addresses allowed in the wallet. Accounts are considered active if the address contains any transaction activity. You can always generate an address (+1). You can’t generate another address until you have activated the previous address. You active a previous address by using it. (contains any transaction activity)

  • Max Index Length = 1, only 1 default address
  • Max Index Length = 2, 2 addresses [Active, Active/In-Inactive]
  • Max Index Length = 3, 3 addresses [Active, Active, Active/In-Inactive]

image

  • Avatars of wallet are already implemented.

/area core wallet

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dwivedinalincommented, Dec 8, 2021

Acceptance Criteria: User generates new address and perform transactions from new address Android:

  • Balances > current address present > make a transaction > check whether able to add a new address
  • Balances > current address present > do not make any transaction > check whether unable to add a new address
  • Balances > current address present > make a transaction > Check whether able to add a new address > make a transaction from new address > Check whether able to add a new address
  • Balances > Refresh > Select Address > Selected address should retain
  • Logout > Login > Restore Wallet > All the addresses which were added should get restored
  • Balances > Select an Address > Current active should have active tab on display
  • Balances > Receive > Current Active address should be displayed
  • Create a new wallet > Check whether any addresses from old wallet is not displayed

iOS:

  • Balances > current address present > make a transaction > check whether able to add a new address
  • Balances > current address present > do not make any transaction > check whether unable to add a new address
  • Balances > current address present > make a transaction > Check whether able to add a new address > make a transaction from new address > Check whether able to add a new address
  • Balances > Refresh > Select Address > Selected address should retain
  • Logout > Login > Restore Wallet > All the addresses which were added should get restored
  • Balances > Select an Address > Current active should have active tab on display
  • Balances > Receive > Current Active address should be displayed
  • Create a new wallet > Check whether any addresses from old wallet is not displayed
1reaction
thedoublejaycommented, Nov 8, 2021

@fullstackninja864 yes, need to save selection

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why you should always generate new Bitcoin addresses
In order to create a new address, you need to be running your own Bitcoin node or using a non-custodial wallet, like Electrum....
Read more >
Why my wallet's BTC address keep changing? - Coin Guides
Wondering why your Bitcoin address keeps changing everytime you make a new transaction or request a payment? It is for your own privacy....
Read more >
PSA: Using paper wallets, understanding change addresses.
By creating change addresses for every transaction the unspent funds are placed in a new address where the public key has not been...
Read more >
How Create Multiple Bitcoin Wallet Address in Blockchain
how create multiple bitcoin wallet address in blockchain. This section of the wallet, found under Settings, is home to all your wallet's ......
Read more >
Does your Bitcoin wallet address change with every transaction?
Yes, it does. It automatically generate a new address for you after every transaction you make or when funds are moved between your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found