Spacewalk: a Stellar bridge
- Team Name: Pendulum
- Payment Address: 0x41826C59a853969DA6B819130E1c32A9fd7c94ba (DAI)
- Level: 2
- Status: Terminated
Project Overview πβ
Overviewβ
Spacewalk is a bridge between Substrate-based parachains and Stellar which enables asset transfers to and from Stellar. This grant application is for developing the Spacewalk protocol and pallet. The Spacewalk bridge is built by the team behind the Pendulum network (an upcoming parachain that connects fiat tokens from across multiple blockchain ecosystems).
Project Detailsβ
Spacewalk bridge is developed to be a decentralized and trustless bridge to Stellar. This bridge enables two main activities:
- Deposit: bridge any Stellar asset to Substrate-based chains. The tokens of the source asset are transferred to some dedicated vault in Stellar where they are locked. The bridge then mints wrapped tokens in the target chain and transfers them to the recipient account.
- Withdrawal: bridge wrapped tokens in Substrate-based chains to Stellar. First, the user instructs the bridge to burn wrapped tokens in the Substrate-based chain. Afterwards, an appropriate vault unlocks tokens and transfers them to some target account.
Stellar is not smart contract capable β therefore we follow the recommendation laid out in the Polkadot documentation and base our bridge design on XCLAIM, which is based on the following four core features:
- Implement a chain relay for Stellar in the bridge pallet
- Employ collateralization in order to ensure that the vault exhibits good behavior
- Ensure that the economic value of the collateral exceeds the value of the vault
- Enable a decentralized network of vaults
XCLAIM has been implemented and further improved by Interlay for the open source Bitcoin bridge interBTC. Spacewalk is based on the interBTC implementation. It differs from interBTC as follows:
- Currently Stellar does not use Merkle trees inside its blocks. Therefore, there is no efficient way to prove that a transaction is included in a block given only the block header β a prover would require to complete the complete set of transactions instead of a Merkle path.
- Stellar does not employ Nakamoto consensus but a custom consensus algorithm called Stellar Consensus Protocol. For that reason it is not possible to infer from sequences of block headers alone which sequence is valid βΒ for Nakamoto consensus this is simply the sequence with the highest amount of work.
- Stellar supports custom assets: every account holder can create new assets and mint their own tokens. Spacewalk supports to bridge any Stellar asset to the Substrate chain. This implies that the Spacewalk pallet can dynamically create and mint new assets that are not known beforehand.
The first two differences imply that there is no efficient way to implement an SPV client and a chain relay for Stellar. Spacewalk will address this by replacing the chain relay with an oracle for Stellar.
Architecture
The architecture of the bridge consists of the following components:
- Vaults: this is a set of escrow accounts used to lock assets in Stellar. Their behavior is defined in XCLAIM and interBTC. In Spacewalk they have an additional property: each vault has an allow list of assets that it can lock and support for bridging operations between Stellar and the Substrate chain. This allow list is implemented through trustlines of the Stellar account. There can be at most 1000 supported assets per vault due to limitations in Stellar. Stellar users initiate a deposit by sending tokens to an appropriate vault, which they request from the bridge pallet prior to the deposit. Likewise vaults will unlock and send tokens back to Stellar accounts during a withdrawal. Every vault needs to lock a certain amount of DOT or KSM (or related) tokens as collateral with the bridge pallet. These tokens are slashed in case the vault misbehaves.
- Bridge Pallet: this is the main component of the Spacewalk bridge that implements all logic on the side of the Substrate-based chain. Its behavior is based on interBTC. It is particularly responsible for minting tokens during deposits and burning tokens during withdrawals. It is able to support any Stellar asset by employing the Tokens and Currrencies pallets of the Substrate Open Runtime Module Library. The storage of the bridge pallet maintains the complete state that is required for the bridge to work correctly. This state contains (among others): the account ids of the vaults, the asset allow lists of each vault and book keeping information about the state of the Stellar network.
- Stellar Oracle: is a decentralized system that provides information about the state of the Stellar network to the bridge pallet. In interBTC this is implemented through a Bitcoin chain relay. However, for reasons explaned above we cannot implement a chain relay for Stellar in the same way. The Stellar oracle is trustless and reliable and its functionality is based on specific unique aspects of Stellar:
- The Stellar network has multiple levels of tiers, where the nodes in Tier 1 enjoy the highest level of trust of its peers. There are currently 23 Tier 1 nodes; this set and its structure is rather static and only changes rarely. It only ever changes through a voting process. We will incorporate complete information about the Tier 1 network in the bridge pallet.
- Every Stellar node has a static signing key pair and signs messages that it gossips to the network. Particularly, every node announces through a signed message that a block has been finalized. The decentralized oracle will forward these signed messages from Tier 1 nodes to the bridge pallet. This way the bridge pallet can reliably infer what Stellar blocks are finalized.
Out of scope
The following aspects are out of scope of the current proposal and subject to future applications:
- Stellar protocol updates that are required to implement a chain relay/light client/simplified payment verification for Stellar as a Substrate pallet