stellar-deprecated / stellard

INACTIVE. Server in the Stellar network. Maintains the distributed ledger. Introduces and validates transactions. This repo is not in active development, it is being replaced by stellar-core.
Other
270 stars 60 forks source link

Restore Partial Payments #136

Open itsseanbennett opened 10 years ago

itsseanbennett commented 10 years ago

Partial payments have their use in the network.

They are important for returning funds, and are useful for arbitrage traders.

Please consider re-introducing them, with an important change: I propose every transaction have a "DeliveredAmount" in the metadata, and we prompt developers to use this field instead of the 'Amount' field signed by the sender.

jedmccaleb commented 10 years ago

You can calculate the payment client side. This doesn't need to be in the protocol.

itsseanbennett commented 10 years ago

There may have been significant changes to markets/account balances/trust lines between the time you request information (to make the calculations), and the time your payment is submitted.

It's a really nice feature for when it is acceptable to have some of the payment go through, and not have to make any calculations beforehand / worrying about state changing before your transaction goes through.

jedmccaleb commented 10 years ago

have you ever used it?

itsseanbennett commented 10 years ago

No, my attention was never brought to them before. However, I am proposing this again since I see a use for them, and indeed I will implement them if they return.

liangran commented 10 years ago

Hi, Jed. I use it. It is really useful to do arbitrage traders. I also run the RippleFox gateway. So I suggest you to keep the feature and add a flag to account. It may call "AcceptPartialPayment", just as "rippling" feature. Of course, it should be default disabled.

xekoukou commented 10 years ago

I don't think it should be allowed to request for a transfer of an amount that is bigger that the current balance. This should always fail, even if it is a partial payment. The user always knows the minimum amount that his wallet has so a partial payment should always succeed if he keeps the transfer amount inside these limits.

liangran commented 10 years ago

Hi all, I totally agree people should not send an amount that is bigger than the current balance. The 'Partial Payment' should not be used like this. However, all you are talking about is about the payment in the same currency, like USD to USD.

The case we need 'Partial Payment' is when people do 'convert' or send 'USD' use 'CNY'. Image that you want to convert 10 USD using CNY. Before your payment, you may find 10 USD available. However, someone may fill 5 USD when you submit the payment. You can still get 5 USD if you set 'Partial payment' flag. If no 'partial payment', you get nothing but a fail transaction.

JoelKatz commented 10 years ago

@liangran @xekoukou That doesn't make any sense. Imagine a Bitcoin gateway is issuing me Bitcoins. Because they're a gateway, they're almost certain to have a large negative balance. Are you saying they shouldn't be able to issue any Bitcoins?

Say a new currency is introduced, "FOO". Everybody's "FOO" balance is zero because the currency hasn't been introduced yet. Are you saying nobody should be able to send any "FOO" at all? If so, how could you ever have new currencies?

It is perfectly routine to send assets nobody yet holds. That's how new assets get created.

xekoukou commented 10 years ago

@JoelKatz Well, yes. it is not exactly the balance you check. To be more precise, if the people trust you for "a" coins and you trust them for "b" coins, then if your balance is "c", you can transfer at maximum "c+a" coins. We would simply check whether the request of the partial payment is smaller than this.

The actual amount transferred might change significantly or even exchanged with another currency. That doesn't matter. What we gain from this is that for a hacker to misuse such a feature, he would need to "have" that amount of coins.

We check the first hop of the path, because the user already knows the maximum amount of coins he can transfer/exchange.

edit: Unfortunately , this is easily circumvented.