Quick Start
Get started immediately with our complete working example that demonstrates Dynamic’s instant wallet authentication powering real-time interactions on Linera’s high-performance blockchain. Linera + Dynamic Real-Time Counter Demo This Vite demo project demonstrates the foundation for real-time Web3 applications:- Cross-origin isolation setup for Linera’s WebAssembly performance
- Dynamic’s frictionless wallet authentication for instant user onboarding
- Custom signer bridge enabling seamless transaction signing
- Live counter application with real-time state updates - the building block for real-time games, live auctions, and instant payment systems
Essential Components
To power real-time Web3 applications with Dynamic’s authentication on Linera, you need three key components that enable instant user onboarding and seamless interaction with high-performance blockchain applications. At a glance:- Cross-Origin Isolation Shim - JavaScript script that enables Dynamic’s social auth flows to work within Linera’s secure WebAssembly environment, ensuring users can authenticate instantly without security compromises
- Linera Adapter - TypeScript class that manages the connection between Dynamic wallets and Linera’s real-time blockchain infrastructure, handling the complex setup needed for high-throughput applications
- Dynamic Signer - TypeScript class that bridges Dynamic’s wallet signing with Linera’s time-sensitive transaction requirements, enabling fast signing for real-time interactions
1. Cross-Origin Isolation Shim
Linera’s real-time Web3 applications require cross-origin isolation for high-performance WebAssembly execution, but Dynamic’s seamless authentication flow uses iframes that can conflict with these requirements. This shim script resolves the conflict by automatically marking Dynamic’s auth iframes as credentialless, enabling instant social login without compromising Linera’s performance. Why it’s needed: Linera’s WebAssembly modules requirecrossOriginIsolated
to be true for optimal performance in real-time applications, which is enabled by setting specific security headers (Cross-Origin-Embedder-Policy: credentialless
, Cross-Origin-Opener-Policy: same-origin
, and Cross-Origin-Resource-Policy: cross-origin
). However, Dynamic’s authentication iframes from dynamicauth.com
don’t have the required headers, causing them to be blocked.
What it does: The shim intercepts iframe creation and automatically sets the credentialless
attribute on Dynamic’s auth iframes, allowing them to load within the secure context required by Linera’s high-performance WebAssembly environment - essential for real-time games, instant payments, and live social feeds.
Add this script to your index.html
before any other scripts:
2. Linera Adapter
The Linera adapter manages the connection between Dynamic wallets and Linera’s real-time blockchain infrastructure, orchestrating the complex initialization needed for high-performance Web3 applications that can handle thousands of simultaneous users. Why it’s needed: Real-time Web3 applications on Linera require specific initialization steps (WASM loading, faucet setup, chain claiming) that must be perfectly coordinated with Dynamic’s instant authentication flow. The adapter provides a clean interface for managing this complex setup process, ensuring users can jump into real-time games, live auctions, or instant payment systems without delays. What it does:- Initializes Linera’s high-performance WebAssembly modules for real-time execution
- Creates and connects Linera wallets using Dynamic’s authenticated user
- Manages chain claiming and application setup for time-sensitive applications
- Provides connection state management and callbacks optimized for real-time interactions
linera-adapter.ts
:
3. Dynamic Signer
The Dynamic signer bridges Dynamic’s familiar wallet signing experience with Linera’s time-sensitive transaction requirements, enabling users to approve real-time payments, game moves, auction bids, and other time-critical operations seamlessly. Why it’s needed: Real-time applications require fast, reliable transaction signing that doesn’t interrupt the user experience. Linera expects a specificSigner
interface for optimal performance, while Dynamic wallets provide familiar signing flows that users already trust. The signer bridges these two worlds, ensuring smooth authentication for time-sensitive transactions.
What it does:
- Implements Linera’s
Signer
interface using Dynamic’s trusted wallet capabilities - Handles proper message signing without double-hashing (critical for real-time transaction validity)
- Provides address verification and key management optimized for high-frequency operations
- Uses
personal_sign
directly to minimize signing delays in real-time applications
dynamic-signer.ts
:
Implementation Notes
Framework Compatibility
Linera’s high-performance WebAssembly architecture currently requires Vite for optimal real-time application development. Vite provides the fastest hot-reload experience for iterating on real-time games, live auctions, and instant payment interfaces.Critical Setup Requirements
-
Your real-time application must serve with these security headers for Linera’s WebAssembly performance:
- The iframe shim must be loaded before any other scripts to ensure instant authentication without blocking real-time interactions
- Configure your Linera RPC URL and application IDs for your specific deployment (testnet recommended for development of real-time applications)
Integration Flow for Real-Time Applications
- User authenticates instantly through Dynamic’s social login or embedded wallets
- Linera adapter connects using the authenticated wallet and claims a microchain for real-time operations
- Dynamic signer handles all transaction signing with minimal latency for time-sensitive operations
- Your application can now process real-time payments, game state updates, auction bids, and social interactions using Dynamic’s familiar UX on Linera’s high-performance infrastructure