Skip to content
SORA Codex Community-curated documentation

Polkadot Bridge (XCM)

SORA v2 operates as a parachain in the Polkadot ecosystem, enabling native cross-chain communication through XCM (Cross-Consensus Messaging). This integration provides shared security, interoperability with other parachains, and access to the broader Polkadot DeFi ecosystem.

Native XCM

Direct messaging with other parachains.

Asset Transfers

Move tokens between Polkadot chains.

Remote Execution

Execute transactions on other chains.


┌───────────────────────────────────────────────────────┐
│ Polkadot Relay Chain │
│ (Shared Security) │
└───────────┬───────────────┬───────────────┬───────────┘
│ │ │
┌───────▼───────┐ ┌─────▼─────┐ ┌───────▼───────┐
│ SORA │ │ Acala │ │ Moonbeam │
│ Parachain │ │ Parachain │ │ Parachain │
│ │ │ │ │ │
│ ┌───────────┐ │ │ │ │ │
│ │ Polkaswap │ │ │ │ │ │
│ │ DEX │ │ │ │ │ │
│ └───────────┘ │ │ │ │ │
└───────────────┘ └───────────┘ └───────────────┘
BenefitDescription
SecurityValidators shared with relay chain
FinalityBlocks finalized by relay chain
InteropNative XCM with all parachains
UpgradesForkless runtime upgrades

XCM is a messaging format that allows different consensus systems to communicate:

  • Cross-Consensus — Works across different blockchains
  • Messaging — Structured instruction format
  • Versioned — Backward compatible upgrades

Move assets between chains:

Xcm(vec![
// Withdraw from origin
WithdrawAsset(assets.clone()),
// Buy execution on destination
BuyExecution {
fees: fee_asset,
weight_limit: Unlimited
},
// Deposit to recipient
DepositAsset {
assets: Wild(All),
beneficiary: destination_account,
},
])

From another parachain to SORA:

// On source parachain
let xcm_message = Xcm(vec![
WithdrawAsset(MultiAssets::from(vec![
(GeneralIndex(asset_id), amount).into()
])),
InitiateReserveWithdraw {
assets: Wild(All),
reserve: SORA_PARACHAIN_LOCATION,
xcm: Xcm(vec![
BuyExecution {
fees: (GeneralIndex(XOR_ID), fee).into(),
weight_limit: Unlimited,
},
DepositAsset {
assets: Wild(All),
beneficiary: sora_account,
},
]),
},
]);
pallet_xcm::send(origin, dest, xcm_message)?;

From SORA to another parachain:

// On SORA
let xcm_message = Xcm(vec![
WithdrawAsset(MultiAssets::from(vec![
(GeneralIndex(ASSET_ID), amount).into()
])),
InitiateTeleport {
assets: Wild(All),
dest: DESTINATION_PARACHAIN,
xcm: Xcm(vec![
BuyExecution { fees, weight_limit: Unlimited },
DepositAsset {
assets: Wild(All),
beneficiary: recipient,
},
]),
},
]);

ChainDirectionAssets
Polkadot RelayBidirectionalDOT
AcalaBidirectionalACA, aUSD, XOR
MoonbeamBidirectionalGLMR, XOR
AstarBidirectionalASTR, XOR

SORA maintains a registry of foreign assets:

// Query registered foreign assets
let foreign_assets = api.query.xcmPallet.foreignAssets.entries();
// Each asset maps to a MultiLocation
// Example: DOT from relay chain
MultiLocation {
parents: 1,
interior: Here,
}

Assets and accounts are identified by MultiLocation:

// SORA on Polkadot
MultiLocation {
parents: 0,
interior: X1(Parachain(SORA_PARA_ID)),
}
// XOR on SORA
MultiLocation {
parents: 0,
interior: X2(
Parachain(SORA_PARA_ID),
GeneralKey(XOR_ASSET_ID),
),
}
// Account on SORA
MultiLocation {
parents: 0,
interior: X2(
Parachain(SORA_PARA_ID),
AccountId32 { network: None, id: account_bytes },
),
}

XCM operations consume weight:

OperationApproximate Weight
WithdrawAsset1,000,000
DepositAsset1,000,000
BuyExecution500,000
TransactVariable

Polkaswap can trade assets from any connected parachain:

  1. Receive via XCM — Assets bridged to SORA
  2. Wrap if needed — Foreign assets wrapped
  3. Trade on DEX — Swap for any listed pair
  4. Send via XCM — Transfer results to destination

Polkaswap aggregates liquidity across:

  • Native SORA pools
  • XCM-bridged assets
  • Ethereum-bridged assets (via HASHI)

SORA v2 is a Substrate-based parachain on Polkadot.

SORA v3 transitions to Hyperledger Iroha 3:

Aspectv2 (Current)v3 (Planned)
FrameworkSubstrateIroha 3
XCMNativeVia bridge
PolkadotParachainBridge connection

Use local relay chain for testing:

Terminal window
# Start local Polkadot relay
zombienet spawn config.toml
# Deploy SORA parachain
./target/release/sora-parachain \
--collator \
--chain sora-local

Common XCM issues:

ErrorCauseSolution
TooExpensiveInsufficient feesIncrease BuyExecution amount
AssetNotFoundUnregistered assetRegister asset first
LocationNotFoundWrong destinationCheck MultiLocation format
BarrierSecurity filterVerify allowed origins