Claim Locked Funds

EVM-Compatible Networks

Permissionless Token Refund

function claim(bytes32 tradeId, TradeDetail calldata detail) external;

πŸ” Permissionless Execution

  • Callable by anyone. Funds are always transferred to the refundAddress, ensuring there is no risk of unauthorized access or fund diversion.

  • Allows third parties (e.g., bots or monitoring services) to trigger refunds on behalf of users.

πŸ”Ž Trade Validation

  • Can only be executed after the specified timeout (block.timestamp > detail.timeout) has passed.

  • Verifies that the provided TradeDetail matches the recorded hash for the given tradeId.

  • Prevents unauthorized or malicious claim attempts by enforcing input authenticity.

πŸ›‘οΈ Replay Protection

  • Deletes the stored hash for the tradeId before transferring funds.

  • Protects against replay attacks and reentrancy exploits.

πŸ’Έ Fund Transfer

  • Transfers the locked funds to the refundAddress specified in the original trade.

  • The method of transfer depends on the Vault type (either native coin or ERC-20 token).

πŸ“’ Event Emission

  • Emits a Claimed event upon successful execution.

Bitcoin Network

Permissionless Token Refund

// User-controlled withdrawal after timelock
<TimelockBlocks> OP_CHECKSEQUENCEVERIFY OP_DROP <UserPK> OP_CHECKSIG

// Multi-sig spending path (before timeout)  
<SettlementCommitteePK> OP_CHECKSIG <UserPK> OP_CHECKSIGADD OP_2 OP_NUMEQUAL

πŸ” Permissionless Execution * Callable by the user after 144 blocks (~24 hours). Funds are always transferred to the user's specified address, ensuring no risk of unauthorized access or fund diversion. * Allows third parties (e.g., bots or monitoring services) to trigger refunds on behalf of users after timeout expiration.

πŸ”Ž Trade Validation

  • Can only be executed after the specified timeout (144 Bitcoin blocks β‰ˆ 24 hours) has passed using OP_CHECKSEQUENCEVERIFY.

  • Script validates that the timeout condition is met before allowing fund withdrawal.

  • Prevents unauthorized or malicious claim attempts by enforcing Bitcoin's consensus-level timelock mechanism.

πŸ›‘οΈ Replay Protection

  • Bitcoin's UTXO model inherently prevents replay attacks - once a UTXO is spent, it cannot be spent again.

  • Each vault creates a unique P2TR address with specific script conditions that can only be executed once.

πŸ’Έ Fund Transfer

  • Transfers the locked Bitcoin to the user's specified refund address via native Bitcoin transactions.

  • The method depends on which script path is executed (timelock for user claims, multisig for trade settlements).

πŸ“‘ Transaction Confirmation

  • Bitcoin transaction is broadcast to the network and confirmed through the standard Bitcoin mining process.

  • Transaction details are permanently recorded on the Bitcoin blockchain for full transparency.


For complete technical specifications and implementation details, refer to the Bitcoin Vault Script documentation.

Solana Network

Permissionless Token Refund

pub struct ClaimArgs {
    /// The tradeId, unique identifier for the trade.
    pub trade_id: [u8; 32],
}
pub fn handler_claim<'c: 'info, 'info>(
    ctx: Context<'_, '_, 'c, 'info, Claim<'info>>,
    claim_args: ClaimArgs,
) -> Result<()>

πŸ” Permissionless Execution

  • Callable by anyone. Funds are always transferred to the refund_pubkey, ensuring there is no risk of unauthorized access or fund diversion.

  • Allows third parties (e.g., bots or monitoring services) to trigger refunds on behalf of users.

πŸ”Ž Trade Validation

  • Can only be executed after the specified timeout (Clock()::get.unix_timestamp> trade_detail.timeout) has passed.

  • Can only be executed for the TradeDatail in the Deposited state.

  • Verifies that the provided TradeDetail matches the recorded hash for the given tradeId.

  • Prevents unauthorized or malicious claim attempts by enforcing input authenticity.

πŸ›‘οΈ Replay Protection

  • Update the status of corresponding TradeDetail account from Deposited to Claimed

  • Transfer the asset stored in the corresponding vault and ONLY that vault to refund_pubkey

πŸ’Έ Fund Transfer

  • Transfers the locked funds to the refund_pubkey specified in the original trade.

  • The method of transfer depends on the Vault type (either native coin or SPL token).

Last updated