merit icon indicating copy to clipboard operation
merit copied to clipboard

CGS and coin age drop after transaction

Open disifi opened this issue 6 years ago • 1 comments

Describe the issue

CGS now depends on coin age, but when I send small part of my balance, coin age resets and my CGS drops. It happens if coins I'm sending are from one bigger transaction.

Expected behaviour

When I'm sending part of my balance, it shouldn't matter what way I received the coins. If it was in many small transactions or one huge. Coin age should be calculated better, ignoring transactions to my own wallet.

Actual behaviour

When I received higher amount of coins in one transaction (e.g. 5000), and I want to send small part of it out of my wallet (e.g. 100), transaction is split as 100 to recipient and 4900 back to me. In this process, coin age resets and my CGS drop. For example transaction cadac5e971ad255e608b591c5d291ff6701bdc7c88b8afb1c637f3a017747cde

Screenshots.

transaction

disifi avatar Nov 14 '18 22:11 disifi

@disifi -- This makes a lot of sense. I'm not sure that there is an easy solution to this problem, however.

The underpinning transaction model to Merit (and bitcoin) is such that one or more entire input must be sent as part of the TXN. If the amount of the input is greater than what you want to send, the rest will be returned to you as change.

Conditionally handling coin age for just the change transactions is potentially challenging. If for no other reason, than for the potential exploitation vector. (Nothing prevents a user from sending themselves a small amount of MRT and then re-setting coin age on the rest of their balance via the change dynamic.)

With that said, there is likely a robust way to deal with this -- it's just going to take a lot of effort. So I'd like to commit to thinking about it and discussing with other members of the core team.

adilwali avatar Jan 20 '19 18:01 adilwali