Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move files around for tutorials reorg #168

Merged
merged 56 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
feef8aa
initial content
Sep 18, 2024
ada142f
sync
Sep 18, 2024
8df8d76
prerequisites
Sep 18, 2024
44c5acd
prerequisites
Sep 18, 2024
39010a7
Merge branch 'ilariae/token-bridge' of https://github.com/wormhole-fo…
Sep 19, 2024
69f253d
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 19, 2024
6c46418
content
Sep 23, 2024
4879614
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 23, 2024
abc2739
get started with token bridge page
Sep 23, 2024
1596647
token bridge learn update
Sep 23, 2024
15baabd
grammarly check and minor changes
Sep 23, 2024
84281d2
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 23, 2024
f151923
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 25, 2024
6a51aa5
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Sep 30, 2024
7b08a13
Update build/contract-integrations/token-bridge.md
ilariae Sep 30, 2024
3631664
Update build/contract-integrations/token-bridge.md
ilariae Sep 30, 2024
a4439e8
Update build/contract-integrations/token-bridge.md
ilariae Sep 30, 2024
1c6e87f
minor fix
Sep 30, 2024
e24d0ed
added diagram
Sep 30, 2024
4b8c7d5
Apply suggestions from code review
ilariae Oct 1, 2024
15d2d44
Merge branch 'ilariae/token-bridge' of https://github.com/wormhole-fo…
Oct 1, 2024
5bd9cda
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Oct 1, 2024
c7b7ff7
minor learn fix
Oct 1, 2024
f9ee9c6
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Oct 12, 2024
f9ff9eb
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Oct 21, 2024
1d5abbf
sync
Nov 28, 2024
2f80963
comments
Nov 29, 2024
e8ca50e
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Dec 9, 2024
a4dc093
move files around for tutorials reorg
eshaben Dec 10, 2024
cd6880c
update file name
eshaben Dec 10, 2024
4501262
index pages
Dec 17, 2024
15c1a39
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Dec 17, 2024
3815208
token attestation
Dec 17, 2024
172d262
token transfers
Dec 17, 2024
36a5c83
redemption
Dec 17, 2024
9235381
grammarly
Dec 17, 2024
bcec89f
index cards
Dec 18, 2024
654f00c
sync and resolve conflict
Dec 18, 2024
a957b6b
index cards
Dec 18, 2024
9a7127a
meta descriptions
Dec 18, 2024
6a700f6
Apply suggestions from code review
ilariae Dec 19, 2024
9dbd01e
Merge branch 'ilariae/token-bridge' of https://github.com/wormhole-fo…
Dec 19, 2024
4545cde
Merge branch 'main' into reorg-tutorials
ilariae Dec 20, 2024
0562294
Merge branch 'reorg-tutorials' of https://github.com/wormhole-foundat…
Dec 23, 2024
e23ba8e
Merge branch 'main' of https://github.com/wormhole-foundation/wormhol…
Dec 23, 2024
80e6f45
additional resources
Dec 23, 2024
ab4128b
tutorial repo redirects
Dec 23, 2024
6b23a82
github icon
Dec 23, 2024
1602a9f
remove gateway
Dec 23, 2024
85438ab
Martinh/xassets (#148)
martin0995 Dec 23, 2024
fba90bb
Merge branch 'main' into reorg-tutorials
ilariae Dec 23, 2024
a4d847e
Apply suggestions from code review
eshaben Dec 23, 2024
c92b694
remove token bridge stuff
eshaben Dec 23, 2024
132b230
rename cross-chain contracts to contract integrations
eshaben Dec 23, 2024
a28bb0a
minor fix
eshaben Dec 23, 2024
1eace62
Update tutorials/by-product/index.md
eshaben Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build/contract-integrations/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ nav:
- index.md
- 'Wormhole Relayer': 'wormhole-relayers.md'
- 'Core Contracts': 'core-contracts.md'
# - 'Token Bridge': 'token-bridge.md'
- 'Token Bridge': 'token-bridge.md'
- 'CCTP': 'cctp.md'
- native-token-transfers
- multigov
- 'Development Environment': 'dev-env.md'
- 'FAQs': 'faqs.md'
219 changes: 219 additions & 0 deletions build/contract-integrations/token-bridge.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/contract-integrations/wormhole-relayers.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ See the [Wormhole CLI tool docs](/docs/build/toolkit/cli/) for installation and

## Step-by-Step Tutorial

For detailed, step-by-step guidance on creating cross-chain contracts that interact with the Wormhole relayer, refer to the [Create Cross-Chain Contracts](/docs/tutorials/messaging/cross-chain-contracts/) tutorial.
For detailed, step-by-step guidance on creating cross-chain contracts that interact with the Wormhole relayer, refer to the [Create Cross-Chain Contracts](/docs/tutorials/by-product/cross-chain-contracts/cross-chain-contracts/) tutorial.
4 changes: 2 additions & 2 deletions build/toolkit/solidity-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,5 @@ The SDK includes built-in support for Forge-based testing, which allows you to t

For a detailed example, check out the below repositories:

- [Cross chain messaging](/docs/tutorials/messaging/cross-chain-contracts/){target=\_blank}
- [Cross chain token transfer](/docs/tutorials/messaging/cross-chain-token-contracts/){target=\_blank}
- [Cross chain messaging](/docs/tutorials/by-product/cross-chain-contracts/cross-chain-contracts/){target=\_blank}
- [Cross chain token transfer](/docs/tutorials/by-product/cross-chain-contracts/cross-chain-token-contracts/){target=\_blank}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion learn/governance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Discover everything you need to know about MultiGov, Wormhole's cross-chain gove

Access step-by-step guides for executing cross-chain governance actions, including treasury management proposals with MultiGov and Wormhole.

[:octicons-arrow-right-16: Create MultiGov solutions](/docs/tutorials/multigov/)
[:octicons-arrow-right-16: Create MultiGov solutions](/docs/tutorials/by-product/multigov/)

- :octicons-question-16:{ .lg .middle } **Technical FAQs**

Expand Down
71 changes: 71 additions & 0 deletions learn/messaging/token-nft-bridge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Token Bridge
description: Learn about Wormhole's Token and NFT Bridge for cross-chain transfers using lock and mint mechanisms, ensuring secure and efficient asset movement.
---

# Token and NFT Bridge

## Token Bridge

Transferring tokens across blockchain networks is challenging due to the lack of interoperability. Maintaining token properties such as value, name, and precision while ensuring security during transfers often requires complex and costly solutions like liquidity pools or native swaps, which can introduce inefficiencies and risks.

Wormhole's Token Bridge addresses these challenges by providing a decentralized protocol for seamless cross-chain token transfers through a lock-and-mint mechanism. Using Wormhole's message-passing protocol, the Token Bridge allows standards-compliant tokens, like ERC-20 on Ethereum or SPL on Solana, to be transferred between blockchains while preserving their original attributes.

Offering a more efficient, scalable, and secure alternative to traditional solutions, the Token Bridge ensures that assets retain their properties across multiple blockchain ecosystems. Additionally, it supports flexible features like [Contract Controlled Transfers](/docs/learn/infrastructure/vaas/#token-transfer-with-message){target=\_blank}, enabling custom interactions by allowing tokens to carry additional data for smart contract integration on the destination chain.

This page introduces the core concepts and functions of Wormhole's Token Bridge, explaining how it operates, its key features, and how it enables secure and efficient cross-chain token transfers.

### How Does It Work?

At the core of the Token Bridge lies the lock-and-mint mechanism, which uses the [Core Contract](/docs/learn/infrastructure/core-contracts/){target=\_blank} with a specific [payload](/docs/learn/infrastructure/vaas/#token-transfer){target=\_blank} to pass information about the transfer. Tokens on the source chain are locked, and wrapped tokens are minted on the destination chain. This approach guarantees that token transfers are secure and consistent, ensuring that token properties such as name, symbol, and decimal precision are preserved across chains.

Before you can transfer a token to a new chain, the token's metadata must be [attested](/docs/learn/infrastructure/vaas/#attestation){target=\_blank}. This process registers the token details (such as decimals and symbol) on the destination chain, enabling the creation of wrapped assets.

While the [Core Contract](/docs/learn/infrastructure/core-contracts/){target=\_blank} has no specific receiver by default, transfers sent through the Token Bridge do have a specific receiver chain and address to ensure the tokens are minted to the expected recipient.

In addition to standard token transfers, the Token Bridge supports [Contract Controlled Transfers](/docs/learn/infrastructure/vaas/#token-transfer-with-message){target=\_blank}. This functionality allows users to attach additional data to token transfers, enabling more complex interactions with smart contracts on the destination chain. For instance, a token transfer can include a payload that triggers specific actions, such as interacting with a decentralized exchange (DEX) or automated market maker (AMM).

### Token Transfer Flow

The transfer process is simple yet secure, involving a few key steps:

1. **Attestation** - first, a token's metadata is attested on the source chain, ensuring that its properties are consistent across chains
2. **Locking** - on the source chain, the native token is locked in a custody account
3. **Message emission** - a message detailing the transfer is sent through Wormhole's Guardian Network, which verifies the transfer and signs the message
4. **Verification and minting** - on the destination chain, the transfer message is verified, and wrapped tokens are minted, or native tokens are released from custody

![Token Bridge detailed flow](/docs/images/learn/messaging/token-bridge/token-bridge-diagram.webp)

### Key Features of the Token Bridge

The Token Bridge creates wrapped versions when tokens are transferred to a different chain. These wrapped assets represent the locked tokens on the source chain and allow users to interact with them on the destination chain. This mechanism ensures seamless functionality without needing liquidity pools or native token swaps.

The Token Bridge employs a universal token representation compatible with various virtual machine (VM) data types. This allows the tokens to interact with decentralized applications (dApps) across different chains without issues related to differing token standards.

### Message and Payload Structure

To facilitate cross-chain communication, the Token Bridge uses specialized payloads that carry the necessary information for token transfers and attestations. These payloads ensure that the correct tokens are minted or unlocked on the destination chain.

- `Transfer` - this payload initiates the transfer of tokens, either by minting wrapped tokens or releasing locked tokens
- `TransferWithPayload` - in addition to transferring tokens, this payload carries additional data, allowing integration with smart contracts or dApps on the target chain
- `AssetMeta` - before a token can be transferred for the first time, this payload is used to attest to the token's metadata, including decimals, symbol, and name
- `RegisterChain` - register the Token Bridge contract (emitter address) for a foreign chain
- `UpgradeContract` - upgrade the contract

Each payload type is designed to serve a specific function in the token transfer process, ensuring that the bridge operates efficiently and securely.

One of the key challenges in cross-chain token transfers is maintaining the correct token precision. The Token Bridge addresses this using the `AssetMeta` payload to store token metadata. Before transferring a token to a new chain, metadata such as its decimal precision, name, and symbol must be attested. The bridge ensures token amounts are truncated to a maximum of 8 decimals, guaranteeing compatibility with chains that may not support higher decimal precision. For example, an 18-decimal token on Ethereum will be represented with only eight decimals on the destination chain, simplifying integration with various decentralized applications.

### Security and Authorization

The Token Bridge uses an emitter chain and address authorization system to verify the validity of messages. Each Token Bridge endpoint is registered on its respective chain, ensuring only trusted contracts can send or receive transfer messages.

The [Wormhole Guardian Network](/docs/learn/infrastructure/guardians/#guardian-network){target=\_blank} plays a critical role in verifying each transfer and ensuring that the message is signed and relayed securely between chains.

### Portal Bridge

A real-world example of Wormhole's Token Bridge in action is the [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides users with a simple interface to transfer tokens across multiple blockchains. Using the Wormhole infrastructure, Portal Bridge guarantees secure and seamless cross-chain transfers, making it easier for users to move assets between different blockchain ecosystems.

## NFT Bridge

The NFT Bridge functions similarly to the Token Bridge but with special rules for what may be transferred and how the wrapped version is created on the destination chain.
4 changes: 2 additions & 2 deletions tutorials/.pages
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: Tutorials
nav:
- index.md
- messaging
- multigov
- by-product
# - end-to-end
8 changes: 8 additions & 0 deletions tutorials/by-product/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Tutorials by Product
nav:
- index.md
- connect
- cross-chain-contracts
- native-token-transfers
- multigov
- wormhole-sdk
4 changes: 4 additions & 0 deletions tutorials/by-product/connect/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: Connect
nav:
- index.md
- 'Integrate Connect into a React DApp': react-dapp.md
34 changes: 34 additions & 0 deletions tutorials/by-product/connect/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Wormhole Connect Tutorials
description: Enable cross-chain connectivity with Wormhole Connect. Learn integration and simplify user experiences across multiple blockchains.
---

# Connect Tutorials

Wormhole Connect makes it simple to link your application to multiple blockchain ecosystems. These tutorials will teach you how to integrate Connect into your projects, streamline cross-chain interactions, simplify user onboarding, and deliver a smoother overall experience.

<div class="grid cards" markdown>

- :octicons-repo-16:{ .lg .middle } **Integrate Connect into a React DApp**

---

Learn how to incorporate Wormhole Connect into a React application. This step-by-step tutorial guides you through enabling cross-chain token transfers and interactions, bridging assets between networks, and enhancing the user experience with streamlined blockchain connectivity.

[:octicons-arrow-right-16: Start building](/docs/tutorials/by-product/connect/react-dapp/)

</div>

## Additional Resources

<div class="grid cards" markdown>

- :octicons-tools-16:{ .lg .middle } **Connect**

---

Get deeper insights into setting up and customizing Wormhole Connect. Explore advanced guides, best practices, and configuration tips to streamline your cross-chain integrations.

[:octicons-arrow-right-16: Start building](/docs/build/applications/connect/)
eshaben marked this conversation as resolved.
Show resolved Hide resolved

</div>
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: Transfer Tokens Cross-Chain with Connect
title: Integrate Connect into a React DApp Tutorial
description: Learn how to use Wormhole Connect to transfers tokens cross-chain seamlessly between Sui and Avalanche Fuji with this step-by-step guide.
---

# Cross-Chain Token Transfers with Wormhole Connect
# Integrate Connect into a React DApp

:simple-github: [Source code on GitHub](https://github.com/wormhole-foundation/demo-basic-connect){target=\_blank}

## Introduction

Expand Down Expand Up @@ -127,38 +129,38 @@ To transfer tokens from Sui to Fuji in the Wormhole Connect interface:
2. Choose **Fuji** as the destination network and connect your wallet with the Fuji network
3. Enter the amount of SUI tokens you wish to transfer

![](/docs/images/tutorials/connect/connect-1.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-1.webp)

4. Choose to view other routes

![](/docs/images/tutorials/connect/connect-2.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-2.webp)

5. Select the manual bridge option, which will require two transactions: one on the source chain (Sui) and one on the destination chain (Fuji)

!!! note
It is recommended to use the manual bridge option for this tutorial. The automatic bridge feature is currently undergoing improvements, while the manual bridge ensures that transfers complete successfully.

![](/docs/images/tutorials/connect/connect-3.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-3.webp)

6. Review and confirm the transfer on Sui. This will lock your tokens on the Sui chain

![](/docs/images/tutorials/connect/connect-4.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-4.webp)

7. Follow the on-screen prompts to approve the transaction. You will be asked to sign with your Sui wallet

![](/docs/images/tutorials/connect/connect-5.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-5.webp)

Once the transaction has been submitted, Wormhole Connect will display the progress of the transfer. Monitor the status until you’re prompted to complete the transaction on the destination chain. You can also track your transactions on [Wormholescan](https://wormholescan.io/#/?network=Testnet){target=\_blank}.

## Claim Tokens on Fuji

After the Sui transaction is complete, confirm the final transaction on Fuji by claiming the wrapped tokens. You will be asked to confirm the transaction with your Fuji wallet.

![](/docs/images/tutorials/connect/connect-6.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-6.webp)

Once confirmed, check your Fuji wallet to verify that the wrapped SUI tokens have been successfully received.

![](/docs/images/tutorials/connect/connect-7.webp)
![](/docs/images/tutorials/by-product/connect/react-dapp/connect-7.webp)

## Resources

Expand Down
5 changes: 5 additions & 0 deletions tutorials/by-product/cross-chain-contracts/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: Cross-Chain Contracts
nav:
- index.md
- 'Create Messaging Contracts': 'cross-chain-contracts.md'
- 'Create Token Transfer Contracts': 'cross-chain-token-contracts.md'
Loading