DvP on Rayls Private Networks

Delivery versus payment (DvP) is a settlement rule: an asset is delivered only if payment is made, and payment is made only if the asset is delivered. It removes the risk that one side performs and the other doesn't. Payment versus payment (PvP) applies the same rule to an exchange of two currencies.

A Rayls Private Network is multiple Rayls Sovereign chains connected together via a central Hyperledger Besu chain, the Private Network Hub. Each side of a trade usually sits on a different institution's Rayls Sovereign chain (Privacy Node in the code), so the two legs of a DvP have to settle across chains. Rayls does this with Enygma DvP, which settles both legs in a single transaction on the Hub.

What's supported

SettlementStatus
Enygma tokens against ERC-721 tokens (non-fungible), across two chainsAvailable, with Enygma DvP
Enygma tokens against fungible ERC-1155 token IDs, across two chainsAvailable, with Enygma DvP
Non-fungible ERC-1155 token IDsNot available
PvP: one Enygma token against another, or any exchange of two currenciesNot available. The Hub's deployment registers a fungible-to-fungible pair in the DvP contract, but no swap function or relayer flow uses it.
Payment in a token that isn't an Enygma token, across chainsNot available
Program steps on DvP settlementNot available
Auctions, brokers and DvP-specific auditorsNot available. The DvP contract contains placeholders for them, but they aren't part of the product.

Enygma DvP in brief

Enygma DvP holds the assets being traded in vaults on the Hub, as coins: commitments that only their owner can spend, with a zero-knowledge proof. A swap spends both sides' coins and creates new ones for the new owners, in one Hub transaction.

Alice, on chain A, buys a bond token from Bob, on chain B, for 100 Enygma tokens:

  1. Agree. Alice and Bob agree the terms off-chain, including a shared swap ID.
  2. Deposit. Alice moves 100 Enygma tokens into DvP. Bob moves the bond token into DvP. Each deposit becomes a coin in a vault on the Hub.
  3. Initiate. Whichever side's relayer reaches the Hub first initiates the swap. Its coin is locked, and the terms are encrypted for the counterparty.
  4. Complete. The counterparty's relayer checks the terms and completes the swap with its own proof. In that one Hub transaction, both input coins are spent and the new coins are created: Alice now owns the bond coin, and Bob a coin for 100 Enygma tokens.
  5. Withdraw. Each side takes its new asset back to its own chain.

For the full flow, the function names and what each step reveals, see Private DvP with Enygma.

What is atomic, and what isn't

  • The exchange is atomic. Step 4 is one Hub transaction: both coins change hands, or neither does.
  • Deposits and withdrawals are separate steps. Moving an asset into DvP before the swap, and out of it afterwards, are cross-chain operations of their own. Until a side withdraws, its new asset is held as a coin on the Hub.
  • A swap that isn't completed can be undone. Either side can cancel a pending swap, and every swap expires after its validity time: two days by default, and always more than 5 hours and less than 14 days. In both cases, the initiator's locked coin is replaced by a new coin of the same value, which it can withdraw.

Who sees what

  • The terms are encrypted for the counterparty. The Private Network operator, which holds every participant's view key, can read them too.
  • Enygma amounts stay hidden. ERC-721 deposits and withdrawals are visible on the Hub.
  • The Hub emits public events when a swap is initiated, completed, cancelled or expired.

See Who sees what.

The operator's role

The Private Network operator decides which assets can be swapped for which, by registering asset groups and the pairs of groups that may settle against each other. It approves the tokens involved, and it can freeze an Enygma token for a participant, which stops that participant from using the token in DvP. See Governance.

Other ways to settle

  • Within one chain. When both sides hold their assets on the same Rayls Sovereign chain, both legs are ordinary tokens on one EVM (Ethereum Virtual Machine) chain, and an escrow contract on that chain can swap them atomically. That is standard EVM development rather than a Rayls feature. Enygma DvP is for counterparties on different chains.
📘

PvP and foreign exchange

PvP for cross-border currency exchange isn't part of the production release, but can be developed for a client's own deployment. Today, Rayls Private Networks settle Enygma tokens against ERC-721 tokens and fungible ERC-1155 tokens.


Did this page help you?