Skip to content

The Transfer Contract

The Transfer Contract is the backbone of Dusk, enabling seamless transaction processing and gas fees payments. By supporting both shielded and public transactions, the Transfer Contract provides unmatched flexibility to balance privacy and compliance. This flexibility is achieved by specifying the transaction type upon submission, enabling precise routing of the payload.

As a result, Dusk accommodates a wide range of transaction needs and use cases, being able to provide both privacy and compliance.

The Transfer Contract provides support for:

  • Moonlight: A transparent, account-based model.
  • Phoenix: A privacy-preserving, UTXO-based model.

These two models act as equivalent payment rails for Dusk:

  • Moonlight resembles a wire transfer and provides transparency.
  • Phoenix functions like cash, providing privacy.

Each model is designed for specific use cases, balancing unique trade-offs between privacy and practicality. Both models are fully compliant, much like how both cash and wire transfers are legitimate methods of transferring value.

This dual-model approach provides the optimal flexibility for privacy and transparency.

Paying for gas fees

Gas fees can be paid using Phoenix notes or Moonlight balances:

  • When paying fees using Moonlight, fees are deducted directly from the sender’s balance.
  • When paying fees using Phoenix, fees are securely embedded in the zero-knowledge proof.

The Transfer Contract ensures the sender has sufficient funds to cover gas fees and manages these funds by paying them to Provisioners.

Phoenix <> Moonlight

The Transfer Contract facilitates effortless transitions between transparency and privacy, allowing users to convert between Moonlight balances and Phoenix notes as needed. This gives users the flexibility to represent their funds in either form and switch seamlessly based on their preferences or requirements:

Phoenix → Moonlight:

  • Spent Phoenix notes are processed and marked in the Merkle tree.
  • The equivalent value is added to the user’s Moonlight balance.

Moonlight → Phoenix:

  • The user’s Moonlight balance is reduced.
  • A new Phoenix note is created and added to the Merkle tree.

Phoenix vs Moonlight

The Dusk Transfer Contract supports both Moonlight and Phoenix, offering flexibility for users to choose between:

PropertyMoonlightPhoenix
ModelTransparent, Account-BasedPrivacy-Preserving, UTXO-Based
PrivacyNone: transaction details are publicShielded – details are hidden via zk-proofs, while still allowing the receiver to prove the source of funds for compliance purposes
Balance VerificationPublicly checked via account balancesPrivately verified via zk-proofs
Double-SpendingPrevented by visible account statesPrevented by nullifiers
Ideal Use CaseTransparency (e.g. wire transfer)Confidentiality (e.g. cash)

Quick Links