[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bitcoin-dev
Subject:    Re: [bitcoin-dev] Civ Kit: A Peer-to-Peer Electronic Market System
From:       Chris Stewart via bitcoin-dev <bitcoin-dev () lists ! linuxfoundation ! org>
Date:       2023-05-09 15:09:16
Message-ID: CAFQwNuwDCC08jbhAE2pjqi9JFNerP00JpGo9dfzT4j8KNc_+0A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> In traditional finance, front-running is defined as "entering into an
equity trade, options or future contracts with advance knowledge of a block
transaction that will influence the price of the underlying security to
capitlize on the trade" [0]. In Bitcoin/Civkit parlance, a front-running
could be a board on the discovery of a batch of market offers increasing
liquidity for a fiat-2-btc pair, seizing the opportunity by forwarding a
HTLC across a Lightning payment path to enter into the trade, before
publishing the offer on its board.

To summarize, assume we have Mary the Maker, Terry the Taker, and Bob the
bulletin board operator

1. Mary the Maker publishes a limit order to buy a derivative
2. Bob the bulletin board operator has the option to execute against Mary's
order
3. If Bob doesn't want to execute against the order, he relays the order to
Terry the Taker (and other subscribers to Bob's market)
4. Terry has the option to execute a trade against Mary's limit order
5. If Terry decides not to execute, Mary's order sits on the bulletin board.

I personally don't think this is that big of a concern, if Bob can collect
outsized profits from his trusted position as the bulletin board operator,
Terry will eventually move to other markets because Bob is only relaying
what Bob perceives to be unprofitable orders.

From the perspective of Mary, she is happy. Her order got executed at the
price she specified. Terry is the one that loses here. This model ends up
looking much more like a brokerage rather than an exchange market
structure. Terry should open up his own brokerage (bulletin board) and
compete on quoting prices with Bob.

Bob and Terry can then be compared on metrics like execution quality
<https://clearingcustody.fidelity.com/trade-execution-quality>, which then
draws more market activity since they are providing better prices.

> Somehow mass front-running on the board is a "champagne" issue I'll be
happy to have.

This. Frontrunning is a good problem to have, that means your market has
active participants and liquidity. Finding what products people are
interested in trading, and giving them a good user experience is more
important. Everything else will fall in line after that.


On Mon, May 1, 2023 at 1:06 PM Antoine Riard via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:

> Hi all,
> 
> One of the most relevant feedback I received on the paper publication was the lack \
> of underscoring front-running resistance as a fundamental property wished for a \
> peer-to-peer marketplace. 
> It is expected the level of front-running resistance aimed by the market \
> participants to be heavily functioned by the types of trades considered: fiat \
> currencies, real goods, services. For some classes of goods, e.g commodities one \
> cannot expect the same level of item liquidity due to cycle of production and \
> exogenous factors like weather. Some types of trades marketplaces might be exposed \
> to far less front-running risks and rather would have to deal with accurate risk \
> modelling of the underlying goods. E.g attest there is a decentralized identifier \
> or any other linkage proof of the physical good existence staying valid for the \
> duration of offer lifetime. Offers conditions themselves might be far more verbose \
> and precise special Bitcoin Script paths to morph the shipment risks. 
> On the other hand, the types of trades like fiat currencies or bitcoin financial \
> contracts (e.g discreet log contracts or submarine swaps), front-running risk by \
> the bulletin board sounds a qualified concern. In traditional finance, \
> front-running is defined as "entering into an equity trade, options or future \
> contracts with advance knowledge of a block transaction that will influence the \
> price of the underlying security to capitlize on the trade" [0]. In Bitcoin/Civkit \
> parlance, a front-running could be a board on the discovery of a batch of market \
> offers increasing liquidity for a fiat-2-btc pair, seizing the opportunity by \
> forwarding a HTLC across a Lightning payment path to enter into the trade, before \
> publishing the offer on its board. 
> I think you have at least two security paradigms to mitigate front-running \
> happening peer-to-peer marketplace. The first one is to duplicate the announcement \
> of the offers to a number of concurrent board operated by independent identities \
> and in parallel monitor the latency. Latency anomalies should be spotted on by \
> watchtower-like infrastructure at the service of makers/takers and in case of \
> repeated anomalies a maker should disqualify the misbehaving board from future \
> announcements. As all statistical mitigation it is not perfect and open the way to \
> some margin of exploitation by the boards, as the watchtower monitoring frequency \
> can be guessed. Additionally, this latency monitoring paradigm sounds to be valid \
> under the assumption that at least one board is "honest" and board might have a \
> holistic interest to silently collude. Running or accessing monitoring \
> infrastructure comes with a new liveliness requirement or additional cost for \
> mobile clients. 
> Another paradigm can be to run the bulletin boards as a federation e.g under Honey \
> Badger BFT as used by Fedimint [1]. The incoming board offers become consensus \
> items that must be announced to all the federations members onion gateway and which \
> are not announced before a consensus proposal has been adopted. The e-cash tokens \
> can be rather Bitcoin-paid credentials required by the board federation for \
> publication. The federation members earn an income as a group to follow the \
> consensus rules and be paid only when there is "consensus" publication. The \
> federation could adopt some "DynFed" techniques to extend the federation set [2]. \
> One can imagine a federation consisting of all the significant market participants, \
> leveling the field for all. 
> Is there another security paradigm direction to mitigate front-running and other \
> asymmetries of information ? I can't immediately imagine more though I believe it \
> stays an interesting open question. 
> In fine, the Civkit proposes a flexible framework for peer-to-peer marketplace, \
> where propagation latency monitoring and federation set and rules can be tweaked as \
> "front-running resistance" parameters, adapting to the types of trades and market \
> participants tolerance. Configuration of those parameters will at the end be \
> function of real-world deployments. Somehow mass front-running on the board is a \
> "champagne" issue  I'll be happy to have. 
> Best,
> Antoine
> 
> [0] https://www.finra.org/investors/insights/getting-speed-high-frequency-trading
> [1] https://fedimint.org/docs/CommonTerms/HBBFTConsensus
> [2] https://blockstream.com/assets/downloads/pdf/liquid-whitepaper.pdf
> 
> 
> Le jeu. 13 avr. 2023 Ã  15:10, Antoine Riard <antoine.riard@gmail.com> a
> écrit :
> 
> > Hi list,
> > 
> > We have been working since a while with Nicholas Gregory (Commerce
> > Block), Ray Youssef (the Built With Bitcoin foundation) and few others on a
> > new peer-to-peer market system to enable censorship-resistant and
> > permissionless global trading in all parts of the world. While the design
> > aims in priority to serve on-ramp/off-ramp trading, it can be extended to
> > support any kind of trading: goods, services, bitcoin financial derivatives
> > like discreet log contracts.
> > 
> > The design combines the Nostr architecture of simple relays announcing
> > trade orders to their clients with Lightning onion routing infrastructure,
> > therefore granting high-level of confidentiality to the market
> > participants. The market boards are Nostr relays with a Lightning gateway,
> > each operating autonomously and in competition. The market boards can be
> > runned as a federation however there is no "decentralized orderbook" logged
> > into the blockchain. The trades are escrowed under Bitcoin Script
> > contracts, relying on moderations and know your peer oracles for
> > adjudication.
> > 
> > The scoring of trades, counterparties and services operators should be
> > enabled by the introduction of a Web-of-Stakes, assembled from previous
> > ideas [0]. From the Bitcoin UTXO set servicing as a trustless source of
> > truth, an economic weight can be assigned to each market entity. This
> > reputation paradigm could be composed with state-of-the-art Web-of-Trust
> > techniques like decentralized identifiers [1].
> > 
> > A consistent incentive framework for service operators is proposed by the
> > intermediary of privacy-preserving credentials backed by Bitcoin payments,
> > following the lineaments of IETF's Privacy Pass [2]. Services operators
> > like market boards and oracles are incentivized to thrive for efficiency,
> > akin to routing hops on Lightning and miners on the base layer.
> > 
> > The whitepaper goes deep in the architecture of the system [3] (Thanks to
> > the peer reviewers!).
> > 
> > We'll gradually release code and modules, extensively building on top of
> > the Lightning Dev Kit [4] and Nostr libraries. All according to the best
> > Bitcoin open-source and decentralized standards established by Bitcoin Core
> > and we're looking forward to collaborating with everyone in the community
> > to standardize libraries and guarantee interoperability between clients
> > with long-term thinking.
> > 
> > Feedback is very welcome!
> > 
> > Cheers,
> > Nick, Ray and Antoine
> > 
> > [0]
> > https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-November/002884.html
> >  [1] https://www.w3.org/TR/2022/REC-did-core-20220719/
> > [2] https://privacypass.github.io
> > [3] https://github.com/civkit/paper/blob/main/civ_kit_paper.pdf
> > [4] https://lightningdevkit.org
> > 
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
> 


[Attachment #5 (text/html)]

<div dir="ltr"><div><font face="arial, sans-serif"><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000">&gt;</font><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">In traditional finance, front-running is defined as \
&quot;entering into an equity trade, options or future contracts with advance \
knowledge of a block transaction that will influence the price of the underlying \
security to capitlize on the trade&quot; [0]. In Bitcoin/Civkit parlance, a \
front-running could be a board on the discovery of a batch of market offers \
increasing liquidity for a fiat-2-btc pair, seizing the opportunity by forwarding a \
HTLC across a Lightning payment path to enter into the trade, before publishing the \
offer on its board.</span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap"><br></span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">To summarize, assume we have Mary the Maker, Terry the \
Taker, and Bob the bulletin board operator</span></font></font></div><div><font \
face="arial, sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" \
color="#000000"><span \
style="white-space:pre-wrap"><br></span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">1. Mary the Maker publishes a limit order to buy a \
derivative</span></font></font></div><div><font face="arial, sans-serif"><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">2. Bob the bulletin board operator has the option to \
execute against Mary&#39;s order</span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">3. If Bob doesn&#39;t want to execute against the order, \
he relays the order to Terry the Taker (and other subscribers to Bob&#39;s \
market)</span></font></font></div><div><font face="arial, sans-serif"><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">4. Terry has the option to execute a trade against \
Mary&#39;s limit order<br></span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">5. If Terry decides not to execute, Mary&#39;s order \
sits on the bulletin board.</span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap"><br></span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">I personally don&#39;t think this is that big of a \
concern, if Bob can collect outsized profits from his trusted position as the \
bulletin board operator, Terry  will eventually move to other markets because Bob is \
only relaying what Bob perceives to be unprofitable \
orders.</span></font></font></div><div><font face="arial, sans-serif"><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap"><br></span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">From the perspective of Mary, she is happy. Her order \
got executed at the price she specified. Terry is the one that loses here. This model \
ends up looking much more like a brokerage rather than an exchange market structure. \
Terry should open up his own brokerage (bulletin board) and compete on quoting prices \
with Bob. </span></font></font></div><div><font face="arial, sans-serif"><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap"><br></span></font></font></div>Bob and Terry can then be \
compared on metrics like <a \
href="https://clearingcustody.fidelity.com/trade-execution-quality">execution \
quality</a>, which then draws more market activity since they are providing better \
prices.<br><div><div><font face="arial, sans-serif"><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap"><br></span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" \
color="#000000">&gt;</font><font style="--darkreader-inline-color: #e8e6e3;" \
color="#000000"><span style="white-space:pre-wrap">Somehow mass front-running on the \
board is a &quot;champagne&quot; issue  I&#39;ll be happy to \
have.</span></font></font></div><div><font face="arial, sans-serif"><font \
style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap"><br></span></font></font></div><div><font face="arial, \
sans-serif"><font style="--darkreader-inline-color: #e8e6e3;" color="#000000"><span \
style="white-space:pre-wrap">This. Frontrunning is a good problem to have, that means \
your market has active participants and liquidity. Finding what products people are \
interested in trading, and giving them a good user experience is more important. \
Everything else will fall in line after that. \
<br></span></font></font></div><div><br></div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 1, 2023 at \
1:06 PM Antoine Riard via bitcoin-dev &lt;<a \
href="mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.linuxfoundation.org</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><pre \
style="overflow-wrap: break-word;"><font face="arial, sans-serif"><font \
color="#000000"><span style="white-space:pre-wrap">Hi all,

One of the most relevant feedback I received on the paper publication was the lack of \
underscoring front-running resistance as a fundamental property wished for a \
peer-to-peer marketplace.

It is expected the level of front-running resistance aimed by the market participants \
to be heavily functioned by the types of trades considered: fiat currencies, real \
goods, services. For some classes of goods, e.g commodities one cannot expect the \
same level of item liquidity due to cycle of production and exogenous factors like \
weather. Some types of trades marketplaces might be exposed to far less front-running \
risks and rather would have to deal with accurate risk modelling of the underlying \
goods. E.g attest there is a decentralized identifier or any other linkage proof of \
the physical good existence staying valid for the duration of offer lifetime. Offers \
conditions themselves might be far more verbose and precise special Bitcoin Script \
paths to morph the shipment risks.

On the other hand, the types of trades like fiat currencies or bitcoin financial \
contracts (e.g discreet log contracts or submarine swaps), front-running risk by the \
bulletin board sounds a qualified concern. In traditional finance, front-running is \
defined as &quot;entering into an equity trade, options or future contracts with \
advance knowledge of a block transaction that will influence the price of the \
underlying security to capitlize on the trade&quot; [0]. In Bitcoin/Civkit parlance, \
a front-running could be a board on the discovery of a batch of market offers \
increasing liquidity for a fiat-2-btc pair, seizing the opportunity by forwarding a \
HTLC across a Lightning payment path to enter into the trade, before publishing the \
offer on its board.

I think you have at least two security paradigms to mitigate front-running happening \
peer-to-peer marketplace. The first one is to duplicate the announcement of the \
offers to a number of concurrent board operated by independent identities and in \
parallel monitor the latency. Latency anomalies should be spotted on by \
watchtower-like infrastructure at the service of makers/takers and in case of \
repeated anomalies a maker should disqualify the misbehaving board from future \
announcements. As all statistical mitigation it is not perfect and open the way to \
some margin of exploitation by the boards, as the watchtower monitoring frequency can \
be guessed. Additionally, this latency monitoring paradigm sounds to be valid under \
the assumption that at least one board is &quot;honest&quot; and board might have a \
holistic interest to silently collude. Running or accessing monitoring infrastructure \
comes with a new liveliness requirement or additional cost for mobile clients.

Another paradigm can be to run the bulletin boards as a federation e.g under Honey \
Badger BFT as used by Fedimint [1]. The incoming board offers become consensus items \
that must be announced to all the federations members onion gateway and which are not \
announced before a consensus proposal has been adopted. The e-cash tokens can be \
rather Bitcoin-paid credentials required by the board federation for publication. The \
federation members earn an income as a group to follow the consensus rules and be \
paid only when there is &quot;consensus&quot; publication. The federation could adopt \
some &quot;DynFed&quot; techniques to extend the federation set [2]. One can imagine \
a federation consisting of all the significant market participants, leveling the \
field for all.

Is there another security paradigm direction to mitigate front-running and other \
asymmetries of information ? I can&#39;t immediately imagine more though I believe it \
stays an interesting open question.

In fine, the Civkit proposes a flexible framework for peer-to-peer marketplace, where \
propagation latency monitoring and federation set and rules can be tweaked as \
&quot;front-running resistance&quot; parameters, adapting to the types of trades and \
market participants tolerance. Configuration of those parameters will at the end be \
function of real-world deployments. Somehow mass front-running on the board is a \
&quot;champagne&quot; issue  I&#39;ll be happy to have.

Best,
Antoine

[0] <a href="https://www.finra.org/investors/insights/getting-speed-high-frequency-trading" \
target="_blank">https://www.finra.org/investors/insights/getting-speed-high-frequency-trading</a>
 [1] <a href="https://fedimint.org/docs/CommonTerms/HBBFTConsensus" \
target="_blank">https://fedimint.org/docs/CommonTerms/HBBFTConsensus</a> [2] <a \
href="https://blockstream.com/assets/downloads/pdf/liquid-whitepaper.pdf" \
target="_blank">https://blockstream.com/assets/downloads/pdf/liquid-whitepaper.pdf</a></span></font></font></pre></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">Le  jeu. 13 avr. 2023 Ã   \
15:10, Antoine Riard &lt;<a href="mailto:antoine.riard@gmail.com" \
target="_blank">antoine.riard@gmail.com</a>&gt; a écrit  :<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi list,<div><br></div><div>We have \
been working since a while with Nicholas Gregory (Commerce Block), Ray Youssef (the \
Built With Bitcoin foundation) and few others on a new peer-to-peer market system to \
enable censorship-resistant and permissionless global trading in all parts of the \
world. While the design aims in priority to serve on-ramp/off-ramp trading, it can be \
extended to support any kind of trading: goods, services, bitcoin financial \
derivatives like discreet log contracts.</div><div><br></div><div>The design combines \
the Nostr architecture of simple relays announcing trade orders to their clients with \
Lightning onion routing infrastructure, therefore granting high-level of \
confidentiality to the market participants. The market boards are Nostr relays with a \
Lightning gateway, each operating autonomously and in competition. The market boards \
can be runned as a federation however there is no &quot;decentralized orderbook&quot; \
logged into the blockchain. The trades are escrowed under Bitcoin Script contracts, \
relying on moderations and know your peer oracles for \
adjudication.</div><div><br></div><div>The scoring of trades, counterparties and \
services operators should be enabled by the introduction of a Web-of-Stakes, \
assembled from previous ideas [0]. From the Bitcoin UTXO set servicing as a trustless \
source of truth, an economic weight can be assigned to each market entity. This \
reputation paradigm could be composed with state-of-the-art Web-of-Trust techniques \
like decentralized identifiers [1].</div><div><br></div><div>A consistent incentive \
framework for service operators is proposed by the intermediary of privacy-preserving \
credentials backed by Bitcoin payments, following the lineaments of IETF&#39;s \
Privacy Pass [2]. Services operators like market boards and oracles are incentivized \
to thrive for efficiency, akin to routing hops on Lightning and miners on the base \
layer.</div><div><br></div><div>The whitepaper goes deep in the architecture of the \
system [3] (Thanks to the peer reviewers!).</div><div><br></div><div>We&#39;ll \
gradually release code and modules, extensively building on top of the Lightning Dev \
Kit [4] and Nostr libraries. All according to the best Bitcoin open-source and \
decentralized standards established by Bitcoin Core and we&#39;re looking forward to \
collaborating with everyone in the community to standardize libraries and guarantee \
interoperability  between clients with long-term \
thinking.</div><div><br></div><div>Feedback is very \
welcome!</div><div><br></div><div>Cheers,</div><div>Nick, Ray and \
Antoine</div><div><br></div><div>[0]  <a \
href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-November/002884.html" \
target="_blank">https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-November/002884.html</a></div><div>[1] \
<a href="https://www.w3.org/TR/2022/REC-did-core-20220719/" \
target="_blank">https://www.w3.org/TR/2022/REC-did-core-20220719/</a></div><div>[2]  \
<a href="https://privacypass.github.io" \
target="_blank">https://privacypass.github.io</a></div><div>[3]  <a \
href="https://github.com/civkit/paper/blob/main/civ_kit_paper.pdf" \
target="_blank">https://github.com/civkit/paper/blob/main/civ_kit_paper.pdf</a></div><div>[4] \
<a href="https://lightningdevkit.org" \
target="_blank">https://lightningdevkit.org</a></div></div> </blockquote></div>
_______________________________________________<br>
bitcoin-dev mailing list<br>
<a href="mailto:bitcoin-dev@lists.linuxfoundation.org" \
target="_blank">bitcoin-dev@lists.linuxfoundation.org</a><br> <a \
href="https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" \
rel="noreferrer" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev</a><br>
 </blockquote></div>



_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic