Lux Docs
Lux Skills Reference

Lux Warp - Cross-Chain Messaging Protocol V2

Documentation for Lux Warp - Cross-Chain Messaging Protocol V2

Overview

Lux Warp (github.com/luxfi/warp) is the cross-chain messaging (XCM) protocol for Lux Network. It defines a message format and cryptographic standard for secure inter-blockchain communication using BLS signature aggregation. V2 adds post-quantum safety via ringtail validation and optional private messaging via Z-chain FHE.

Quick reference

ItemValue
Modulegithub.com/luxfi/warp
Go1.26.1
Protocol Version2.0
Max Message Size256 KiB
Codec Version0
CLI Binarywarp
Docker Imageluxfi/warp:latest
LicenseElastic-2.0

Message Format

UnsignedMessage

type UnsignedMessage struct {
    NetworkID     uint32   // Network identifier
    SourceChainID ids.ID   // 32-byte originating chain
    Payload       []byte   // Application-specific content
}

Message (signed)

type Message struct {
    UnsignedMessage *UnsignedMessage
    Signature       Signature   // BitSetSignature with BLS aggregation
}

Signature

type BitSetSignature struct {
    Signers   Bits                      // Bitmap of signing validators
    Signature [bls.SignatureLen]byte    // 96-byte aggregated BLS signature
}

Payload Types

TypePurpose
AddressedCallCross-VM contract calls
HashSimple 32-byte hash payload
AtomicSwapCross-chain atomic swap
L1ValidatorRegistrationValidator registration status
RegisterL1ValidatorAdd validator to subnet
SubnetToL1ConversionSubnet conversion message
L1ValidatorWeightValidator weight update

Architecture

github.com/luxfi/warp
├── message.go              # UnsignedMessage, Message, parsing, verification
├── signature.go            # Signature interface, BitSetSignature, BLS ops
├── signature_aggregator.go # Signature aggregation from multiple validators
├── signature_request.go    # Signature request/response protocol
├── validator.go            # Validator, CanonicalValidatorSet, ValidatorState
├── verifier.go             # Verifier interface
├── handler.go              # P2P handler interface
├── sender.go               # Message sender interface
├── codec.go                # Message codec (version 0)
├── bitset.go               # Bit set for signer tracking
├── chainipc.go             # Chain IPC communication
├── eventsocket.go          # Event socket for message notifications
├── error.go                # Error definitions
├── utils.go                # Utility functions (hash, overflow checks)
├── payload/                # Payload types
│   ├── payload.go          # AddressedCall, Hash, L1 payloads
│   ├── atomic_swap.go      # Cross-chain atomic swap payload
│   └── atomic_swap_test.go
├── backend/                # Backend interface for message storage
├── signer/                 # Signer implementations (local, remote)
├── signature-aggregator/   # Signature aggregation API service
├── relayer/                # Message relaying
│   └── config/             # Relayer configuration
├── bridge/                 # Bridge integration
├── precompile/             # EVM precompile integration
├── protocol/               # Protocol definitions (protobuf)
├── crypto/                 # Cryptographic utilities (BLS, hash)
├── config/                 # Configuration
├── validators/             # Validator set management
├── messages/               # Message types
├── types/                  # Type definitions
├── socket/                 # Socket communication
├── cmd/
│   ├── warpcli/            # Standalone CLI tool
│   └── plugin/             # Lux CLI plugin
├── docs/                   # Fumadocs documentation site (Next.js)
├── example/                # Usage examples
├── Dockerfile              # Container build
└── Makefile                # Build targets

API

Create and sign a message


// Create unsigned message
msg, err := warp.NewUnsignedMessage(networkID, sourceChainID, payload)

// Sign with multiple validators
signed, err := warp.SignMessage(msg, signerKeys, validators)

// Parse from bytes
parsed, err := warp.ParseMessage(rawBytes)

Verify a message

err := warp.VerifyMessage(
    msg,           // *Message
    networkID,     // uint32
    validatorState, // ValidatorState interface
    quorumNum,     // e.g., 67
    quorumDen,     // e.g., 100
)

BLS signature operations

// Sign
sig, err := warp.Sign(msgBytes, secretKey)

// Aggregate multiple signatures
aggSig, err := warp.AggregateSignatures(signatures)

// Verify with BitSetSignature
err := bitSetSig.Verify(msgBytes, validators)

// Get signed weight
weight, err := bitSetSig.GetSignedWeight(validators)

CLI Usage

# Build
make build-cli

# Create cross-chain message
warp create --source 0xAA --dest 0xBB --payload "Hello from chain A"

# Sign a message
warp sign --message <hex> --key ~/.lux/staking/signer.key

# Verify a signature
warp verify --message <hex> --signature <hex>

# Run relay server
warp serve --port 9650 --dev

# As Lux CLI plugin
lux warp create --source 96369 --dest 200200 --payload "Bridge LUX to ZOO"
lux warp sign --message <hex> --key ~/.lux/staking/signer.key
lux warp relay

V2 Improvements over V1

  1. Post-Quantum Safety: Random ringtail validation resists quantum attacks
  2. Enhanced Privacy: Ring signatures for validator anonymity
  3. Private Messaging: Z-chain FHE for private cross-chain messages (optional)
  4. Dynamic Validator Selection: Random subset validation
  5. Forward Secrecy: Ephemeral keys for message encryption
  6. Zero-Knowledge Proofs: Optional ZK proofs for message validity

Key Dependencies

github.com/luxfi/crypto@v1.17.40    — BLS12-381 signatures
github.com/luxfi/geth@v1.16.73      — EVM types (RLP encoding)
github.com/luxfi/ids@v1.2.9         — Chain/node ID types
github.com/luxfi/p2p@v1.18.9        — P2P networking
github.com/luxfi/codec@v1.1.4       — Message serialization
github.com/luxfi/vm@v1.0.27         — VM integration
github.com/luxfi/precompile@v0.4.5  — EVM precompile
github.com/spf13/cobra@v1.10.2      — CLI framework

Configuration

Environment Variables

VariablePurpose
WARP_RPC_URLRPC endpoint for blockchain connection
WARP_KEY_PATHPath to signing key
WARP_LOG_LEVELLogging level (debug, info, warn, error)

Config File (~/.warp/config.yaml)

rpc:
  url: http://localhost:9650/ext/bc/C/rpc
  timeout: 30s
signing:
  key_path: ~/.lux/staking/signer.key
relay:
  port: 9650
  chains:
    - id: 96369
      name: lux-mainnet
    - id: 200200
      name: zoo-mainnet

Integration Points

TargetMethod
EVM ChainsPrecompile at well-known address
Non-EVM ChainsNative module or system contract
Bridge ServicesRPC/gRPC API
Off-ChainMessage relay service
Lux CLIPlugin integration (cmd/plugin/)

Docker

# Build
make docker-build

# Run relay
docker run -d -p 9650:9650 luxfi/warp:latest serve

# Create message
docker run --rm luxfi/warp:latest create --source 0xAA --dest 0xBB --payload "Hello"

Testing

go test -v ./...
make test
make lint    # golangci-lint
make ci      # Full CI pipeline
  • lux/lux-node.md -- Node that processes warp messages
  • lux/lux-crypto.md -- BLS signatures used by warp
  • lux/lux-bridge.md -- Bridge that uses warp for cross-chain
  • lux/lux-evm.md -- EVM precompile for warp verification
  • lux/lux-precompile.md -- Precompile integration details

On this page