input-output-hk / daedalus

The open source cryptocurrency wallet for ada, built to grow with the community
https://daedaluswallet.io/
Apache License 2.0
1.23k stars 297 forks source link

Allow user to send without splitting the wallet balance into more addresses #2505

Open benapetr opened 3 years ago

benapetr commented 3 years ago

I noticed Daedalus right now has some annoying feature, where it randomly (at least when it decides to auto-withdraw rewards) splits the balance by sending ADA from address A, but returns unspent ADA back to address B (both A and B belonging to same wallet, but being different addresses). From user perspective this probably doesn't matter (with exception, see *), but it does matter when you are sending from a wallet that belongs to a pool pledge, because tools like adapools.org etc. will be confused and show that stake address has multiple wallets with different amount. Also CLI scripts that verify if pledge is adhered by checking the reward address balance are broken, as the balance is now split over multiple addresses.

*When you need to send more ADA than is on single address, you need to add multiple source addresses to transaction, which IMHO increases the transaction size and has potential to increase the fee. Sending from one address is just easier from low level perspective.

Bonus question: what is the point of splitting the balance between multiple addresses? Why not just always use the primary wallet address?

CaffeinatedCM commented 3 years ago

Someone please correct me if I'm wrong, but my understanding is that this is just the way the Cardano chain works?

CaffeinatedCM commented 3 years ago

To elaborate on my above comment, my understanding (at least my best attempt at putting it to words) is that your wallet balance is actually just the sum of transaction outputs that you received and have not spent. The Ada is still inside of each of those unspent transaction outputs. When you create a new transaction, your wallet will take one (or more) of your unspent transaction outputs and use that as the input, then the output would be new transaction outputs for your destination address and back to an address you have as change.

nikolaglumac commented 3 years ago

@benapetr this is the default way cardano-wallet works and this is what Daedalus uses for creating transactions. Change/unspent amount is always returned to a newly generated change address of your wallet. There are many benefits from having your ada spread across multiple addresses - this enables you to create multiple transactions very close one to another (time-wise), it also enables you to "organize" your funds more easily (e.g. I could use an address for payments I get from person A and another one from person B).

The balance of your wallet is the sum of all of the UTXOs plus the rewards account balance.

benapetr commented 3 years ago

@nikolaglumac but as I mention this behaviour is breaking scripts and tools that observe pledge of staking pools, when I send ADA directly using RAW CLI commands, I can always send it in a way that all balance remains on a single wallet address (which is expected from pool pledge wallets). Breaking them up into many addresses may have some undesired behaviour as I described above, so it would be really useful if this "feature" could be disabled by advanced users.

benapetr commented 3 years ago

also can you elaborate on how does this help someone organize their wallet better? it's not like you can easily move your funds from one address to another within one wallet (definitely not for free anyway). I fail to see the added value from having your balance pretty much randomly split into multiple addresses, how is random splitting equal to "organizing" of your funds?

nikolaglumac commented 3 years ago

@nikolaglumac but as I mention this behaviour is breaking scripts and tools that observe pledge of staking pools, when I send ADA directly using RAW CLI commands, I can always send it in a way that all balance remains on a single wallet address (which is expected from pool pledge wallets). Breaking them up into many addresses may have some undesired behaviour as I described above, so it would be really useful if this "feature" could be disabled by advanced users.

Perhaps your script should be modified? πŸ™‚ Joking aside - I understand your point of view. However, this is not something we can easily change in Daedalus. We need this to be made configurable on the cardano-wallet side first. It is a product decision that has to be made by the product team lead by @darko-mijic. The discussions will be held, analysis will be carried out, and decisions made. I can assure you of that.

also can you elaborate on how does this help someone organize their wallet better? it's not like you can easily move your funds from one address to another within one wallet (definitely not for free anyway). I fail to see the added value from having your balance pretty much randomly split into multiple addresses, how is random splitting equal to "organizing" of your funds?

I can try...

Let's imagine I have a wallet and I regularly receive funds from person A and person B - I will provide one address to person A and another to person B. This way I can track the payments and know more easily who has sent me ada and how much total ada across multiple transactions (given that the payments are recurring).

