Electron-cash: fringe feature request: simple arithmetic expressions in amount field

Created on 8 Oct 2019  路  5Comments  路  Source: Electron-Cash/Electron-Cash

I know this is a totally fringe feature, but I would love to see (very simple) arithmetic expressions in the amount field in the Send dialog. Addition, subtraction, multiplication and maybe division would completely suffice. Actually for my purpose multiplication would suffice (the "!" placeholder should still work).

Motivation: I usually select coins manually for privacy (except for low-amount merchant transactions, here I will use a non-hw-wallet cash-shuffle-enabled spending wallet). So for example when sending to an exchange, I will prefer coins received from that exchange as a first selector. If I don't have any utxos from that exchange, I will select one that has close to the amount I want to send. Now, often the whole utxo is a good amount and I will just send it as a whole (1 input 1 output tx), but sometimes it's too large and I want to send only part of it. Now I want to avoid sending round numbers like 0.5 or whatever, to not give away a huge hint as to which one of the outputs is change and which one is recipient. So usually I just hammer on the numbers on my keyboard to generate a pseudo-random string of digits after the decimal point. It would be much nicer to just be able to send 50% by entering "! * 0.5" or "! / 2" into the amount field. There might be other applications, but this is one use-case I have recurring a lot myself.

Implementation details: not sure when exactly evaluation of the expression should be done. I know entering "!" is evaluated right away. This would still work: entering "!" could fill in the utxo value and then I could continue writing the expression with the constant filled in. The other way would be to defer evaluation until user hits "enter" or somehow else removed focus from the amount field?

How to make this accessible (discoverable) for the user I don't know.

I'm willing to donate 1 BCH for this feature.

Plugins suggestion

All 5 comments

As a side-note: if implemented this might also be useful in the "pay to many" output list?

I really appreciate the suggestion but it is my feeling that this would over-complicate the code. As-is there is a technical burden in supporting that code (it can parse addresses, email addresses, cashaccounts, cointext, and other things). Adding simple expressions as well .. and potentially returning errors if the expressions don't parse correctly is going to make already-complicated code even more complicated.

This could be done as a plugin however. I'm going to leave this open as a Plugin suggestion -- but I wouldn't want to do this in mainline EC.

ok, I understand it would clobber up the code and I'm all for keeping codebase as clean as possible and cleaning up whenever possible.

I totally agree and I'm not really sad it doesn't get implemented.

If it makes you feel better I'm somewhat sad as my baseline state.. so.. sadness is normal. :P

it would overcomplicate not just the code but also the UX and possibly lead to user errors with wrong amounts of funds being sent.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imaginaryusername picture imaginaryusername  路  5Comments

ProfessorVenkman picture ProfessorVenkman  路  4Comments

uncleschaeflit picture uncleschaeflit  路  6Comments

ProfessorVenkman picture ProfessorVenkman  路  5Comments

imaginaryusername picture imaginaryusername  路  6Comments