Parent issue: #683
In this issue we finalise the RFQ wire messages golang package. Here's what we currently have in the BLIP:
Request For Quote (tap_rfq)
When a receiver wishes to receive N units of TAP asset ID asset_id, a new
p2p message tap_rfq is sent with the following structure:
- type: ?? (
tap_rfq)
- data:
- [
32*byte:rfq_id]
- [
32*byte:asset_id]
- [
BigSize:asset_amt]
- [
BigSize:suggested_rate_tick]
where:
rfq_id is a randomly generate 32-byte value to uniquely identify this RFQ
request
asset_id is the asset ID of the asset the receiver intends to receive
asset_amt is the amount of units of said asset
suggested_rate_tick is the internal unit used for asset conversions. A tick
is 1/10000th of a currency unit. It gives us up to 4 decimal places of
precision (0.0001 or 0.01% or 1 bps). As an example, if the BTC/USD rate was
$61,234.95, then we multiply that by 10,000 to arrive at the usd_rate_tick:
$61,234.95 * 10000 = 612,349,500. To convert back to our normal rate, we
decide by 10,000 to arrive back at $61,234.95.
Given valid rfq_id, we then define an tap_rfq_scid by taking the last 8
bytes of the rfq_id and interpreting them as a 64-bit integer.
Accepting Quotes (tap_rfq_accept)
If it can, then it should send tap_rfq_accept that returns the quote amount
the edge node is willing to observe to move N units of asset asset_id:
- type: ?? (
tap_req_accept)
- data:
- [
32*byte:rfq_id]
- [
BigSize:`accepted_rate_tick]
- [
BigSize:expiry_seconds]
- [
64*byte:rfq_sig]
TODO(roasbeef): tlv err where?
where:
-
rfq_id matches the existing rfq_id of a set tap_rfq
-
accepted_rate_tick is the proposed rate for the volume unit expressed in
the internal unit of a tick.
-
expiry_seconds is the amount of seconds to use for the expiry of both the
quote and the invoice
-
rfq_sig is a signature over the serialized contents of the message
Rejecting Quotes (tap_rfq_reject)
In the event that an edge node is unable to satisfy a quote request, then they
should send tap_rfq_reject, identifying the rejected quote ID. A quote might
be rejected if the channel cannot accommodate the proposed volume, or if the
edge node is unwilling to carry any HTLCs for that asset_id.
- type: ?? (
tap_req_accept)
- data:
where:
rfq_id is the quote ID that they wish to reject
Parent issue: #683
In this issue we finalise the RFQ wire messages golang package. Here's what we currently have in the BLIP:
Request For Quote (
tap_rfq)When a receiver wishes to receive
Nunits of TAP asset IDasset_id, a newp2p message
tap_rfqis sent with the following structure:tap_rfq)32*byte:rfq_id]32*byte:asset_id]BigSize:asset_amt]BigSize:suggested_rate_tick]where:
rfq_idis a randomly generate 32-byte value to uniquely identify this RFQrequest
asset_idis the asset ID of the asset the receiver intends to receiveasset_amtis the amount of units of said assetsuggested_rate_tickis the internal unit used for asset conversions. A tickis 1/10000th of a currency unit. It gives us up to 4 decimal places of
precision (0.0001 or 0.01% or 1 bps). As an example, if the BTC/USD rate was
$61,234.95, then we multiply that by 10,000 to arrive at the
usd_rate_tick:$61,234.95 * 10000 = 612,349,500. To convert back to our normal rate, wedecide by
10,000to arrive back at$61,234.95.Given valid
rfq_id, we then define antap_rfq_scidby taking the last8bytes of the
rfq_idand interpreting them as a 64-bit integer.Accepting Quotes (
tap_rfq_accept)If it can, then it should send
tap_rfq_acceptthat returns the quote amountthe edge node is willing to observe to move
Nunits of assetasset_id:tap_req_accept)32*byte:rfq_id]BigSize:`accepted_rate_tick]BigSize:expiry_seconds]64*byte:rfq_sig]TODO(roasbeef): tlv err where?
where:
rfq_idmatches the existingrfq_idof a settap_rfqaccepted_rate_tickis the proposed rate for the volume unit expressed inthe internal unit of a
tick.expiry_secondsis the amount of seconds to use for the expiry of both thequote and the invoice
rfq_sigis a signature over the serialized contents of the messageRejecting Quotes (
tap_rfq_reject)In the event that an edge node is unable to satisfy a quote request, then they
should send
tap_rfq_reject, identifying the rejected quote ID. A quote mightbe rejected if the channel cannot accommodate the proposed volume, or if the
edge node is unwilling to carry any HTLCs for that
asset_id.tap_req_accept)32*byte:rfq_id]where:
rfq_idis the quote ID that they wish to reject