Tutorial: Intro to Wormhole and xAssets on Astroport

October 4, 2022
Tutorial: Intro to Wormhole and xAssets on Astroport

In the last two years, DeFi has proliferated across the entire cryptosphere, with many new blockchains rising to build the financial rails of the future. While this competition has led to innovation at the state machine level, it has also led to a zero-sum “race to the top” where ecosystems have largely been siloed from each other. As a result, liquidity and composability are often restricted to specific networks. 

Enter bridges. 

A bridge enables the exchange of assets and information between distinct blockchain networks. 

Building bridges is difficult. Given that blockchains use different state machines, measures for finality, and/or consensus algorithms, there are unique cross-chain concerns that need to be addressed. As a result, bridges will also have different solutions to these problems. 

In the case of Astroport, the bridging of assets has largely been dominated by IBC and the Axelar network. This article explores a third solution: Wormhole. For those that remember, Wormhole was the bridge of choice for Astroport before the Terra collapse. Since then, the bridge has launched on Terra 2.0, connecting Terra (and the entire Cosmos ecosystem) to 16 other chains. 

To refresh the community's memory, the first half of the article introduces Wormhole and how it works. The second half dives into a step-by-step tutorial on how to bridge Wormhole assets (xAssets) to Astroport. 

Let’s get started!

What is Wormhole?

Wormhole is a cross-chain attestation engine with a decentralized oracle network, known as the Guardians, that observes and verifies messages on one chain which can then be relayed on another. This allows users to transfer assets, but also data in general, between a root chain and the rest of the chains on the Guardian network. 

Originally, Wormhole v1 launched as a single bridge between Ethereum and Solana. Since then, its cross-chain solution has outstripped its initial purpose and Wormhole v2 now connects  17 total chains, including Terra. 

How does Wormhole work?

Most notably, the Guardian network does not maintain a consensus engine such as Proof-of-Stake, and there is no staking token. The idea is that PoS consensus is less useful when the network is verifying the outputs of many blockchains supporting their own contracts and consensus engines. Instead,  ⅔+ Guardians are needed for an attestation to be created, which relies entirely on the finality of the root chain and relayers that track activity on foreign chains. The Guardian network simply observes and attests to events, which are then “gossiped” across the entire Wormhole p2p network. Attestations can then be parsed to trigger custom application logic. In this sense, the Guardian network “reads” and does not “write” data.

Let’s dive into specific components!

Guardian Network

The Guardian network is a chain-agnostic p2p network that observes Core Contracts on supported chains and produces VAAs (signed messages). It uses simple technology (t-schnorr signatures) which makes it adaptable and heterogeneous across distinct blockchain networks. 

There are 19 total Guardians, each required to run a full node for every blockchain on the network. Despite the initial heavy requirements, once everything is set up, computations on the network are lightweight.

The Guardians are made up of top validators across blockchain ecosystems such as Chorus One, Staked.us, P2P Validator, triton.one, Certus One, Everstake, Chainode Tech, ChainLayer, Staking Fund, Dokia, 01Node, Moonlet, Inotel, Figment, Staking Facilities, HashQuark, Forbole, Syncnode and Smith MCF.

In the future, the signature scheme could be upgraded. For example, a t-schnorr multisig is cheap and widely supported, but the cost of verifying a transaction increases linearly with the number of signatures. If threshold encryption improves, more signatures could be supported at a balance that makes sense. Additionally, Wormhole has signaled support for zk proofs as a future model for a trustless Guardian network. 

Core Contracts

Core contracts make up the primary ecosystem components and are the mechanism by which all Wormhole messages are emitted. Guardians observe these contracts and attest to events emitted from them. In the case of Astroport, this happens at the token level, with xAsset contracts connecting to Core contracts. 

Below you can find the Core contracts for Terra:

  • Chain Name: Terra
  • Wormhole Chain ID: 18
  • Mainnet Network ID: phoenix-1
  • Testnet Network ID: pisco-1
  • Mainnet Address: terra12mrnzvhx3rpej6843uge2yyfppfyd3u9c3uq223q8sl48huz9juqffcnh
  • Testnet Address: terra19nv3xr5lrmmr7egvrk2kqgw4kcn43xrtd5g0mpgwwvhetusk4k7s66jyv0

xAsset Layer

xAsset contracts convert tokens to xAssets which can be bridged around Wormhole in a path-independent fashion. These tokens are minted using the specific standard of a given chain (CW-20 for Terra) and can be exchanged for other xAssets or the original deposit. 

To see how this works, a user first calls the attest function on the token bridge contract of a root chain. The Guardian network produces an attestation VAA for this event which then triggers a createWrapped function on every other chain. 

Below you can find the Token Bridge contracts for Terra: 

  • Chain Name: Terra
  • Wormhole Chain ID: 18
  • Mainnet Network ID: phoenix-1
  • Testnet Network ID: pisco-1
  • Mainnet Address: terra153366q50k7t8nn7gec00hg66crnhkdggpgdtaxltaq6xrutkkz3s992fw9
  • Testnet Address: terra1c02vds4uhgtrmcw7ldlg75zumdqxr8hwf7npseuf2h58jzhpgjxsgmwkvk

VAAs (Verified Action Approvals)

Verified Action Approvals (VAAs) are the core message primitive in the Wormhole ecosystem. They contain messages, or packets of “xData”, that are emitted when an xDapp interacts with a Core Contract. Put simply, VAAs attest that “x contract on x chain said x thing”. These transactions are then signed by the Guardians and require 13/19 signatures to be confirmed. Once confirmed, they can be queried by a node on the Guardian network. 

A key feature about VAAs is that they don’t have a destination and are effectively multicast. When an attestation is confirmed, it is asynchronously available and verified as authentic by any Core contract on the list of supported chains. This synchronizes state across the entire ecosystem allowing for efficient retrieval of information. 


While Guardians perform the action of “reading” and attesting to messages, relayers are akin to a “writing” function. To put it simply, VAAs allow cross-chain data to be parsed and trigger custom application logic. However, any logic that occurs on foreign chains must then be relayed back to the Guardian network using VAAs. In this sense, the network remains modular. Guardians remain responsible for simply reading data, leaving changes in data to relayers communicating with the Guardian network. 

There is no specific requirements or methodology for relayers, leaving flexibility for xDapp developers to define whatever process best delivers VAAs to a destination. 

Supported Chains 

Perhaps the most attractive feature of Wormhole on Terra is the plethora of available chains to bridge from, many of which are currently only available on Terra through Wormhole. Supported chains include:

  • Acala
  • Algorand
  • Aurora
  • Avalance
  • Binanance Smart Chain
  • Celo
  • Ethereum
  • Fantom
  • Karura
  • Klaytn
  • Moonbeam
  • Near
  • Oasis
  • Polygon
  • Solana
  • Terra Classic
  • Terra

Step-by-Step Tutorial

In this section, we dive right into working with Wormhole. Let’s begin!

1. Head over to the Portal token bridge, a UI for bridging tokens through Wormhole: https://www.portalbridge.com/#/transfer

2. Select which tokens you want to transfer from a root chain to a foreign chain. In this example, we will be transferring SOL from Solana to the Terra network. 

3. Connect your wallet for the root chain you selected. In this case, we will be using the Phantom wallet for Solana. 

4. Select a token and amount to bridge. 

Once complete, click “Next” to continue. 

5. Connect a wallet for the target chain. In this case, we will be using Terra Station for Terra. Note that fees will be paid through Terra, so make sure you have sufficient funds to collect your tokens. 

Once complete,  select “Next”. 

6. Send tokens. You will be prompted to confirm the transaction using your Solana wallet. 

This will convert our SOL to wSOL (wrapped SOL):

Select confirm to move forward. 

7. Redeem your wrapped tokens using your Terra wallet. 

Once you select “Redeem” and sign the transaction, you will receive your funds after the Guardian network confirms the transaction. To see your funds in your wallet, make sure to add wSOL. 

8. Play around with Astroport and xAssets. Now that you have bridged tokens to Terra, you can perform all the regular actions users have access to on Astroport. 

For example, you could provide liquidity to an xAsset pair:

Create a new xAsset pair if one currently doesn’t exist: 

Or swap xAssets (note that liquidity is needed to lower slippage): 

9. And that's it! Now you know about Wormhole and have added a new tool to your DeFi kit. The cosmos is your oyster. Have fun bridging in new assets!

✦‍ Follow Astroport on Twitter and subscribe to the Astroport email newsletter to get the latest alerts from the mothership.‍


Remember, Terra 2.0 and Astroport are experimental technologies. This article does not constitute investment advice and is subject to and limited by the Astroport disclaimers, which you should review before interacting with the protocol.

Previous post

There are no previous posts

<- Back to all posts
Next post

There are no next posts

<- Back to all posts