hivewallet / hive-js

Hive digital currency wallet
http://www.hivewallet.com
GNU General Public License v2.0
81 stars 57 forks source link

Spending unconfirmed Outputs #135

Closed dabura667 closed 10 years ago

dabura667 commented 10 years ago

Spending unconfirmed shouldn't be a problem if you are requiring a 0.0001 fee for every tx.

If there is true concern of fraud, then set a limit to the sendable amount. (ie. If send amount > 20 USD (calc at current exchange rate) then don't allow spending unconfirmed. ELSE allow spending unconfirmed.)

Regardless, the current message for trying to spend unconfirmed says "Oops, you don't have enough money" or something similar.

A new user will see the balance on the top of their screen and think "wtf I have the money, why can't I spend it?"

slush has commented on why it is better to be able to spend unconfirmed in this thread for Wallet32.

https://github.com/ksedgwic/Wallet32/issues/9

Please consider at least changing the error notification to explain unconfirmed balance to the user.

(Edit: Note that my opinion in that thread was based on the presumption that Wallet32 allows setting the fee to 0 in it's main UI (not advanced mode) so there was more concern of fraud.)

mackuba commented 10 years ago

In any case, I think we could only use unconfirmed change outputs (from your own outgoing transactions) this way. Unconfirmed outputs from incoming transactions sent to you from someone else can't be relied on, because you don't know who sent them and how and if they can be trusted, am I right? So we'll need a special message for this case anyway.

dabura667 commented 10 years ago

+1 good point.

mackuba commented 10 years ago

This is how hive-osx handles it: https://github.com/hivewallet/hive-osx/issues/149#issuecomment-31825833

dabura667 commented 10 years ago

+1 Perfect. Also, I agree the link to the "why?" is a must.

Edit: You might also want to include the "Sendable Balance: x BTC" in the warning message. Remember sendable balance should be shown to user as (available balance - 0.0001) because the fee is required.

weilu commented 10 years ago

@jsuder +1 Let's share that error message & link.

@dabura667 Good point. Though, Hive web doesn't use a fixed fee. The fee is estimated according to the size of the transaction: http://bitcoin.stackexchange.com/a/3011 So it's tricky to calculate the "sendable balance". We can include the available balance in the error message though.

weilu commented 10 years ago

related: https://github.com/hivewallet/hive-js/issues/122

dabura667 commented 10 years ago

@weilu I see your point, but the solution would be to estimate:

(num_confirmed_inputs in wallet * 149) + 68 (assumed 2 outputs) + 15 bytes (just for good measure) and if ROUNDUP(that amount, thousands) is greater than 1k, then maybe display:

ex. if their Balance was 2.0528 BTC with 7 confirmed inputs and 1 unconfirmed input for 1 BTC.

Tried to send 2 BTC:

Some funds are temporarily unavailable.

To send this transaction, you'll need to wait for your pending transactions to be confirmed first (this shouldn't take more than a few minutes).
Available Balance: 1.0526 BTC

What does this mean? (link)

OK

It could also be set where if the amount of inputs is insanely large, so that the max fee calculates to 5kB or larger, then you could say if Max Fee for this wallet >= 0.5 mBTC then show on warning screen / other pop-ups "1.0523 ~ 1.0527 BTC" instead.

etc. etc.

I guess the final answer is "We could do all of this, but how much is too much for the targeted user? And how much is too little?"

weilu commented 10 years ago

I guess the final answer is "We could do all of this, but how much is too much for the targeted user? And how much is too little?"

Indeed. I believe showing available balance is sufficient here. Let's address the fee issue at one go over at #122. A quick discussion with the team suggests that we'll go with adding some kind of a "Send all I have (amount + fee)" button for the case you described

mackuba commented 10 years ago

A quick discussion with the team suggests that we'll go with adding some kind of a "Send all I have (amount + fee)" button for the case you described

Makes sense, bitcoinj also has a method for this use case called "emptyWallet" (though we don't use it in hive-osx right now).

weilu commented 10 years ago

screen shot 2014-07-01 at 3 35 34 am

Feature wise complete (with tests :D). @haustraliaer currently the link in the flash modal is not clickable because the overlay on top of it dismissed the modal. Maybe we can make a little cross on top right corner for closing the modal instead? (like what we are doing with the support form)

weilu commented 10 years ago

I decided to not include the sendable balance at all because I don't want to scare our users. "My balance says that I have 1.23BTC. Why do I only have 0.05BTC available when I just sent 0.03BTC?"

haustraliaer commented 10 years ago

Fixed the dismiss issues: https://github.com/hivewallet/hive-js/commit/9bf23c1e5ac585e10ce86b019080a903ef4d259d

Can we close this now @weilu?

weilu commented 10 years ago

Deployed on staging