Bridge Architecture
The BWICK Bridge uses a Pool Bridge architecture with three main components: a custom Anchor program on Solana, thex/bridge module on bwickchain, and a relayer service connecting them.
System Overview
Solana Bridge Program
The Anchor program (v0.30.1) manages the pool vault and user accounts on Solana.Key Accounts
| Account | Type | Purpose |
|---|---|---|
BridgePool | PDA | Stores admin, relayer pubkey, vault address, deposit/withdrawal totals |
UserAccount | PDA | Links a Solana wallet to an bwickchain address, tracks per-user statistics |
Pool Vault | Token Account | Holds all deposited BWICK tokens in custody |
Instructions
| Instruction | Caller | Description |
|---|---|---|
register | User | Creates UserAccount PDA, links Solana wallet to bwickchain address |
deposit | User | Transfers BWICK from user to pool vault, emits DepositEvent |
withdraw | Relayer only | Transfers BWICK from pool vault to user’s token account |
pause / unpause | Admin | Emergency controls to halt bridge operations |
Address Validation
- bwickchain addresses must start with
bwick1and be 39+ characters - Solana addresses must be valid Base58 (32 bytes)
bwickchain Bridge Module
Thex/bridge module handles minting and burning on the bwickchain side.
Messages
| Message | Signer | Description |
|---|---|---|
MsgMintFromBridge | Relayer | Mints BWICK to a user’s chain address after a verified deposit |
MsgBurnForBridgeOut | User | Burns BWICK from the user’s account, emits event for relayer |
Burn Event Format
When a user burns tokens, the module emits aburn_for_bridge_out event:
burn_id serves as a deduplication key — the relayer will never process the same burn twice.
Relayer Components
The relayer is a Node.js service that monitors both chains and executes cross-chain actions.PoolMonitor (Solana Deposits)
- Primary: WebSocket subscription to program logs with
finalizedcommitment - Backup: Polls last 10 signatures for resilience
- Parses
DepositEventfrom transaction logs - Waits for 32-slot finality before forwarding to the EventProcessor
BurnMonitor (bwickchain Withdrawals)
- Polls bwickchain blocks for
burn_for_bridge_outevents - Extracts
burn_id, sender, amount, and Solana address from event attributes - Uses
burn_idas deduplication key (not transaction hash)
BwickExecutor
- Signs and broadcasts
MsgMintFromBridgeon bwickchain - Uses the authorized relayer address
- Exponential backoff retry on transient failures
PoolExecutor
- Executes
withdrawinstruction on the Solana bridge program - Derives PDAs:
bridge_pool,user_account,pool_vault - Creates or resolves the recipient’s Associated Token Account (ATA)
- No auto-retry on failures — alerts for manual intervention
EventProcessor
- Routes events to the appropriate executor
- Validates event data before processing
- Database-first recording (creates record before queueing action)
Security Features
Solana Side
- Admin controls — Pause, upgrade, and emergency withdraw capabilities
- Relayer authorization — Only the authorized relayer can execute withdrawals
- Minimum deposit — Prevents dust attacks (default: 1 BWICK)
- Event emission — Full audit trail via
DepositEventandWithdrawEvent
bwickchain Side
- Rate limiting —
max_burn_per_txandmax_burns_per_blockparameters - User-initiated burns — Users sign their own burns; the relayer cannot move funds
- Burn ID tracking — Unique
burn-{height}-{tx_index}format prevents duplicates - Governance control — Rate limits are adjustable via governance proposals
Relayer
- Finality wait — 32-slot confirmation before processing deposits
- Deduplication — Database checks prevent double-processing
- No auto-retry on withdrawals — Failed withdrawals require manual review
- Database-first — Records are persisted before actions are queued
Failure Handling
Failed Withdrawals
If a withdrawal fails on Solana:- PoolExecutor logs the error with
burn_idand failure reason - Database record is marked as
failed - No auto-retry — manual intervention required
- Admin investigates and manually re-executes if needed
Relayer Downtime
If the relayer goes offline:- Deposits: PoolMonitor resumes from the last processed Solana signature
- Burns: BurnMonitor resumes from the last processed block height
- No transactions are lost (database tracks processing state)
Next Steps
Fees & Limits
Rate limits, minimums, and gas requirements
FAQ
Common questions about the bridge

