Kaan
jj7302
We seek to create a Stellar specific bridge that allows users to bridge XLM from the Stellar ecosystem to Cosmos. We’re planning to use a Lock & Mint / Burn & Redeem bridge to allow users to move to XLM from the Stellar network to a new asset, wrapped Stellar (wXLM), specific to use in the Cosmos ecosystem. With the coming release of Soroban to mainnet we believe that bridges between Stellar and other prominent ecosystems, like Cosmos, will see vastly increased demand. After bridging XLM to Cosmos, our future goals include adding support for bridging other popular Stellar assets to Cosmos, bridging Cosmos assets to Stellar, and bridging Stellar tokens to other blockchains.
Motivation:
Stellar is a prominent ecosystem but would benefit greatly from having more bridges and being connected to other chains. With our new bridge, we hope to be able to create the functionality that allows Stellar to be connected to the larger ecosystem.
Competitors:
No attempts have been made to build a bridge directly between Soroban and Cosmos.
While bridges such as Ionic and Allbridge are in development or completed, neither of them connect to Cosmos, and they only support stablecoins and native Eth.
Litepaper:
https://docs.google.com/document/d/1R2LCdsRPgZ7x54ZGC0lXxTVjW3zTe7EwPBybtsHootg/edit?usp=sharing
Bridge XLM from Soroban → Cosmos
A user wishing to bridge tokens from Soroban to Cosmos will first call a function on the Soroban contract which will take the users XLM, lock it in the bridge contract, and emit an Event on Soroban. Each subsequent Event is assigned a monotonically increasing nonce. Validators running the Orchestrator are checking for these events every few seconds, by making Soroban-RPC calls. Once they see an event has been emitted, they will create a Claim of the event they’ve observed and then send it to Cosmos.
From here our Cosmos bridge module will process these claims. After checking that the submitted claim has a nonce one greater than the last submitted by this validator, the module will either create a new Attestation if this event hasn’t been seen before, or add the claim to an existing Attestation. At the end of each block a check is run to see if 2/3rds of the voting power have confirmed an attestation, in which case we mint the corresponding wXLM (wrapped XLM) and send it to the desired address.
Withdrawing XLM from Cosmos → Soroban
When a user wishes to trade in their wrapped XLM for native XLM in Soroban, they will send a message to Cosmos with two fees. The first fee is used for the execution on Cosmos and the second will go to the relayers later. The Cosmos module will process this message, take the wXLM from the account, and place it in a pool of transactions waiting to be processed. Here validators will sign the transactions and once a transaction has enough signatures to go through, a relayer will decide to execute the transaction on Soroban if the second fee is enough to make it a profitable execution. Batching of transactions will not be supported initially but is one of the first upgrades planned after building the MVP.
Once a relayer decides to execute a transaction, it marks it as being submitted, and a function is called on the Stellar contract which will return the users funds and emit an event recognizing the execution of this transaction. In the same way the event emitted by a locking of tokens is handled, this event will be processed by the validators and the processed transaction will be removed from the pool of transactions waiting to execute and corresponding wXLM will be burned.
5 main components:
A Soroban contract that allows users in the Stellar ecosystem to lock XLM into our bridge contract. This contract will include a function which can be called by users who wish to bridge and will lock XLM into the contract. At the end of this function's execution an event will be emitted for validators to listen to. Similarly the contract will have a function to return XLM to users that emits an event upon completion. It will also be responsible for storing a hash of the most recently updated validator set and confirming that the signatures for a Cosmos → Soroban transaction are valid.
The next key component is the validator set, each of which will run a full Cosmos node and the bridge module. The validators will listen for the events emitted when functions on the Soroban contract finish execution and subsequently submit a claim message to the bridges cosmos module. The validator is also responsible for signing transactions when a user wishes to redeem their wXLM for XLM. The validator consists of three components, an oracle which accesses the Stellar blockchain through Soroban-RPC calls made by running a full Stellar Core node and horizon server, an orchestrator which runs the main loop of the validator for bridging logic, a signer to sign transactions headed to Soroban, and the full Cosmos node. We will create our proof of concept to support a single validator at first and then extend the implementation to support the addition of new validators to the valset.
The Cosmos module will be listening for the claims sent in by the orchestrator part of validators. The claims it receives are either added to an existing Attestation or create an entirely new attestation. Once two thirds of the validators have created a claim that matches a given attestation the attestation will be executed, either minting or burning tokens, whatever corresponds to the given event. Additionally, the module listens for messages sent by users wishing to revert wXLM back to XLM on Soroban. This module manages the transaction pool and holds the wXLM while waiting for validators to sign a transaction and a relayer to execute on Soroban. This module is also responsible for removing a transaction sending wXLM that a user no longer wants to execute, removing transactions for the tx pool that have timed out, and slashing validators who are not responding.
Relayers will make calls to our Soroban contract to return XLM on profitable transactions which have been signed by enough validators. Relayers are needed to execute on Soroban because they will pay the Soroban execution fees after deciding if a transaction is profitable to execute based on its associated fees.
A new wrapped XLM token will be created on cosmos which mirrors the max supply of Stellar. It represents Stellar on the Cosmos chain and is what the bridge module mints and burns.
Roadmap:
We expect development to take roughly 6 weeks and have broken up the process into the following deliverables.
Deliverable 1: Soroban Contract
Deliverable 2: Validator setup with Orchestrator able to listen to Soroban events
Deliverable 3: Cosmos Styx Module wXLM-
Deliverable 4: Signers and Relayers
Deliverable 5: Listening for events after the return of XLM tokens and extensive testing
Deliverable 6: Frontend
Jaylem Brar - https://www.linkedin.com/in/jaylem-brar-02b1031b6
Jaylem is the head lecturer of the blockchain developers course at UC Berkeley where he recreated over half the course to teach rust development on cosmos and teach an introduction to zero knowledge proofs. He is also the Co-founder of Kryptik, https://www.kryptik.app/, an open source, chain agnostic wallet which received funding from Carnegie Mellon, Near, Solana, and the Web3 foundation and just completed the 2023 Berkeley Blockchain Xcelerator batch. He was the Berkeley liaison for SDF in 2021 during their sponsorship of Berkeley accelerator and set up a virtual panel for Stellar builders to present to Berkeley students. Additionally, he has consulted for Paypal and Dfinity through Blockchain at Berkeley, interned at Amazon, and graduated with an EECS degree from UC Berkeley.
Kaan Ulupinar - https://www.linkedin.com/in/kaan-ulupinar-275b2216b
Kaan is a full stack developer who has started developing in the Web3 space. A UC Berkeley alum and former Amazon engineer, he has 6+ years of experience developing using AWS, React, and a wide assortment of front and backend frameworks.
Rohan Khandelwal - https://www.linkedin.com/in/rohan-khandelwal
Rohan is a Software Engineer at Microsoft on the internal payments team. He has consulted for companies including Aleo, Osmosis, and Optimism as a project lead for Blockchain at Berkeley. He has assisted Jaylem with the blockchain developers course at Berkeley where he graduated with a CS degree