Having your ada on different addresses does not increase the fees. This is where you are mistaking! Ada is not "on an address" but within UTXOs. You can use a single address and still, your ada will be on multiple UTXOs as each transaction will generate a new UTXO. Here's an example:

  1. I start with empty wallet and send address A to 5 people
  2. They send me 10 ADA each to this same address
  3. My wallet will consist of 5 different UTXOs which all point to the same address
  4. If I want to send all this ada then 5 inputs will be selected for the transaction and NOT one. Address != UTXO.

☝️ it would be the same if I gave 5 different addresses to these people. However, then I would know who send me ada and who didn't.

Hope this helps...

benapetr commented 3 years ago

the scripts are not mine, they belong to 3rd party, but if their website shows your pool doesn't adhere to pledge because their script is broken, delegators will go somewhere else, and that's where this becomes a problem.

Anyway, I understand logic where specific people are sending to specific address, that's same even with BTC, what I don't understand is how "random reshuffling of your balance between random addresses on random ocassions" is helping with management of wallet?

also regarding more expensive transactions - what if you get to extreme situation where you have so many UTXOs that each of them has only about 1ADA, then it won't be possible to easily make a transaction because min. transaction size is 1ADA, imagine you have wallet with 4 ADA split amongst 4 UTXO each with 1ADA, now you want to send 1.2ADA, how you do that? system would require you to pay transaction fee 0.8ADA because you can't send 1ADA from 1 UTXO and 0.2 from another, when minimal amount is 1ADA

nikolaglumac commented 3 years ago

the scripts are not mine, they belong to 3rd party, but if their website shows your pool doesn't adhere to pledge because their script is broken, delegators will go somewhere else, and that's where this becomes a problem.

Well, I guess they should be asked to fix the issue on their end as this is how the system works and whichever application depends on cardano-wallet API functions in this way...

Anyway, I understand logic where specific people are sending to specific address, that's same even with BTC, what I don't understand is how "random reshuffling of your balance between random addresses on random ocassions" is helping with management of wallet?

This is more of a question for cardano-wallet as the input selection logic is not directly implemented in Daedalus. Before Shelley, the main idea behind this was privacy preservation. This is no longer the case due to staking addresses but this will change once multi-delegation feature is finished.

also regarding more expensive transactions - what if you get to extreme situation where you have so many UTXOs that each of them has only about 1ADA, then it won't be possible to easily make a transaction because min. transaction size is 1ADA, imagine you have wallet with 4 ADA split amongst 4 UTXO each with 1ADA, now you want to send 1.2ADA, how you do that? system would require you to pay transaction fee 0.8ADA because you can't send 1ADA from 1 UTXO and 0.2 from another, when minimal amount is 1ADA

That is true but should be extremely rare. The input selection should make sure this doesn't happen.

========

I hope you do understand that I am not arguing with you nor claiming the way the system works at the moment is how it should be... Your point is completely valid and is taken seriously. I am only trying to explain how the system works and why it is like it is. There will be changes and your request is a part of them. Thank you for raising this issue and for wanting to make Cardano better - we will achieve that together πŸ™Œ

nikolaglumac commented 3 years ago

also regarding more expensive transactions - what if you get to extreme situation where you have so many UTXOs that each of them has only about 1ADA, then it won't be possible to easily make a transaction because min. transaction size is 1ADA, imagine you have wallet with 4 ADA split amongst 4 UTXO each with 1ADA, now you want to send 1.2ADA, how you do that? system would require you to pay transaction fee 0.8ADA because you can't send 1ADA from 1 UTXO and 0.2 from another, when minimal amount is 1ADA

@benapetr to be fully clear - this has nothing to do with number of addresses you use! If you send me 4 transactions of 1 ADA to the same address I would still have 4 UTXOs!

HartS commented 3 years ago

I believe I read somewhere that the wallet movement was due to privacy reasons... sending funds to new wallet addresses theoretically makes it harder to track who has what ADA and what they're doing with it. This can be a blessing, but also a curse for people using/writing software that aims to audit their ADA movement.

Furthermore, if I understand correctly, since the shelley hard fork all the wallet receiving/spending addresses are bound together by a staking key now. So I don't think this really confers any real additional privacy

benapetr commented 3 years ago

It doesn't just make it harder - it makes it impossible when wallet is not staked, because there is no staking key that interlinks individual addresses of a wallet, so 3rd party will never be able to trace down a balance of a wallet (unless it's staked).

benapetr commented 3 years ago

also - staking key is maybe created for every wallet, but registered in blockchain only when you register your wallet with some staking pool, until then the key is not visible to anyone in the blockchain.

So unstaked wallet get superior privacy - but then again this is something that should be optional. There may be use cases where user want to explicitly keep all balance on one single address in a wallet for whatever reason they may have.

PhilippeLeLong commented 3 years ago

So unstaked wallet get superior privacy

Unfortunately that is not the case, since all addresses from on wallet already contain the stake key string within each address. You could probably use the old byron addresses or enterprise addresses (CLI only afaik) to have more privacy.

benapetr commented 3 years ago

So unstaked wallet get superior privacy

Unfortunately that is not the case, since all addresses from on wallet already contain the stake key string within each address. You could probably use the old byron addresses or enterprise addresses (CLI only afaik) to have more privacy.

is there any tool that allows you to display a wallet balance when you just give it one of the wallet addresses? All tools that claim they can do this failed on unstaked wallets, it was only possible when wallet was staked. You are right that each wallet has a stake key, but only staked wallet has this key written into blockchain and publicly searchable.

HartS commented 3 years ago

@benapetr regardless of whether a tool exists right now, the stake keys are embedded in the addresses. You can use the bech32 command included in https://github.com/input-output-hk/cardano-wallet to get the stake key (the last 56 characters of the output). Someone posted an example here

I just did this for several addresses in one of my wallets and verified that the stake key portion is the same.

So if you wanted to parse the blockchain data, you could process every address which receives an input to determine what wallet they're part of. As @Klobbinger said above, you'd have to use Byron addresses to sever this link. But I don't see the advantage of this over using a different Shelley wallet for groups of transactions you don't want associated.

Regardless, this leads me to question the point of Daedalus doing all this splitting by default. It's super annoying, and to my knowledge doesn't benefit the users. Unless there's a reason for it moving into Goguen (perhaps it simplifies smart contract execution?), it seems like it just serves to scatter ADA around the blockchain.

Fight entropy, Daedalus! Make this non-standard behaviour :P

nikolaglumac commented 3 years ago

Regardless, this leads me to question the point of Daedalus doing all this splitting by default. It's super annoying, and to my knowledge doesn't benefit the users. Unless there's a reason for it moving into Goguen (perhaps it simplifies smart contract execution?), it seems like it just serves to scatter ADA around the blockchain.

@HartS please read my earlier comment https://github.com/input-output-hk/daedalus/issues/2505#issuecomment-820344343

I think you are missing the point of how UTXO accounting works - your funds are "contained" in UTXOs not addresses. The change you are proposing would need to be implemented on cardano-wallet side first: https://github.com/input-output-hk/cardano-wallet

benapetr commented 3 years ago

just a reminder I already opened this also there in cardano-wallet https://github.com/input-output-hk/cardano-wallet/issues/2614 but it's being somewhat ignored, devs over there seem way less active than here in daedalus repo.

nikolaglumac commented 3 years ago

I would not say they are less active - they are equally interested in helping our users and the community! All of us at IOHK share this same mission! We are all under a heavy load due to the Alonzo work and I am sure you will get a response from the Adrestia team soon after Alonzo is rolled out. Thanks for all the support and the patience πŸ™

akshitv1 commented 2 years ago

the scripts are not mine, they belong to 3rd party, but if their website shows your pool doesn't adhere to pledge because their script is broken, delegators will go somewhere else, and that's where this becomes a problem.

Anyway, I understand logic where specific people are sending to specific address, that's same even with BTC, what I don't understand is how "random reshuffling of your balance between random addresses on random ocassions" is helping with management of wallet?

also regarding more expensive transactions - what if you get to extreme situation where you have so many UTXOs that each of them has only about 1ADA, then it won't be possible to easily make a transaction because min. transaction size is 1ADA, imagine you have wallet with 4 ADA split amongst 4 UTXO each with 1ADA, now you want to send 1.2ADA, how you do that? system would require you to pay transaction fee 0.8ADA because you can't send 1ADA from 1 UTXO and 0.2 from another, when minimal amount is 1ADA

Hi @benapetr . How did u compose such a transaction ?