Seamless cross-chain swaps via 1inch Fusion: ETH ↔ XRPL, Cardano with atomic security.
This Project contains three subparts
Key Features:
1.Atomic swaps with guaranteed consistency across chains 2.Cryptographic hash locks and multi-phase timelocks for security 3.Safety deposits to economically disincentivize malicious actions 4.Support for all major EVM chains and the XRPL
Modular architecture including smart contracts, XRPL intermediary server, and a client SDK
Nuvex is designed for secure, interoperable, and developer-friendly cross-chain token swaps.
Key Highlights:
🔄 True atomic swaps with hash/time locks
🛡️ Safety deposits to deter malicious behavior
🌐 EVM ↔ XRPL support using 1inch protocol
🧠 Modular architecture: smart contracts, XRPL server, and client SDK
🚀 Ready-to-run examples and REST API for integration
Built for security, interoperability, and real-world usability across chains.
System Architecture 🔐 Hashlock and Timelock Security Hashlock: Utilizes dual hashing functions — keccak256 for Ethereum and sha256 for Cardano — to secure secrets.
Timelock: Implements deadline-based safeguards to ensure fund recovery in the event of incomplete swaps.
🔄 Bidirectional Escrow Coordination Ethereum Side: Implements AtomicSwap1inch.sol, a Solidity smart contract leveraging 1inch's Aggregation Router, OpenZeppelin libraries, and custom MEV protection logic.
Cardano Side: Employs Plutus and Aiken-based validators for UTXO control, deadline enforcement, and secret validation.
Smart Contract Implementation AtomicSwap1inch.sol Highlights 1inch Integration: Interfaces with IAggregationRouterV5 for optimized swap execution.
MEV Protection: Enforces gas price thresholds, slippage limits, and transaction deadline buffers.
Partial Fill Support: Allows flexible fulfillment of large swap orders.
Claim and Refund Logic: Ensures secure asset flow with deterministic execution and fallback paths.
Cloud Infrastructure: Demeter.run Integration Cardano Tooling: Includes Cardano Node, Blockfrost API, Mesh SDK, and Aiken CLI.
Scripts: Automation provided via setup (setup-demeter.sh), deployment (deploy-contracts.sh), and swap execution (run-atomic-swap.sh) scripts.
Test Deployments:
Ethereum (Sepolia): Contracts deployed and verifiable on public testnet.
Cardano (Preprod): Validators and transactions verifiable through official explorers.
Technology Stack Languages: Solidity (EVM), Haskell and Aiken (Cardano).
Frameworks: Foundry (EVM), Mesh SDK, PlutusTx, Aiken.
Security Libraries: OpenZeppelin extensions for access control, reentrancy protection, and safe token operations.
Coordination: Cardano transaction hashes are used to establish swap linkage and cross-chain state synchronization.
3.Nuvex-TWAP: 🔁 Cross-Chain Atomic Swap: Cardano ↔ Ethereum This project implements a secure and decentralized atomic swap mechanism between the Cardano and Ethereum (Sepolia testnet) blockchains. It eliminates the need for intermediaries by using smart contracts to ensure that asset exchanges across chains are trustless, atomic, and secure.
🔧 Tech Stack Cardano Smart Contracts: Written in Aiken, leveraging Plutus V3 features.
Ethereum Smart Contracts: Built using Solidity, deployed via Foundry or Hardhat.
HTLCs (Hash Time-Locked Contracts): Used for conditional ETH locking on Ethereum.
Node.js + npm: For scripting and integration.
Wallets: Cardano wallet (e.g., Eternl) and MetaMask (Sepolia ETH).
🎯 Key Features 🔄 Atomic Swaps: Assets are either exchanged on both chains or not at all.
🔐 HTLC Security: ETH is locked using a hash and timelock, ensuring conditional release.
📜 Aiken Validators: Secure ADA locking using hash verification logic.
⚡ Plutus Compatibility: Optimized for the latest Plutus standard.
🌉 Cross-Chain Token Support: Includes token locking, minting, and burning mechanisms.
🧪 Full Testing Support: Contract correctness verified via Aiken and Foundry tests.
⚙️ How It Works HTLC Creation (Ethereum): ETH is locked in a smart contract with a hashlock and timelock.
Asset Locking (Cardano): ADA or Cardano-native tokens are locked with the same hashlock.
Preimage Reveal (Cardano): The receiver unlocks ADA by revealing the preimage (secret).
ETH Claim (Ethereum): The sender uses the revealed preimage to unlock ETH.
Timeout Refunds: If not completed in time, both parties can refund their assets.
🛠️ Setup & Usage Requirements Aiken v1.1.17+
Foundry or Hardhat
Node.js v16+
Cardano node & wallet
MetaMask (Sepolia ETH)
Steps Clone the repo and install dependencies.
Build Aiken validator:
bash Copy Edit cd escrow/reverse_validator aiken build Deploy Ethereum contracts:
bash Copy Edit cd ../../evmCrossRouter forge create --rpc-url <SEPOLIA_RPC> --private-key <PRIVATE_KEY> src/HTCL.sol Run tests:
Aiken: aiken test
Solidity: forge test
Swap execution: Use scripts to lock funds, reveal preimage, and claim assets.
📁 Project Structure escrow/reverse_validator: Aiken smart contracts and validator logic.
evmCrossRouter: Ethereum contracts including HTLC and token router.
reverse_plutus.json: Metadata for compiled Plutus scripts.
📚 Documentation Each directory includes its own README.md with build, deploy, and usage instructions.
Dependencies and versions are defined in aiken.toml, packages.toml, and package.json.
Nuvex-XRPL: nuvex-xrpl is the XRPL-side infrastructure of the Nuvex cross-chain atomic swap platform. It is responsible for coordinating and executing XRPL transactions (like escrows and secret revelations) in sync with escrow operations on EVM chains.
Architecture Components
Handles account management, transaction signing, and monitoring.
Supports the following key operations:
Creating XRPL Escrow with a hashlock and time lock.
Finishing Escrow when the EVM-side secret is revealed.
Canceling expired escrows.
Listening for on-ledger events (e.g., EscrowFinish).
Example endpoints:
POST /escrow/create – lock XRP with hash & timelock.
POST /escrow/finish – reveal secret and release funds.
POST /escrow/cancel – cancel expired escrow.
GET /escrow/status/:hash – get escrow status.
Abstracts the HTTP API with simple methods like createEscrow(), finishEscrow(), and cancelEscrow().
Retry logic and timeout configuration built in.
Fully typed using TypeScript.
Flow Summary EVM user locks ERC20 tokens via 1inch contract with hashlock.
XRPL server (controller.ts) is instructed to create a matching XRP escrow using the same hash.
Once the EVM side reveals the secret, it is sent to the XRPL server via POST /escrow/finish.
The server finishes the XRP escrow, releasing funds atomically.
If timeout passes without secret, POST /escrow/cancel reclaims the XRP to the sender.
Nuvex-Cardano: NUVEX CARDANO is engineered as a robust, trustless system enabling atomic token swaps between Ethereum and Cardano blockchains. It combines smart contract infrastructure, cross-chain communication, liquidity aggregation, and automated deployment pipelines.
Trustlessness: Users do not rely on intermediaries; the protocol enforces swap rules via on-chain contracts and cryptographic proofs.
Cross-chain compatibility: Ethereum (EVM) and Cardano (UTXO-based) chains are synchronized using hashlocks, timelocks, and event listeners.
Liquidity Optimization: Uses the 1inch Aggregation Protocol on Ethereum to ensure best-execution pricing and deep liquidity access.
Its hash is computed using:
keccak256(secret) → used on Ethereum (EVM)
sha256(secret) → used on Cardano (UTXO)
Both contracts lock assets using this hash and include a timelock deadline (Unix timestamp) after which funds can be refunded.
🔄 Step 2: Asset Locking on Both Chains Ethereum: The user invokes createSwap() on the AtomicSwap1inch.sol contract, locking ERC20 or ETH assets. This function:
Stores swap parameters and hashlock
Integrates MEV protection (e.g., slippage, gas limits)
Optionally prepares for partial fills
Cardano: The corresponding amount is locked via a Plutus or Aiken validator script that:
Validates the correct hash
Enforces the deadline
Stores UTXO state in a script address
🧾 Step 3: Secret Revelation and Claim The claimer on one chain reveals the secret during the claimWithOneInch() (Ethereum) or unlock() (Cardano) call.
The revealed secret becomes publicly accessible via transaction logs or events.
The other chain retrieves this secret to unlock funds using the verified hash.
🔁 Step 4: Refund if Timeout If the swap is not claimed before the deadline:
Ethereum: refund() can be called by the original sender
Cardano: reverse_unlock() validates the timeout and allows UTXO recovery
Reentrancy protection
ERC20 safety
Ownership controls
Integrates 1inch protocol using:
IAggregationRouterV5
IOrderMixin
Optimized calldata execution
MEV protections include:
Slippage limits (maxSlippageBps)
Gas price thresholds
Execution deadlines
Supports partial swaps via PartialSwapData struct.
🔧 Cardano Side — Aiken and Plutus Contracts Written in both Aiken (for performance and clarity) and Plutus Haskell (for extensibility).
The validators enforce:
sha256(secret) verification
UTXO management via datum/redeemer
Strict deadline checks
Contracts compiled using Aiken CLI, deployed via Mesh SDK or Demeter-run tools.
A Node.js or TypeScript-based relay service listens for these events and:
Retrieves secrets from chain A
Sends them to chain B via wallet APIs or transaction builders
Deadlines are synchronized across chains to ensure fairness and safety.
Cardano Node (Preprod/Mainnet)
Blockfrost API for queries
Aiken Language Server for smart contract development
VS Code IDE for in-browser editing
⚙️ Automation Scripts setup-demeter.sh: Installs dependencies and prepares the workspace.
deploy-contracts.sh: Deploys Ethereum and Cardano contracts.
run-atomic-swap.sh: Executes full swap lifecycle in test environments.
Security Features ✅ ReentrancyGuard and access control
NUVEX-TWAP:
✅ SafeERC20 usage for all ERC20 transfers
✅ Timelock-based refund logic on both chains
✅ Slippage protection through 1inch execution
✅ Verified secret revelation with hash comparison

