Skip to content

[feature]: create RFQ wire messages #780

@ffranr

Description

@ffranr

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:

  1. type: ?? (tap_rfq)
  2. 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:

  1. type: ?? (tap_req_accept)
  2. 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.

  1. type: ?? (tap_req_accept)
  2. data:
    • [32*byte:rfq_id]

where:

  • rfq_id is the quote ID that they wish to reject

Metadata

Metadata

Assignees

Labels

RFQWork relating to TAP channel Request For Quote (RFQ).enhancementNew feature or request

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions