Send Enygma Transactions

Enygma Payment is a privacy-preserving payment system built into the Rayls blockchain ecosystem. It allows users to transfer shielded ERC-20 tokens between Rayls Nodes (RNs) with full privacy. It leverages cryptographic primitives like Pedersen commitments, zk-SNARKs, and post-quantum encryption to ensure:

  • Confidentiality: Sender, recipient, and amount are hidden from public view.
  • Anonymity: Transactions are shielded across the network.
  • Auditability: Only authorised auditors (e.g., Private Network Operators) can view full transaction data.
  • Compliance: Auditability while maintaining privacy.

Enygma is ideal for financial institutions needing private token transfers, such as CBDC distribution, confidential settlement, or internal ledgering.

How to Use

  1. Single Transfer – A → B

Scenario:
Alice (on RN A) sends 10 private tokens to Bob (on RN B).


await tokenOnPLA.crossTransfer(
  [signerB.address], [10], [chainIdB], [[]]
);

Outcome:

  • Alice’s wrapped token balance decreases (e.g., from 1000 to 990)
  • Bob receives 10 tokens on RN B.

  1. Multi-Recipient Transfer – A → B, C, D

Scenario:

  • Alice (on RN A) sends 5 private tokens each to:
  • Bob (RN B)
  • Carol (RN C)
  • Dan (RN D)
  • Emma (RN E)
  • Frank (RN F)
await tokenOnPLA.crossTransfer(
  [signerB.address, signerC.address, signerD.address, signerE.address, signerF.address],
  [5, 5, 5, 5, 5],
  [chainIdB, chainIdC, chainIdD, chainIdE, chainIdF],
  [[], [], [], [], []]
);

Outcome:

  • Total of 25 tokens are burned from Alice's balance (1000 → 975).
  • Each recipient on their respective Rayls Node receives 5 Enygma tokens.
  • Reference ID is emitted to track this grouped operation.
  • All five destination PLs:
    • Deploy the correct wrapped token contract.
    • Mint tokens to the specified recipient.
  • The process is atomic, ensuring either all recipients receive the tokens or none.

  1. Multi-Sender → Bidirectional Transfer in Same Block – A → B–F and B → A–F

Scenario:
In a single block:

  • Alice (RN A) sends tokens to Bob, Carol, Dan, Emma, and Frank (RNs B–F).
  • Bob (RN B) sends tokens to Alice and the same group (C–F) in return.

This simulates multi-party net settlement, useful for financial clearing or bilateral agreements in real-time.

const txAtoB = await tokenOnPLA.crossTransfer(
  [signerB.address, signerC.address, signerD.address, signerE.address, signerF.address],
  [100, 2, 2, 2, 2],
  [chainIdB, chainIdC, chainIdD, chainIdE, chainIdF],
  [[], [], [], [], []]
);

const txBtoA = await tokenOnPLB.crossTransfer(
  [signerA.address, signerC.address, signerD.address, signerE.address, signerF.address],
  [1, 1, 1, 1, 1],
  [chainIdA, chainIdC, chainIdD, chainIdE, chainIdF],
  [[], [], [], [], []]
);

await txAtoB.wait();
await txBtoA.wait();

Outcome:

  • Total movement from RN A:
    108 tokens (100 to B + 2×4 to C–F) burned
  • Total movement from RN B:
    5 tokens (1 each to A and C–F) burned
  • Final net balances:
    • Alice (RN A):
      975 - 108 + 1 = 868
    • Bob (RN B):
      5 (previous) + 100 (from A) - 5 (sent) = 100
  • All balances across C–F increment accordingly by +1 from Bob and +2 from Alice (net +3).
  • The entire operation is atomic, cryptographically secured with Enygma commitments, and finalized within the same block context.