Skip to main content

@provablehq/aleo-bridge-sdk

The package versions in lockstep with the veil-* packages. Execution runs through registry-keyed chain clients for every route in the reviewed catalog; deprecated options stay supported until the next major release.

The bridge client assigns each asset family to its canonical protocol:

  • Circle xReserve moves USDC into and out of Aleo as USDCx.
  • Circle CCTP moves native USDC between Arc and Ethereum, Base, or Arbitrum.
  • Verulink moves public native ALEO to wrapped ALEO on BNB Smart Chain (BSC) and back. Both directions require a destination claim and BNB for BSC gas.
  • Hyperlane Warp Routes move ETH, WBTC, USDT, SOL, BAT, USDG, and ZEC. Hyperlane ALEO and USAD entries remain available for deployment discovery and require complete metadata before quoting or execution.
  • jitoSOL uses Hyperlane between Solana and Aleo with 9 decimals on both chains. Both directions are registered as active; on-chain pause flags control whether mints and burns proceed.
  • NVDAx uses Hyperlane between Solana and Aleo with 8 decimals on both chains, Token-2022 collateral on Solana, and shield_arc22_nvdax.aleo on Aleo. Both directions are active. Amounts use raw mint units without the Solana scaled UI multiplier.

The current API provides a versioned route registry, discovery, and transfer quotes that return the validated execution plan:

import { createBridgeClient } from '@provablehq/aleo-bridge-sdk'

const bridge = createBridgeClient({ environment: 'mainnet' })
const quote = await bridge.quote({
source: { chain: 'ethereum', asset: 'usdc' },
destination: { chain: 'aleo', asset: 'usdcx' },
bridgeProtocol: 'xreserve',
amount: '25',
recipient: aleoAddress,
})
const plan = quote.plan

quote validates the route, decimal precision, and recipient and returns the ordered approval, protocol, attestation/delivery, and destination steps with current costs where available. It does not sign or move funds.

Fund-moving actions accept an optional onCheckpoint hook. The compact value contains its format version, public transfer intent, resolved route, and transaction recovery data. Local Aleo clients emit a fully proved serialized transaction before broadcast and a submitted identifier afterward. EVM, Solana, and injected-wallet APIs checkpoint after their submission method returns. Checkpoints exclude wallet secrets, private-mint nonces, records, proofs, and Circle response bodies.

const execution = await bridge.execute({
plan,
onCheckpoint: saveCheckpoint,
})

After an interruption, recover reconstructs progress through read-only chain and protocol requests. It never signs, proves, or submits a transaction.

const progress = await bridge.recover({
checkpoint: await loadCheckpoint(),
})

recover rebuilds the runtime plan and returns next: 'wait' | 'resume' | 'complete' | 'done' | 'failed'. wait({ progress }) polls to the next caller boundary, resume({ progress }) continues an approval-interrupted source flow or broadcasts the exact checkpointed Aleo source transaction. A prepared Aleo private mint recovers to complete({ progress }), which broadcasts that exact destination transaction. The lower-level getStatus remains available for one status read. Pass until to wait to stop at an additional protocol state.

onProgress reports Aleo proving boundaries for UI and timing instrumentation. Solana native-SOL quotes include the bridged amount, IGP payment, network fee, and required rent in totalLamports. SPL-collateral quotes report the token amount in amountLamports for backwards compatibility and exclude it from the SOL-denominated totalLamports. Aleo xReserve withdrawals subtract the deployed 2 USDCx fee and require a positive net amount. Aleo Hyperlane quotes report the public hook payment; their account-specific execution fee and total remain null until transaction construction.

Hyperlane routes marked metadata-required are known route families whose complete execution deployment has not been pinned yet. Applications MUST NOT execute them until a reviewed registry marks them active.

