interledger / interledger-rs

An easy-to-use, high-performance Interledger implementation written in Rust
http://interledger.rs
Other
201 stars 70 forks source link

HTTP API for quoting #255

Open emschwartz opened 5 years ago

emschwartz commented 5 years ago

We should add another HTTP endpoint to get a quote for a given amount using STREAM.

gakonst commented 5 years ago

Can you elaborate on how this would work? Not sure what you mean by quoting via STREAM. Don't exchange rate APIs suffice for that?

emschwartz commented 5 years ago

This would use STREAM test packets with some fixed source amount to determine how much arrives at a particular recipient. You would pass it a payment pointer and either a source or destination amount and it would estimate the other amount.

The exchange rates API is only for the nodes local rates, whereas the quoting API is multi hop.

gakonst commented 5 years ago

We could implement this as a payment that does not touch the store. I wonder if this would require a special type of packet, similarly to echo packets, for multihop, since it requires actually routing a payment through all necessary nodes. Also this could be a DoS vector from the bandwidth level, as I could flood the connector with test payments that cost me nothing.

@kincaidoneil why thumbs down?

kincaidoneil commented 5 years ago

Might be a useful endpoint, but I'm very skeptical of using probing for determining the exchange rate while the network is in its infancy: it's very easy for intermediaries to manipulate.

I wonder if this would require a special type of packet, similarly to echo packets, for multihop, since it requires actually routing a payment through all necessary nodes. Also this could be a DoS vector from the bandwidth level, as I could flood the connector with test payments that cost me nothing.

It's supported within the existing STREAM spec: if you send a packet with a random condition to a Stream receiver (and if they're still able to decrypt the data of the packet), they respond by rejecting the packet and including response data with the amount they received. The sender can use this to determine the exchange rate. The problem is the recipient could just lie and say they didn't receive much when they actually received a lot, or intermediaries could identify the packets as probing and take a larger spread

Re: DoS vector: Also, since the packets are still normal Interledger packets, you might have to prepay for them (though after they get rejected you can get your money back)