Skip to main content

InstaWrap Module

InstaWrap enables instant cross-chain asset wrapping, allowing users to receive wrapped tokens immediately without waiting for confirmations.

Overview

Traditional bridge: Wait 6 BTC confirmations (~60 minutes) InstaWrap: Receive wBTC instantly, LP takes confirmation risk

┌─────────────────────────────────────────────────────────────┐
│ InstaWrap Flow │
│ │
│ Bitcoin Network RP1 Network │
│ ┌────────────┐ ┌────────────┐ │
│ │ Send BTC │────0 conf────────▶│ Instant │ │
│ │ to bridge │ │ wBTC credit│ │
│ └────────────┘ └────────────┘ │
│ │ │ │
│ │ │ │
│ ▼ ▼ │
│ Confirmations LP backs the credit until │
│ accumulate confirmations complete │
│ │ │ │
│ │ │ │
│ ▼ ▼ │
│ 6 confirmations Credit finalized, LP released │
│ │
└─────────────────────────────────────────────────────────────┘

Supported Chains

ChainAssetConfirmationsInstant Credit
BitcoinBTC → wBTC6✅ Yes
EthereumETH → wETH12✅ Yes
SolanaSOL → wSOL32✅ Yes
EthereumERC20s12✅ Yes

Instant Credit

How It Works

  1. User sends BTC to bridge address
  2. Relayer detects 0-conf transaction
  3. LP pool provides instant wBTC credit
  4. User can use wBTC immediately
  5. As confirmations increase, credit finalizes
  6. LP released after full confirmation

Fee Structure

ConfirmationsFeeDescription
00.1%Instant credit (highest risk)
1-20.05%Partial confirmation
3-50.02%Near-final
6+0%Fully confirmed

Using InstaWrap

Deposit (Wrap)

# Get your unique deposit address
rp1d query instawrap deposit-address \
--chain bitcoin \
--recipient $(rp1d keys show my-wallet -a)

# Output: bc1q... (send BTC here)

Check Deposit Status

rp1d query instawrap deposit \
--tx-hash <bitcoin_tx_hash>

Withdraw (Unwrap)

rp1d tx instawrap withdraw \
--chain bitcoin \
--amount 0.1wbtc \
--destination bc1q... \
--from my-wallet

TypeScript SDK

import { InstaWrap } from '@rp1/sdk';

const bridge = new InstaWrap(client);

// Get deposit address
const depositAddr = await bridge.getDepositAddress({
chain: 'bitcoin',
recipient: wallet.address,
});

// Check deposit status
const status = await bridge.getDepositStatus(btcTxHash);
console.log(`Status: ${status.status}`);
console.log(`Confirmations: ${status.confirmations}`);
console.log(`Instant: ${status.instant}`);

// Withdraw
const tx = await bridge.withdraw({
chain: 'bitcoin',
amount: '10000000', // 0.1 BTC in satoshis
destination: 'bc1q...',
});

Liquidity Providers

Provide Liquidity

LPs earn fees from instant credit:

rp1d tx instawrap provide-liquidity \
--amount 100000000wbtc \
--from my-wallet

Withdraw Liquidity

rp1d tx instawrap withdraw-liquidity \
--amount 50000000wbtc \
--from my-wallet

LP APY

AssetCurrent APYVolume (24h)
wBTC5-15%Varies
wETH3-10%Varies
wSOL4-12%Varies

Message Types

MsgDeposit

message MsgDeposit {
string sender = 1;
string chain = 2;
bytes tx_hash = 3;
bytes proof = 4;
}

MsgWithdraw

message MsgWithdraw {
string sender = 1;
string chain = 2;
cosmos.base.v1beta1.Coin amount = 3;
string destination = 4;
}

Parameters

ParameterDefaultDescription
instant_credit_enabledtrueEnable 0-conf credits
instant_threshold100000000Max instant amount (satoshis)
max_instant_credit1000000000Maximum instant credit
base_fee0.0010.1% base fee

Events

EventTypeDeposit = "instawrap_deposit"
EventTypeInstantCredit = "instawrap_instant_credit"
EventTypeWithdraw = "instawrap_withdraw"
EventTypeLiquidityProvided = "instawrap_lp_provided"

Security

Double-Spend Protection

If the source chain transaction is double-spent:

  1. Credit is revoked
  2. User's wBTC burned
  3. If already spent, becomes "bad debt"
  4. LP compensated from insurance fund

Oracle Verification

// Multiple relayers must confirm deposit
type DepositProof struct {
TxHash []byte
BlockHash []byte
MerkleProof []byte
Signatures []ValidatorSignature // 2/3+ required
}

Next Steps