Interphase Protocol β Technical Masterclass & Tutorial Series
Repository:
patchhaystacks/interphase
Master Specification: spec.md
Implementation Roadmap: roadmap.md
Author & Lead Architect: patchhaystacks
7-Lesson Engineering Guide to Cryptography, Garbled Circuits & Solver Economics
Seven-lesson technical masterclass designed for smart contract engineers, market makers, and dApp developers. Walks step-by-step through the protocol architecture, cryptographic derivation, solver pricing formulas, and SDK usage.
Repository:
patchhaystacks/interphase
Master Specification: spec.md
Implementation Roadmap: roadmap.md
Author & Lead Architect: patchhaystacks
Traditional privacy tools and bridges suffer from two fatal design flaws:
Wallet A on Ethereum sends 10 ETH to Wallet B on Solana, the bridge relayer emits a public transaction linking Wallet A directly to Wallet B. All financial history, balances, and counterparties are publicly linked forever.Interphase solves this by decoupling the Source Deposit, the Confidential Control Plane, and the Destination Payout into three independent layers:
Layer 1: Source Chain (Ethereum / Base / Arbitrum / Solana / Avalanche)
User deposits Asset X into a shared, non-custodial Escrow Contract.
(Public block explorer sees: "Wallet A deposited into InterphaseEscrow". That's all.)
β
βΌ (Encrypted Intent via @coti-io/coti-ethers)
Layer 2: Confidential Control Plane (COTI L2 Garbled Circuits)
An encrypted computer. COTI MPC nodes evaluate compliance, minimum output amounts,
and policy limits INSIDE garbled circuits.
Node operators see CIPHERTEXT, not balances, amounts, or addresses!
β
βΌ (Sanitized Auction Order to NEAR Intents)
Layer 3: Destination Settlement (Solana / Any Chain)
An independent solver (market maker) uses their own capital to deliver
Asset Y to a brand-new, single-use STEALTH ADDRESS on the destination chain.
(Public block explorer sees: "Market Maker transferred USDC to Stealth Address".
Zero link to Wallet A.)
β
βΌ (Settlement Proof returned)
Solver claims the original deposit from the Source Escrow on Layer 1.
InterphaseEscrow.solIn this lesson, we examine the primary source-chain smart contract: InterphaseEscrow.sol.
A common point of confusion is: "Does a user have to wait 7 days if their swap fails?"
No! The protocol operates three distinct refund tiers depending on the failure mode:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INTERPHASE 3-TIER REFUND TIMELINE β
βββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββββββββ€
β Tier Level β Trigger Event β User Refund Time β Mechanism β
βββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββ€
β Tier 1: Fast β Unfulfilled β 3 Minutes β Automatic abort; β
β β Auction β β instantaneous release β
βββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββ€
β Tier 2: Normalβ Solver SLA β 15 β 30 Minutes β Signed NEAR MPC β
β β Breach / Outage β β Non-Settlement Proof β
β β β β + 20% user bounty β
βββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββ€
β Tier 3: Catas-β Total Oracle / β 24 Hours β Trustless, unilateral β
β trophic β Network Failure β (Optimized) β emergency red button β
βββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββββββ
Why does the Emergency Dead-Man Switch require a waiting window (originally 7 days, optimized to 24 hours)?
In cross-chain bridges, contracts often grant token allowances (approve(spender, amount)) to routers, relayers, or hot wallets. In our postmortem analysis of the COTI bridge infrastructure (coti-bridge-vulnerabilities), we discovered that if an attacker or rogue script calls transferFrom using an existing allowance, the account nonce does not change ($\Delta Nonce = 0$).
The monitoring daemons were completely blind to the balance drain until user transactions began reverting on-chain!
approve() call in the contract.IERC20(token).allowance(address(this), spender) == 0.transfer(recipient, amount) upon verified settlement proofs.Most naive Solidity contracts do this:
// VULNERABLE PATTERN:
IERC20(token).transferFrom(msg.sender, address(this), amount);
intents[intentId].amount = amount;
If a user deposits a fee-on-transfer token (e.g. a token that burns 2% on transfer) or a rebasing token, the contract only actually receives 98 tokens, but records 100. Over time, the contract becomes insolvent and cannot pay solvers.
In commitIntent:
uint256 balanceBefore = IERC20(params.sourceToken).balanceOf(address(this));
IERC20(params.sourceToken).transferFrom(msg.sender, address(this), params.sourceAmount);
uint256 balanceAfter = IERC20(params.sourceToken).balanceOf(address(this));
actualAmount = balanceAfter - balanceBefore;
require(actualAmount == params.sourceAmount, "Token balance delta mismatch (Fee-on-transfer not supported)");
We measure the physical change in the vault's balance before and after. If the token takes a fee or fails to deliver the exact amount, the transaction instantly reverts.
When you send an encrypted intent to COTI L2, the garbled circuit MPC evaluates it privately. The node operators only see encrypted ciphertexts. If an attacker submits two different encrypted orders for the same deposit in parallel, the nodes wouldn't know they are conflicting until they waste expensive compute.
We generate a deterministic, unblinded Nullifier: $$Nullifier = Keccak256(sourceSender \parallel nonce \parallel sourceTxHash \parallel intentId)$$
In commitIntent:
require(params.nullifier != bytes32(0), "Invalid nullifier");
require(!usedNullifiers[params.nullifier], "Nullifier already consumed");
usedNullifiers[params.nullifier] = true;
Once a nullifier is consumed, it is dead forever. No transaction can ever reuse it.
EphemeralBatchSweeper.sol)When your recipient receives USDC on a stealth address, how do they get it out?
USDC.approve(router) → (2) router.swap() → (3) ETH.transfer().In Ethereum's Pectra hardfork, EIP-7702 allows an ordinary wallet to temporarily assume the bytecode of EphemeralBatchSweeper.sol for a single transaction.
packages/crypto-core-wasm)In this lesson, we explore the cryptographic brain that runs inside the user's mobile app, web browser, and solver daemons: packages/crypto-core-wasm.
We cover three critical innovations:
zeroize fixes it).When you receive crypto on a traditional blockchain, you give someone your public address (e.g. 0xAlice... or Alice.sol). Every payment anyone sends you is recorded under that exact same address, allowing anyone on the internet to trace your total wealth and spending habits.
A Stealth Address is a brand-new, single-use public key generated for every single transaction.
In Interphase, every recipient publishes a Stealth Meta-Address consisting of TWO independent public keys:
secp256k1)Code Reference: rust/secp256k1_stealth.rs & src/secp256k1.ts
Code Reference: rust/ed25519_stealth.rs & src/ed25519.ts
Solana uses the twisted Edwards curve Ed25519 with basepoint $B$ and subgroup order $\ell = 2^{252} + 27742317777372353535851937790883648493$.
Imagine running a privacy wallet on Solana. Solana processes $2,000+$ transactions per second ($170 million$ transactions per day).
Code Reference: rust/viewtag.rs & src/viewtag.ts
We emit two tiny tags alongside the ephemeral public key: $$viewTag1 = Sha256(\text{"interphase:viewtag:v1"} \parallel S_{shared})[0] \quad \text{(1 byte)}$$ $$viewTag4 = Sha256(\text{"interphase:viewtag:v1"} \parallel S_{shared})[1..5] \quad \text{(4 bytes)}$$
[Incoming High-Velocity Block Stream (2,000 TPS)]
β
βΌ
[Tier 1: Check 1-Byte viewTag1]
Does transaction log tag match?
β β
β NO (99.61%) β YES (0.39%)
βΌ βΌ
[DISCARD INSTANTLY] [Tier 2: Check 4-Byte viewTag4 in Memo]
(0 Elliptic Curve Does memo tag match?
math performed!) β β
β NO β YES (1 in 2^40 collision)
βΌ βΌ
[DISCARD] [Perform EC Scalar Multiplication]
[Detect Inbound Stealth Payment!]
In standard TypeScript or JavaScript:
const spendingPrivateKey = new Uint8Array([/* 32 secret bytes */]);
// ... do signing ...
When this variable goes out of scope, the JavaScript virtual machine (Google V8, SpiderMonkey, or Hermes) marks it for garbage collection. However, garbage collection does NOT immediately zero out physical RAM.
node_modules (supply chain attack), a malicious browser extension, or an OS memory inspector inspects the process memory, it can scrape your private keys in plain text.Code Reference: rust/zeroize_buffer.rs & src/memory.ts
SecretBuffer32, which implements the Zeroize and ZeroizeOnDrop traits:#[derive(Clone, Zeroize, ZeroizeOnDrop)]
pub struct SecretBuffer32(pub [u8; 32]);
WebAssembly.Memory), completely separated from the V8 garbage collector heap.memset_s) that overwrites the memory with zeroes before the stack frame unwinds.withSecuredBuffer(secret, callback) which explicitly calls buffer.fill(0) in a finally block to zero the underlying ArrayBuffer.Run the test suite across the monorepo:
npm test --workspace=@interphase/crypto-core-wasm
Output:
# Subtest: EVM ERC-5564 Stealth Address Derivation & Key Recovery
ok 1 - EVM ERC-5564 Stealth Address Derivation & Key Recovery (79ms)
# Subtest: Solana Curve25519 / Ed25519 Stealth Address Derivation & Key Recovery
ok 2 - Solana Curve25519 / Ed25519 Stealth Address Derivation & Key Recovery (116ms)
# Subtest: Dual-Tier View-Tag Filtering & False Positive Rejection
ok 3 - Dual-Tier View-Tag Filtering & False Positive Rejection (0.3ms)
# Subtest: Active Buffer Memory Zeroization
ok 4 - Active Buffer Memory Zeroization (0.1ms)
packages/contracts-coti)In this lesson, we explore the confidential coordinator of Interphase: the Confidential Control Plane deployed on COTI L2 (packages/contracts-coti).
We cover:
In Web3, there are three primary technologies for privacy. Understanding why we use Garbled Circuits is key:
| Technology | How It Works | Strengths | Fatal Flaw for Cross-Chain Routing |
|---|---|---|---|
| Zero-Knowledge Proofs (ZK) | A user computes a mathematical proof on their device showing a statement is true without revealing why (e.g. "I have $\ge $100$"). | Fast verification on-chain. | Cannot perform joint multi-party computation. If two people or a user and a contract need to compute shared private logic, ZK requires complex recursive setups and huge client proving times (phone freezes for 45s). |
| Fully Homomorphic Encryption (FHE) | Performs mathematical operations directly on encrypted ciphertexts (e.g. $Enc(a) + Enc(b) = Enc(a+b)$). | Powerful general-purpose math. | Massive computational latency. 1,000× to $10,000\times$ slower than normal compute. A simple swap calculation can take 30+ seconds of heavy server compute. |
| Garbled Circuits (COTI MPC) | Invented by Turing Award winner Andrew Yao. Encrypts logic gates (AND/OR/XOR truth tables) using random cryptographic wire labels. | Runs at hardware speeds (100× faster than FHE). Enables true multi-party private computation. | The ideal engine for private order matching, compliance validation, and stateful limit checks. |
In COTI v2, validator nodes operate a Multi-Party Computation (MPC) cluster. When a contract evaluates an encrypted transaction:
Code Reference: InterphaseCotiRouter.sol & IInterphaseCotiRouter.sol
In standard bridges, the relayer submits:
"Transfer 1,000 USDC from 0xAlice (Ethereum) to 0xBob (Solana)"
This permanently links Alice to Bob.
In Interphase, COTI acts as "The Blind Brain":
1. SOURCE CHAIN (Ethereum):
Alice deposits 1,000 USDC into InterphaseEscrow.sol.
Public explorer sees: "0xAlice deposited 1,000 USDC into InterphaseEscrow".
β
βΌ (Encrypted Meta-Tx via OHTTP to COTI L2)
2. CONFIDENTIAL BRAIN (COTI L2 Garbled Circuits):
COTI nodes verify:
[β] Is deposit signed by source oracle? (Valid)
[β] Is Alice on OFAC sanctions SMT? (Clean)
[β] Does Alice's 24h volume exceed $10,000? (Clean)
COTI contract permanently STRIPS Alice's identity!
COTI contract emits a "Sanitized Order":
{
destChainId: 101 (Solana),
destinationToken: USDC_Mint,
stealthRecipient: 7X... (One-time stealth pubkey),
viewTag1: 0x4a,
viewTag4: 0x11223344,
minOutputAmount: 998 USDC,
gasDropAmount: 0.005 SOL
}
β
βΌ (Public Broadcast to NEAR Intents)
3. DESTINATION SETTLEMENT (Solana):
Solver Bob fills the order using his own liquidity.
Public explorer sees: "Market Maker Bob transferred 998 USDC to Stealth Address 7X...".
ZERO on-chain connection to 0xAlice!
Code Reference: ComplianceSMT.sol
To ensure Interphase remains compliant with international regulations (EU MiCA / Transfer of Funds Regulation & US FinCEN 31 CFR Β§ 1010.314) without sacrificing personal financial privacy:
SanctionsQuarantineVault.sol.max24hVelocityLimit):bytes32 blindedIdentity = keccak256(abi.encodePacked(deposit.sourceSender, "interphase:velocity:v1"));
// If cumulative volume in 24 hours exceeds governance cap:
if (max24hVelocityLimit > 0 && newVolume > max24hVelocityLimit) revert VelocityLimitExceeded();
0 to enable completely unlimited transactions (ZODL-style unrestricted mode).blindedIdentity is a salted one-way hash! COTI tracks volume per user without ever revealing the user's real wallet address to the solvers or public mempools.Code Reference: InterphaseCotiRouter.sol
How do we ensure solvers actually deliver the money on Solana and don't stall user funds?
commitSolverLock):settleOrder):reportSolverDefault):Run the test suite across the monorepo:
npm test --workspace=@interphase/contracts-coti
Output:
# Subtest: COTI L2 Deposit Attestation & Signature Verification
ok 1 - COTI L2 Deposit Attestation & Signature Verification (43ms)
# Subtest: 24-Hour Identity Velocity Limiter (Anti-Structuring Defense)
ok 2 - 24-Hour Identity Velocity Limiter (Anti-Structuring Defense) (0.5ms)
# Subtest: Solver Slashed Bond Split: 20% User Bounty, 80% Protocol Insurance
ok 3 - Solver Slashed Bond Split: 20% User Bounty, 80% Protocol Insurance (0.1ms)
# Subtest: Identity Decoupling: Sanitized Order Strips Source Identity
ok 4 - Identity Decoupling: Sanitized Order Strips Source Identity (0.1ms)
packages/solver-daemon)In this lesson, we examine the market makers who power the destination settlement: the Solver Network (packages/solver-daemon).
We cover:
Traditional cross-chain bridges (like the original Multichain, Wormhole token bridge, or COTI Bridge v1) use Lock-and-Mint or Liquidity Pools:
In an Intent-Based Protocol like Interphase (and Across / UniswapX):
Code Reference: pricing.ts
When an event arrives from COTI L2 (PrivateIntentEvaluated), the solver daemon calculates:
$$Gross Revenue = sourceAmount \quad (Deposit locked in \texttt{InterphaseEscrow.sol})$$
$$Total Cost = minOutputAmount + \Delta_{gas_cost} + destGasFee + L1ClaimGasFee$$
$$Net Profit = Gross Revenue - Total Cost$$
// The solver requires at least minProfitBps (e.g. 15 bps = 0.15%):
const minRequiredProfit = (order.sourceAmount * BigInt(config.minProfitBps)) / 10000n;
if (estimatedProfit < minRequiredProfit) {
return { isExecutable: false, rejectionReason: "Profit below minimum required" };
}
SettlementExecutionPlan.Code Reference: solana_settler.ts
A brand-new stealth address on Solana has no SOL gas and no Associated Token Account (ATA). If the recipient had to create an ATA or transfer gas from their main wallet, their privacy would be completely destroyed!
The solver daemon solves this by packaging 4 instructions into a single atomic transaction:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SOLANA ATOMIC SETTLEMENT TRANSACTION BUNDLE β
βββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Instruction 1 β AssociatedTokenAccount.createIdempotent() β
β β Creates the recipient's USDC ATA if not existing. β
βββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Instruction 2 β SplToken.transferChecked(solverATA -> stealthATA) β
β β Transfers 998 USDC to the stealth address. β
βββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Instruction 3 β SystemProgram.transfer(solver -> stealthPubkey) β
β (Atomic Gas Drop) β Sends 0.005 SOL native gas directly to recipient! β
βββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Instruction 4 β MemoProgram.writeMemo("ip:4a:11223344") β
β (Dual-Tier Tags) β Emits 1-byte viewTag1 (4a) and 4-byte viewTag4. β
βββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββ
Because all 4 instructions execute atomically in the exact same slot:
Code Reference: voucher.ts
If a solver settles $50,000 on Solana, but Ethereum L1 requires 15 minutes (2 epochs) to finalize before they can withdraw the $50,000 from InterphaseEscrow.sol, the solver's capital is locked. A market maker with $500,000 could only fulfill 10 orders per hour before running out of liquidity!
The moment Solana reaches Finalized commitment (32 confirmed slots $\approx 12.8 seconds$):
InterphaseEscrow.sol to unlock the source deposit.Run the test suite across the monorepo:
npm test --workspace=@interphase/solver-daemon
Output:
# Subtest: Solver Pricing Engine: Profitable Order Evaluation
ok 1 - Solver Pricing Engine: Profitable Order Evaluation (1.7ms)
# Subtest: Solver Pricing Engine: Rejects Unprofitable or Thin Margins
ok 2 - Solver Pricing Engine: Rejects Unprofitable or Thin Margins (0.3ms)
# Subtest: Solana Atomic Settlement Bundle: 4-Instruction Atomic Execution
ok 3 - Solana Atomic Settlement Bundle: 4-Instruction Atomic Execution (0.5ms)
# Subtest: Instant Rehypothecation: Settlement Credit Voucher Issuance & Verification
ok 4 - Instant Rehypothecation: Settlement Credit Voucher Issuance & Verification (80ms)
packages/sdk)In this lesson, we explore the unified developer gateway: the Interphase Client TypeScript SDK (packages/sdk).
We cover:
prepareSwap(): How the SDK handles stealth derivation, deterministic nullifiers, and COTI confidential payloads.StealthScanner Engine: How recipients scan blocks and recover private keys with zero false-alarm battery drain.Without an SDK, a frontend developer building a web app or mobile wallet would have to manually:
secp256k1 (EVM) and Curve25519 (Solana) point arithmetic.InterphaseEscrow.commitIntent().With @interphase/sdk, this is reduced to 3 simple lines of TypeScript:
import { InterphaseClient } from "@interphase/sdk";
const client = new InterphaseClient();
const swap = await client.prepareSwap({
sourceChainId: 1, // Ethereum L1
sourceToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
sourceAmount: 10_000n * 1_000_000n, // $10,000 USDC
destChainId: 101, // Solana
destinationToken: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // Solana USDC
recipientMetaAddress: aliceSolanaMetaAddress,
});
prepareSwap()Code Reference: client.ts
When client.prepareSwap() is invoked, the SDK performs 5 operations under the hood:
[User Input Parameters]
β
βΌ
1. Detect Chain Family (EVM vs Solana)
Calls @interphase/crypto-core-wasm:
- Derives Ephemeral Public Key: R = r * G
- Computes Shared Secret Point: S_shared = r * V
- Computes Stealth Address: P_stealth
- Computes Dual-Tier View-Tags: viewTag1 & viewTag4
β
βΌ
2. Generate Deterministic Nullifier
nullifier = Keccak256(sourceToken || sourceAmount || destChainId || entropy)
(Guarantees deposit cannot be double-spent)
β
βΌ
3. Generate Canonical Intent ID
intentId = Keccak256(nullifier || stealthAddress || deadline)
β
βΌ
4. Encode Confidential COTI Payload
Packages target chain, destination token, stealth recipient, view-tags,
and slippage bounds for evaluation inside COTI L2 Garbled Circuits.
β
βΌ
5. Output PreparedSwap Object
Ready to pass directly to ethers.js / viem / wagmi wallet signers!
Code Reference: client.ts
To keep users completely informed and eliminate anxiety during cross-chain execution, client.formatProgressUpdate() maps on-chain events into structured progress updates:
| Step | User-Facing Status Message | Progress | Refund / Safety Protection |
|---|---|---|---|
INITIATING |
"Deriving one-time stealth keys and view-tags in WASM..." | 10% | Zero-heap memory protection active. |
DEPOSIT_PENDING |
"Waiting for source deposit transaction confirmation..." | 25% | Balance-delta safety assertion. |
MPC_EVALUATING |
"COTI Garbled Circuits evaluating blind compliance..." | 50% | 3-minute auto-refund timer started. |
AUCTION_ACTIVE |
"Sanitized order published to NEAR Intents. Solvers bidding..." | 75% | Identity completely stripped. |
SOLVER_LOCKED |
"Market maker committed bond. Executing payout & gas drop..." | 90% | Solver's 10% collateral locked on COTI L2. |
SETTLED |
"Funds successfully delivered to stealth address!" | 100% | Destination transaction signature confirmed. |
REFUND_TIER_1_AUTO |
"Auction unfulfilled in 3m. Source deposit auto-unlocked!" | 100% | Instant source escrow release. |
REFUND_TIER_2_DISPUTE |
"Solver SLA breach. 100% refund + 20% bonus bounty awarded!" | 100% | Paid from solver's slashed collateral. |
StealthScanner Engine (Background Mobile Sync)Code Reference: scanner.ts
How does a userβs wallet know when someone sent them a private payment?
In a traditional wallet, you poll the blockchain for your public address (0xAlice). But with stealth addresses, your public address was never touched!
The StealthScanner allows a recipient's web or mobile wallet to scan incoming blocks:
import { StealthScanner } from "@interphase/sdk";
const scanner = new StealthScanner(
"solana",
aliceSpendingPrivateKey,
aliceViewingPrivateKey
);
// Scan incoming transaction event from Solana block stream:
const detected = scanner.scanTransaction(incomingBlockEvent);
if (detected) {
console.log(`Payment detected! Amount: ${detected.amount}`);
console.log(`Derived Private Key for spending: ${detected.derivedPrivateKeyHex}`);
}
event.memoPayload ("ip:4a:11223344"). It checks 4a (viewTag1). 99.61% of all network transactions are discarded immediately with a single-byte integer check!11223344 (viewTag4). If that doesn't match, it is discarded. The false positive rate is:
$$\frac{1}{2^{40}} \approx 9.09 \times 10^{-13}$$Run the test suite across the monorepo:
npm test --workspace=@interphase/sdk
Output:
# Subtest: InterphaseClient: Prepare EVM-to-EVM Private Swap
ok 1 - InterphaseClient: Prepare EVM-to-EVM Private Swap (67ms)
# Subtest: InterphaseClient: 3-Tier Refund Progress Update Formatting
# Subtest: InterphaseClient: Prepare Ethereum-to-SUI Private Swap
ok 4 - InterphaseClient: Prepare Ethereum-to-SUI Private Swap (101ms)
# Subtest: InterphaseClient: Prepare Ethereum-to-NEAR Private Swap
ok 5 - InterphaseClient: Prepare Ethereum-to-NEAR Private Swap (6.7ms)
# Subtest: InterphaseClient: Prepare Ethereum-to-TRON Private Swap & Scanner Detection
ok 6 - InterphaseClient: Prepare Ethereum-to-TRON Private Swap & Scanner Detection (11.2ms)
# Subtest: InterphaseClient: Prepare Ethereum-to-Bitcoin Native SegWit Private Swap & Scanner Detection
ok 7 - InterphaseClient: Prepare Ethereum-to-Bitcoin Native SegWit Private Swap & Scanner Detection (15.0ms)
# Subtest: InterphaseClient: Prepare Ethereum-to-Cardano Shelley Private Swap & Scanner Detection
ok 8 - InterphaseClient: Prepare Ethereum-to-Cardano Shelley Private Swap & Scanner Detection (8.2ms)
1..8
# tests 8
# pass 8
# fail 0
Across all packages in the monorepo (contracts-coti, contracts-evm, crypto-core-wasm, sdk, solver-daemon), all 25 unit tests pass with 100% precision.
With the addition of TRON, Bitcoin, and Cardano, Interphase provides total cryptographic coverage across the top 7 blockchain ecosystems:
| Ecosystem | Curve & Primitives | Stealth Derivation Formula | Address Encoding | Gas Drop & Protocol Role |
|---|---|---|---|---|
| EVM (Eth, Base, Arb) | secp256k1 + Keccak-256 |
$P_{stealth} = S + Keccak256(r \cdot V) \cdot G$ | ERC-5564 Hex (0x..., 20 bytes) |
Native ETH/gas for instant sweeps |
| Solana | Ed25519 + SHA-512 |
$P_{stealth} = S + Sha512(ctx \parallel r \cdot V)[0..32] \cdot B$ | Base58 ([1-9A-HJ-NP-za-km-z]) |
$0.005 SOL$ + ATA rent harvest |
| Sui Network | Ed25519 + Blake2b-256 |
$Blake2b-256(0x00 \parallel P_{stealth})[0..32]$ | Move Hex (0x..., 32 bytes) |
$0.1 SUI$ atomic PTB gas drop |
| NEAR Protocol | Ed25519 + SHA-512 |
$P_{stealth} = S + Sha512(ctx \parallel r \cdot V)[0..32] \cdot B$ | 64-character lowercase hex | $0.05 NEAR$ implicit account drop |
| TRON Network | secp256k1 + Keccak + SHA256 |
$Base58Check(0x41 \parallel Keccak256(P_{uncompressed}[1..65])[12..32])$ | Base58Check (T..., 34 chars) |
$30 TRX$ Energy drop for TRC-20 USDT |
| Bitcoin | secp256k1 + RIPEMD160 + SHA256 |
$BIP-173 Bech32(\text{"bc"}, 0, RIPEMD160(SHA256(P_{compressed})))$ | Native SegWit (bc1q..., 42 chars) |
Native sats UTXO delivery |
| Cardano | Ed25519 + Blake2b-224 |
$CIP-19 Bech32(\text{"addr"}, 0x61 \parallel Blake2b-224(P_{stealth}))$ | Shelley Enterprise (addr1v..., 58 chars) |
$2 ADA$ MinUTXO deposit |
TRON Network ($60B+ USDT Volume Leader):
packages/crypto-core-wasm/src/tron.tssecp256k1 curve. Prepends 0x41 (mainnet prefix) to the 20-byte Keccak-256 address hash, appends a 4-byte double-SHA256 checksum, and encodes with Base58Check → T... (34 characters).TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t).Bitcoin Native SegWit (Global Reserve UTXO):
packages/crypto-core-wasm/src/bitcoin.tssecp256k1. Computes Hash160 ($RIPEMD160(SHA256(P_{compressed}))$), prepends witness version byte 0, and encodes with BIP-173 Bech32 with human-readable prefix "bc" → bc1q... (42 characters).bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4).Cardano Shelley Enterprise (Deterministic EUTXO):
packages/crypto-core-wasm/src/cardano.tsEd25519. Header 0x61 (Type 6 enterprise address + Mainnet ID 1) $\parallel$ $Blake2b-224(P_{stealth})$ (28 bytes) = 29 bytes. Encoded with CIP-19 Bech32 with HRP "addr" → addr1v... (58 characters).packages/web-dapp)In this lesson, we build and test the user-facing flagship: the Interphase Next.js Web DApp (packages/web-dapp).
We cover:
Code References:
"use client" reactive boundary for zero SSR hydration quirks with BigInt and WASM).backdrop-filter: blur(24px)), ambient radial gradient glows, responsive chips, and modern typography:Outfit: High-impact display headlines and primary buttons.Inter: Clean, high-legibility tabular DeFi data and labels.JetBrains Mono: Cryptographic hashes, public addresses, view-tags, and private keys.Inside page.tsx, when the user selects a destination ecosystem (e.g. Solana or Ethereum) and enters an amount:
const swap = await client.prepareSwap({
sourceChainId: 1, // Ethereum L1
sourceToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
sourceAmount: 5000n * 1_000_000n,
destChainId: 101, // Solana
destinationToken: "SOL",
recipientMetaAddress: {
chainFamily: "solana",
spendingPubKey: keys.spendingPub,
viewingPubKey: keys.viewingPub,
},
});
viewTag1 = 0xbf), and the native Atomic Gas Drop tag (β‘ 0.005 SOL + ATA Rent included).InterphaseEscrow with deterministic nullifier.Code Reference: src/app/page.tsx
How do mobile wallets detect stealth payments without killing the phone's battery?
Provides an interactive card grid detailing all 7 supported chains:
secp256k1 / ERC-5564 / Native Gas)Ed25519 / Base58 / $0.005 SOL$ + ATA Rent)Ed25519 / Move Hex / $0.1 SUI$ PTB Drop)Ed25519 / 64-char Hex / $0.05 NEAR$)secp256k1 / Base58Check / $30 TRX$ Energy)secp256k1 / BIP-173 Bech32 / Native Sats UTXO)Ed25519 / CIP-19 Bech32 / $2 ADA$ MinUTXO)The Next.js application compiles cleanly in production mode:
npm run build --workspace=@interphase/web-dapp
Output:
Route (app) Size First Load JS
β β / 34.4 kB 137 kB
β β /_not-found 985 B 104 kB
+ First Load JS shared by all 103 kB
β Built in 1145ms
All browser actions and UI flows were tested and verified locally.