project screenshot 1
project screenshot 2
project screenshot 3

1Prime

Swap tokens between EVM and NEAR using Siri. Powered by 1inch Fusion+.

1Prime

Created At

Unite Defi

Winner of

1inch

1inch - Extend Fusion+ to Near 2nd place

NEAR

NEAR - Decentralized Solver Runners Up

Project Description

What is 1Prime?

1Prime is a user-centric application designed to make cross-chain swaps between EVM chains and the NEAR ecosystem radically simple. Our core mission is to abstract away the intimidating complexities of Web3—such as managing seed phrases, navigating bridges, and paying for gas—to deliver a seamless experience that feels as intuitive as a Web2 app.

The problem we're solving is fragmentation and friction. Swapping assets between fundamentally different architectures like EVM and NEAR is a daunting task for most users, involving multiple steps, platforms, and potential points of failure. 1Prime consolidates this entire process into a single, clean interface.

The Core User Experience

We focused on creating a frictionless user journey from start to finish:

  1. Effortless Onboarding: When a user signs up, we automatically generate both an EVM-compatible smart wallet (using ZeroDev for account abstraction) and a native NEAR wallet. These wallets are linked to the user's account via a secure bearer token, eliminating the need for users to manage multiple private keys.
  2. Unified Portfolio View: The app presents a single, clean dashboard where users can view all their token balances across both their EVM and NEAR wallets, including all ERC-20 and NEP-141 tokens. We use 1inch's data APIs to fetch real-time balance and price information.
  3. Simple Deposits: Funding the wallet is easy. We provide the user with their single EVM address and NEAR account ID to receive assets.

Our Unique Feature: The Ultimate Intent-Based Interface

The true magic of 1Prime is its deep integration with Apple Shortcuts, allowing users to control their crypto wallets using Siri voice commands. This is the ultimate expression of an intent-based system: the user simply states what they want, and our app handles the complex execution.

For example, a user can:

  • "Hey Siri, what's my 1Prime balance?" to get a live summary of their multi-chain assets.
  • "Hey Siri, show my NEAR deposit address." to quickly get their QR code or address.
  • "Hey Siri, swap 0.1 ETH for NEAR." to initiate and complete a full cross-chain swap without ever touching a complex interface.

This transforms a typically stressful, multi-step process into a single, hands-free command, making DeFi genuinely accessible to a mainstream audience.

How it Works: Extending 1inch Fusion+ to NEAR

Our entire swap functionality is powered by 1inch Fusion+, which we've extended to facilitate secure, atomic swaps with NEAR.

Our architecture ensures that swaps are trustless and secure through a hashlock mechanism:

  1. The user's app generates a random secret and its Keccak-256 hash.
  2. We submit an order to our relayer, which creates a 1inch Fusion+ order locking the user's EVM funds in an escrow contract that can only be unlocked with the secret.
  3. Our system waits for the resolver to deploy a corresponding escrow on the NEAR side, also locked with the same hash.
  4. Once the app verifies both escrows are deployed and funded, it safely reveals the secret.
  5. Resolvers use this secret to unlock the funds on both chains, sending the assets to their final destinations and completing the atomic swap.

This process guarantees that the swap either completes successfully on both ends or not at all, eliminating the risk of lost funds.

How it's Made

Of course! Here are the nitty-gritty details of how we built 1Prime.

Our goal was to create a seamless user experience on the frontend while handling the complex blockchain logic on the backend. The project is primarily composed of the iOS frontend, a custom backend relayer, and smart contracts for the atomic swap.


Technology Stack 💻

  • Frontend: An iOS application built with Swift, with a heavy focus on the Apple Shortcuts framework to enable Siri voice commands for all core actions (login, view balance, swap).
  • Backend Relayer: A Node.js server using the Express.js framework. This server acts as the central coordinator, managing user requests, interacting with the 1inch API, and tracking order statuses.
  • Wallets & Accounts:
    • ZeroDev: We used ZeroDev to generate EVM smart contract wallets. This was a game-changer for user experience, enabling account abstraction features like gasless transactions for the user.
    • NEAR JS SDK: Used for creating and managing native NEAR protocol accounts for each user.
  • Blockchain Interaction:
    • 1inch Fusion+ SDK: We used the official SDK but patched it to accommodate the specific data needed for our cross-chain hashlock mechanism.
    • Ethers.js & NEAR JS SDK: These libraries were used on our backend to communicate with EVM chains and the NEAR blockchain, respectively, for tasks like verifying escrows and broadcasting transactions.

System Architecture & Swap Flow 🏗️

The magic happens in the coordination between the user's device, our relayer, and the blockchain. Here’s how a swap works:

  1. Intent & Hashing: The user initiates a swap via Siri or the app. The app generates a secret (a random number) and its Keccak-256 hash.
  2. Order Preparation: The swap request, along with the hash of the secret, is sent to our backend relayer.
  3. Fusion+ Order Creation: Our relayer uses the patched 1inch Fusion+ SDK to create an intent-based order. This order instructs a resolver to lock the source funds in an escrow contract that is keyed to the secret's hash.
  4. User Signature: The unsigned Fusion+ order is sent back to the user's device, where their ZeroDev smart wallet signs it. This ensures the user maintains full control over their funds.
  5. Submission & Execution: The signed order is sent back to the relayer, which submits it to the 1inch network. A resolver accepts the order and begins execution.
  6. Escrow Verification: The frontend continuously polls our relayer. The relayer, in turn, checks both the EVM and NEAR chains to verify that the resolver has successfully deployed and funded escrows on both sides, locked by the same hash.
  7. The Reveal: Once the frontend gets confirmation that both escrows are secure, it finally reveals the original secret to our relayer.
  8. Unlocking Funds: The relayer broadcasts this secret, which allows the resolver to unlock the funds on both chains and complete the swap atomically.

Partner Technology Integrations ✨

  • 1inch Fusion+: This was the core engine for our entire project. By using Fusion+, we offloaded the immense complexity of finding the best swap routes and executing them to 1inch's powerful solver network. This allowed us to focus on what we do best: building the user experience. Our key contribution was extending Fusion+'s intent system to NEAR by building the hashlock and escrow logic around it.
  • ZeroDev: This was critical for achieving our "Web2-like" user experience. By using ZeroDev's SDK, we gave users powerful smart contract wallets from day one. This abstracted away the need for users to manage gas fees or even hold the native chain token for transaction costs, which is a major friction point in Web3.

A Little Hackathon Magic 🪄

One particularly "hacky" solution we're proud of is our session management for Apple Shortcuts. Since each Siri command runs as an independent process, there's no built-in way to maintain a login session.

To solve this, our "Login to 1Prime" shortcut saves the user's encrypted bearer token to a file in the device's local Downloads/ folder. Then, other shortcuts like "Swap my tokens" read that file to authenticate the API request. It’s definitely not production-grade security, but it was a clever and effective workaround that allowed us to demonstrate a fully functional, voice-controlled workflow for the hackathon.

background image mobile

Join the mailing list

Get the latest news and updates