Skip to content

Authentication

Multi-chain signature verification and replay protection

On this page

Authentication Overview

The app offers sign-in with Bitcoin wallets, Ethereum wallets, Solana wallets, and Internet Identity. The Lending Canister verifies Solana wallet signatures with Ed25519.

New profiles are created with register_profile. Additional wallets are linked with add_wallet. Every signed request includes the wallet's current nonce and an expiry.

LendingWalletLendingWalletalt[Bitcoin][Ethereum][Solana]Userinitialize_account(chain, address)Generate nonceChallenge messageSign messageSignatureSignedRequest(data, signature, account, chain)Verify BIP322 signatureVerify EIP-191 signatureVerify Ed25519 signatureDerive PrincipalIncrement nonceSuccessUser

Wallet Abstraction

Users are identified by their wallet address as a (Chain, Address) tuple:

  • (Bitcoin, "bc1q...")
  • (Ethereum, "0x...")
  • (Solana, "7Np4...")

Profile Principal

Each profile has its own principal, assigned by the Lending Canister when the profile is registered. Wallets are mapped to that profile, so one profile can have several wallets. Look up the profile for a wallet with the get_wallet_profile query.

Signature Verification

Chain Standard Description
Bitcoin BIP322 Message signing standard, supports P2WPKH, P2TR, P2PKH, P2SH-P2WPKH
Ethereum EIP-191 personal_sign standard with prefix, recovers signer address
Solana Ed25519 Direct signature verification against public key

Message Format

Signed requests include:

  • data: Operation-specific data, including an expiry timestamp
  • signature_info: The wallet signature, chain, and wallet address, or the Internet Computer caller for ICP-based sign-ins

The signed message is human-readable and includes:

  1. The action and its details (operation-specific)
  2. The expiry (Unix seconds, at most 5 minutes in the future)
  3. The wallet's current nonce (replay protection)

See Use Liquidium without the app for the exact withdrawal message.

Replay Protection

Nonce System

Each account has an incrementing nonce. The provided nonce must match the expected value, and is incremented after each successful request.

LendingUserLendingUserReplay attemptget_nonce(account)nonce = 5Sign message with nonce 5SignedRequest(nonce=5, ...)Verify nonce == 5 ✓Increment nonce to 6SuccessSignedRequest(nonce=5, ...) [replay]Verify nonce == 6 ✗Error: InvalidNonce

Properties

  • Monotonic: Nonces only increase
  • Per-account: Each account has its own nonce
  • Atomic increment: Nonce incremented with operation

Account Initialization

New accounts are created in one signed request:

  1. The client reads the wallet's nonce with get_nonce(address)
  2. The user signs the registration message with their wallet
  3. The client submits it to register_profile
  4. The protocol verifies the signature, increments the nonce, and creates the profile

Multi-Wallet Profiles

Users can link multiple wallets to a single profile:

Benefits:

  • Unified positions across wallets
  • Deposit from Bitcoin, withdraw to Ethereum
  • Single health factor for all collateral

Authorization Checks

Context Verification
User Operations Signature verification + account ownership + nonce increment
Inter-Canister Calls Caller must be the lending canister
Admin Operations Caller must have admin privileges

Security Properties

Property Mechanism
Authentication Cryptographic signature verification
Non-repudiation Only private key holder can sign
Replay protection Incrementing nonce per account
Freshness Nonce must match expected value
Authorization Profile ownership verification

Users can interact with Liquidium using their existing wallets. No new keys or accounts needed - just sign with a Bitcoin or Ethereum wallet, or use Internet Identity.

Esc