/p2pFiat

p2p fiat aims to build trustless p2p btc collateralised fiat stability over the Lightning Network

p2p fiat peg - btc collateralised fiat peg

p2p fiat aims to build trustless btc collateralised fiat peg over the Lightning Network.

Humanity deserves a trustless permissionless technology with fiat peg.

While prices are set in fiat terms, many people cannot afford the sort term volatility of bitcoin. A few solutions are emerging to enable stability in fiat terms - on the basis of perpetual swaps with trusted counterparties - see at the bottom of this page for examples. Ultimate decentralisation would envision a fully decentralised exchange on which people can take derivative positions to achieve a peg with fiat or other assets. Potentially a p2p protocol such as Holepunch could help here or (with the risk of swearing in church) a type of lightning network gossip. Any wallet would offer fiatcoin conversion and on the other hand the ability to take leveraged long bitcoin positions. Through a p2p protocol (such as Holepunch or lightning network gossip), someone looking to buy bitcoin backed fiatcoin, would issue an offer to sell a short swap. Others, or liquidity providers, for example LN Markets, would make make bids to lock in bitcoin at a certain fiat price.

architecture

Sellers and buyers would be matched on the basis of local book building. Once a seller and a buyer agree on a certain exchange rate, both parties would enter into a fully collateralised swap smart contract - in which one party has effectively bought the ‘fiatcoin’ value and the other party has a leveraged long bitcoin position - the respective satoschis of both parties would be locked up - very similar to a lightning channel. Most likely, Discrete Log Contracts can help to establish these fully collateralised swap smart contracts. An essential input is the exchange rate, which is an input to the smart contract. The established swap can ensure stable fiat value up to half the original exchange rate. Swap rollover logic can help to automatically roll over the positions to protect the position at all time, e.g. after a 25% drop versus the locked in exchange rate.

This project requires three building blocks - the exchange rate 'oracle' can work based on a simple api call for the MVP - only needs development for robust production deployment:

p2p messaging protocol

Messages to exchange offers and bids:

  • Node x offers short at exchange rate y for volume z satoshis
  • Node a buys short at exchange rate b for volume c satoshis

p2p2

Fully collateralised smart contract swaps on the lightning network

Locks up agreed satoshi volume of both parties

Describes position closing dynamics, e.g.

  • At agreed exchange rate (buy / sell prices communicated between parties)
  • Fallback based on external oracle

contract4

Juraj Bednár and René Pickardt described Discreet Log Contracts embedded in Lightning channels in 2019.

Ben Carman got closest to describing Discreet Log Contracts on the Lightning Network.

TenTenOne seems to be the most advanced implementation of DLC contracts on the lightning network.

On November 28, 2022, Crypto Garage announced the first lightning channel embedding a DLC.

This project previously mentioned a potential role of RGB or Taro - the ability to leverage any of these wonderful protocols will depend on the ability to trustlessly mint DLC assets - to potentially allow them to travel more easily over the LN - alternatively, in an MVP, a fiat stability holder who wants to make a payment, would settle part of their DLC and make the payment in the equivalent satoshi value. The receiver has the opportunity to establish fiat stability if they want using the same DLC mechanism.

Decentralised oracles

Oracles are the remaining trust element.
Bitcoin is secured and considered trustless on the basis that 51% of miners can be trusted. Trustless is trustverymany.
The values transacted are on L1 large and hence require verymany untrusted counterparties for trust.

Users looking for fiat stability, will probably peg for a small value, so most probably the number of counterparties can be smaller. So instead of trustverymany, one may be ok with trustmany.

For simplicity, we will use here the example of 3 oracles - the oracle outcome can then be structured as a 2 of 3 key. Scaling to larger numbers of oracles is likely relatively trivial.
A team of researchers has already described this as verifiable witness encryption based on threshold signatures (VweTS) in the Paper 2022/499 - Practical Decentralized Oracle Contracts.

Multiple approaches can be used - one possible approach may be that people who exchange satoshis for fiat stability (typically in the background of the app) - also serve themselves as oracle.

As inputs for the various oracles a stream of agreed exchanges / unwindings of swaps can be sent on the p2p signaling layers - effectively transmitting to the network the exchange rates approved by users - a decentralised price oracle. This introduces a new challenge - how can we link a certain price signal to a specific asset, e.g. USD - a correlation with historic price signals will likely be a way for a node to assign reputation to an untrusted price signal.

Possible MVP architecture

arch5

arch7

Local order book building and swap rollover logic

  • Can be custom built for each wallet
  • Provides for wallet competitive advantage
  • Builds local order book, based on information from p2p messaging protocol
  • Continuously looks to improve swap position
  • Ensures timely rollover to manage rollover risk
  • Building requires little protocol knowledge, but significant financial understanding

logic

MVP

The MVP can compromise on the permissionless nature of p2p Fiat: an MVP can build on a centralised exchange book building - and focus on establishing the fully collaterlised smart contract swaps. 10101 have built a product that most closely achieves trustless fiat stability.

The future risk free rate

As the expectation value for the btc price in usd or other fiat terms is higher in most market circumstances, the market expects the long position to pay a carry fee. That carry fee will result in the longer term in a new definition for risk free rate - yield without counterparty risk - replacing the current risk free rate, for which the counterparty risk is the US government for US bonds - although in many situations there is intermediary risk.

Complementarity

p2p fiat is complementary to several digital fiat stability alternatives. p2p fiat is the only truely trustless and permissionless solution.

Below, you find what is probably the most complete fiat stability / stablecoin overview in the world - please feel free to comment or provide links to other resources. fiat-2024-03-21

Thank you - inspiration

This project is inspired by Galoy Stablesats. You can test that project in the Bitcoin Beach Wallet. p2p Fait aims to make the swaps fully p2p trustless and permissionless, whereas Stablesats depends on perpetual swaps by their Dealer through the CryptoCurrency eXchange Trading Library with OKX at this stage - albeit with an ambition to diversify and partner with Kollider, who are building a (custodial) browser plugin wallet.

It seems the Human Rights Foundation and Strike have launched a bounty challenge on December 20, 2021 with exactly the challenge as described above. This is an open call for anyone to team up.