Authentication
Multi-chain signature verification and replay protection
Authentication Overview
The app offers sign-in with Bitcoin wallets, Ethereum wallets, and Internet Identity. The Lending Canister can also verify Solana (Ed25519) signatures, but Solana sign-in and Solana assets are not available.
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.
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:
- The action and its details (operation-specific)
- The expiry (Unix seconds, at most 5 minutes in the future)
- 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.
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:
- The client reads the wallet's nonce with
get_nonce(address) - The user signs the registration message with their wallet
- The client submits it to
register_profile - 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.