An active route can still be halted on chain. Every Aleo program in a route asserts a pause mapping inside finalize, the xReserve contract and CCTP MessageTransmitter expose paused(), and the Ethereum Hyperlane Mailbox runs a pausable hook on dispatch to Aleo and a pausable ISM on delivery from it. The registry records where each flag lives, and getRouteStatus({ routeId }) reads them all, reporting active, paused, unknown, or skipped per flag. quote results carry paused and routeStatus, and execute, resume, and complete throw BridgeRoutePausedError before asking the wallet for anything when a flag is set. A flag that cannot be read does not block, since the chain enforces the pause either way; pass skipRouteStatus: true to skip the reads.

const status = await bridge.getRouteStatus({ routeId: plan.route.id })
if (status.paused) throw new Error(`Route halted: ${status.sources.filter((s) => s.state === 'paused').map((s) => s.kind).join(', ')}`)

BAT, USDG, and ZEC are active in both directions between Aleo and Solana. BAT and ZEC use classic SPL Token accounts, while USDG uses Token-2022. The SDK tracks Aleo-to-Solana delivery through the recipient's associated token account.

Privy and Dynamic server wallets​

A backend can authorize bridge transfers with existing Privy or Dynamic server wallets. Import the helpers from the provider entry point:

ProviderImportHelpers
Privy@provablehq/aleo-bridge-sdk/privycreatePrivyEvmClient, createPrivySolanaClient
Dynamic@provablehq/aleo-bridge-sdk/dynamiccreateDynamicEvmClient, createDynamicSolanaClient

Each helper takes an authenticated provider client, wallet identity, and public RPC transport, returning the bridge's existing EVM or Solana client. Construction does not sign or submit. Provider SDKs are optional peers and are not loaded by the bridge's root entry point.

import { createBridgeClient, evmHttp, solanaHttp } from '@provablehq/aleo-bridge-sdk'
import { createPrivyEvmClient, createPrivySolanaClient } from '@provablehq/aleo-bridge-sdk/privy'

const ethereum = await createPrivyEvmClient({
client: privy,
walletId: evmWallet.id,
address: evmWallet.address,
transport: evmHttp(ethereumRpcUrl),
})
const solana = await createPrivySolanaClient({
client: privy,
walletId: solanaWallet.id,
address: solanaWallet.address,
transport: solanaHttp(solanaRpcUrl),
})
const bridge = createBridgeClient({
environment: 'mainnet',
clients: { ethereum, solana, aleo },
})

Privy helpers accept an optional authorizationContext. Dynamic helpers take the full persisted walletMetadata, optional password and externalServerKeyShares, and, for Solana, a required policy chainId such as '101' for mainnet. That identifier MUST match the configured Solana RPC. Solana sponsorship is disabled to preserve the bridge's existing signatures.

See the server-wallet setup guide and runnable examples for installation, tested dependency versions, provisioning, and credential configuration. Use the regular quote, execute, wait, and recovery lifecycle after creating the clients.

Configure both Aleo and BSC readers, and provide a wallet for each chain when executing both legs. The normalized chain key is bsc and the protocol is verulink. Quotes read current onchain fees and net minimums; gas remains unpriced. Source submission calls the deployed token service directly.

The SDK retrieves offchain signatures from Verulink's collector after checking the source packet onchain. It verifies current attestors and cryptographic signatures before complete submits the destination claim. Install the optional @provablehq/sdk peer for BSC → Aleo signature verification. Wrapped ALEO does not pay BSC gas; the account needs BNB separately.

Keep every checkpoint and record an attempt before invoking a wallet. Approval-only BSC recovery refuses automatic resubmission because a later burn may already be pending. Recover with the wallet's source transaction hash. Prepared Aleo transactions reuse the same bytes and identifier. Packet consumption alone is not completion; the SDK verifies recipient delivery and distinguishes funds sent to screening holding.

The round-trip example previews 20 ALEO by default and requires an explicit environment opt-in to move funds. Its second leg returns the amount actually received.