diff --git a/.snippets/code/products/messaging/guides/core-contracts/attestToken.sol b/.snippets/code/products/messaging/guides/core-contracts/attestToken.sol new file mode 100644 index 000000000..bebc0382c --- /dev/null +++ b/.snippets/code/products/messaging/guides/core-contracts/attestToken.sol @@ -0,0 +1,8 @@ +IWormhole wormhole = IWormhole(wormholeAddr); + +uint256 wormholeFee = wormhole.messageFee(); + +wormhole.attestToken{value: wormholeFee}( + address(tokenImpl), // the token contract to attest + 234 // nonce for the transfer +); \ No newline at end of file diff --git a/.snippets/code/products/messaging/guides/core-contracts/transferTokens.sol b/.snippets/code/products/messaging/guides/core-contracts/transferTokens.sol new file mode 100644 index 000000000..5b38f9480 --- /dev/null +++ b/.snippets/code/products/messaging/guides/core-contracts/transferTokens.sol @@ -0,0 +1,14 @@ +IWormhole wormhole = IWormhole(wormholeAddr); +ITokenBridge tokenBridge = ITokenBridge(tokenBridgeAddr); + +// Get the fee for publishing a message +uint256 wormholeFee = wormhole.messageFee(); + +tokenBridge.transferTokens{value: wormholeFee}( + token, // address of the ERC-20 token to transfer + amount, // amount of tokens to transfer + recipientChain, // Wormhole chain ID of the destination chain + recipient, // recipient address on the destination chain (as bytes32) + arbiterFee, // fee for relayer + nonce // nonce for this transfer +); \ No newline at end of file diff --git a/.snippets/code/products/messaging/guides/core-contracts/transferTokensWithPayload.sol b/.snippets/code/products/messaging/guides/core-contracts/transferTokensWithPayload.sol new file mode 100644 index 000000000..44e16cb39 --- /dev/null +++ b/.snippets/code/products/messaging/guides/core-contracts/transferTokensWithPayload.sol @@ -0,0 +1,14 @@ +IWormhole wormhole = IWormhole(wormholeAddr); +ITokenBridge tokenBridge = ITokenBridge(tokenBridgeAddr); + +// Get the fee for publishing a message +uint256 wormholeFee = wormhole.messageFee(); + +tokenBridge.transferTokensWithPayload{value: wormholeFee}( + token, // address of the ERC-20 token to transfer + amount, // amount of tokens to transfer + recipientChain, // Wormhole chain ID of the destination chain + recipient, // recipient address on the destination chain (as bytes32) + nonce, // nonce for this transfer + additionalPayload // additional payload data +); \ No newline at end of file diff --git a/.snippets/code/products/token-bridge/tutorials/transfer-workflow/token-bridge-1.ts b/.snippets/code/products/token-bridge/tutorials/transfer-workflow/token-bridge-1.ts index 2bc6341bc..207ba5ab0 100644 --- a/.snippets/code/products/token-bridge/tutorials/transfer-workflow/token-bridge-1.ts +++ b/.snippets/code/products/token-bridge/tutorials/transfer-workflow/token-bridge-1.ts @@ -21,14 +21,12 @@ export interface SignerStuff { address: ChainAddress; } -// Function to fetch environment variables (like your private key) -function getEnv(key: string): string { - const val = process.env[key]; - if (!val) throw new Error(`Missing environment variable: ${key}`); - return val; -} - -// Signer setup function for different blockchain platforms +/** + * Returns a signer for the given chain using locally scoped credentials. + * The required values (EVM_PRIVATE_KEY, SOL_PRIVATE_KEY, SUI_MNEMONIC, APTOS_PRIVATE_KEY) must + * be loaded securely beforehand, for example via a keystore, secrets + * manager, or environment variables (not recommended). + */ export async function getSigner( chain: ChainContext, gasLimit?: bigint @@ -44,27 +42,23 @@ export async function getSigner( case 'Solana': signer = await ( await solana() - ).getSigner(await chain.getRpc(), getEnv('SOL_PRIVATE_KEY')); + ).getSigner(await chain.getRpc(), 'SOL_PRIVATE_KEY'); break; case 'Evm': const evmSignerOptions = gasLimit ? { gasLimit } : {}; signer = await ( await evm() - ).getSigner( - await chain.getRpc(), - getEnv('ETH_PRIVATE_KEY'), - evmSignerOptions - ); + ).getSigner(await chain.getRpc(), 'ETH_PRIVATE_KEY', evmSignerOptions); break; case 'Sui': signer = await ( await sui() - ).getSigner(await chain.getRpc(), getEnv('SUI_MNEMONIC')); + ).getSigner(await chain.getRpc(), 'SUI_MNEMONIC'); break; case 'Aptos': signer = await ( await aptos() - ).getSigner(await chain.getRpc(), getEnv('APTOS_PRIVATE_KEY')); + ).getSigner(await chain.getRpc(), 'APTOS_PRIVATE_KEY'); break; default: throw new Error('Unsupported platform: ' + platform); diff --git a/.snippets/text/products/reference/contract-addresses/read-only.md b/.snippets/text/products/reference/contract-addresses/read-only.md index f507a9902..ad62ac28c 100644 --- a/.snippets/text/products/reference/contract-addresses/read-only.md +++ b/.snippets/text/products/reference/contract-addresses/read-only.md @@ -14,4 +14,4 @@ Terraterra1dq03ugtd40zu9hcgdzrsq6z2z4hwhc9tqk2uy5 XPLAxpla1jn8qmdda5m6f6fqu9qv46rt7ajhklg40ukpqchkejcvy8x7w26cqxamv3w - \ No newline at end of file + diff --git a/llms-files/llms-basics.txt b/llms-files/llms-basics.txt index f116e8e9f..941182f64 100644 --- a/llms-files/llms-basics.txt +++ b/llms-files/llms-basics.txt @@ -11,6 +11,7 @@ Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/re Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/messaging/guides/wormhole-relayers.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/messaging/overview.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/overview.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/products.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/reference/glossary.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/architecture.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/protocol/ecosystem.md [type: other] @@ -1049,6 +1050,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-connect.txt b/llms-files/llms-connect.txt index 2a38636c2..2ca142a20 100644 --- a/llms-files/llms-connect.txt +++ b/llms-files/llms-connect.txt @@ -2810,6 +2810,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-multigov.txt b/llms-files/llms-multigov.txt index 428c5ac45..67edc2582 100644 --- a/llms-files/llms-multigov.txt +++ b/llms-files/llms-multigov.txt @@ -2070,6 +2070,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-ntt.txt b/llms-files/llms-ntt.txt index 13fc991cd..b67f501c5 100644 --- a/llms-files/llms-ntt.txt +++ b/llms-files/llms-ntt.txt @@ -3081,6 +3081,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-queries.txt b/llms-files/llms-queries.txt index 834397973..26c96e14d 100644 --- a/llms-files/llms-queries.txt +++ b/llms-files/llms-queries.txt @@ -1836,6 +1836,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-relayers.txt b/llms-files/llms-relayers.txt index deb6ededc..bf5c434b9 100644 --- a/llms-files/llms-relayers.txt +++ b/llms-files/llms-relayers.txt @@ -1589,6 +1589,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-settlement.txt b/llms-files/llms-settlement.txt index 879e877cf..a02879889 100644 --- a/llms-files/llms-settlement.txt +++ b/llms-files/llms-settlement.txt @@ -1542,6 +1542,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-solidity-sdk.txt b/llms-files/llms-solidity-sdk.txt index 0c1d3619e..f405ef06c 100644 --- a/llms-files/llms-solidity-sdk.txt +++ b/llms-files/llms-solidity-sdk.txt @@ -2642,6 +2642,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-token-bridge.txt b/llms-files/llms-token-bridge.txt index 70ba96db7..a1a4def23 100644 --- a/llms-files/llms-token-bridge.txt +++ b/llms-files/llms-token-bridge.txt @@ -17,7 +17,10 @@ Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/re Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/concepts/transfer-flow.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/faqs.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/get-started.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/attest-tokens.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/token-bridge-contracts.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens-payload.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/overview.md [type: other] ## Full content for each doc page @@ -837,6 +840,105 @@ Now that you've completed a manual multichain token transfer, explore these guid - [Create Multichain Tokens](/docs/products/token-bridge/tutorials/multichain-token){target=\_blank}: Learn how to issue tokens that work across chains. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/attest-tokens/ +--- BEGIN CONTENT --- +--- +title: Attesting Tokens via Token Bridge Contracts +description: Learn how to attest your token via Wormhole's Token Bridge for seamless multichain token transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Attesting Tokens via Token Bridge Contracts + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to attest your token via the Token Bridge contracts. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To attest your token with the Token Bridge contract, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. + + +## How to Attest Your Token + +Suppose a token has never been transferred to the target chain before transferring it cross-chain. In that case, its metadata must be registered so the Token Bridge can recognize it and create a wrapped version if necessary. + +The attestation process doesn't require you to manually input token details like name, symbol, or decimals. Instead, the Token Bridge contract retrieves these values from the token contract itself when you call the `attestToken()` method. + +```solidity +function attestToken( + address tokenAddress, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `tokenAddress` ++"address"++ + + The contract address of the token to be attested. + + --- + + `nonce` ++"uint32"++ + + An arbitrary value provided by the caller to ensure uniqueness. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the attestation transaction. + +When `attestToken()` is called, the contract emits a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} containing the token's metadata, which the [Guardians](/docs/protocol/infrastructure/guardians/){target=\_blank} sign and publish. + +You must ensure the token is ERC-20 compliant. If it does not implement the standard functions, the attestation may fail or produce incomplete metadata. + +## How to Verify an Attested Token + +To verify if a token has a wrapped representation in a given chain, you can call the `wrappedAsset()` function of the Token Bridge contract in the destination chain that you want to check. The function call will return the address of the wrapped token, or `0x0` if no wrapped token has been attested. + +```wrappedAsset +function attestToken( + uint16 tokenChainId, + bytes32 tokenAddress +) external view returns (address); +``` + +??? interface "Parameters" + + `uint16` ++"tokenChainId"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the source chain. + + --- + + `tokenAddress` ++"bytes32"++ + + The token's [Universal Address](/docs/products/reference/wormhole-formatted-addresses/#universal-address-methods){target=\_blank} in the source chain. + +??? interface "Returns" + + `wrappedTokenAddress` ++"address"++ + + The address of the wrapped token in this chain, or `0x0` if the token has not been attested. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/token-bridge-contracts/ --- BEGIN CONTENT --- --- @@ -1111,6 +1213,239 @@ For a deeper understanding of the Token Bridge implementation and to review the A practical implementation of the Wormhole Token Bridge can be seen in [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides an easy-to-use interface for transferring tokens across multiple blockchain networks. It leverages the Wormhole infrastructure to handle cross-chain asset transfers seamlessly, offering users a convenient way to bridge their assets while ensuring security and maintaining token integrity. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/transfer-tokens-payload/ +--- BEGIN CONTENT --- +--- +title: Transfer Tokens with Payload - Token Bridge +description: Learn how to transfer your token with an additional payload via Wormhole's Token Bridge for seamless multichain token transfers with payload execution. +categories: Token-Bridge, Transfer +--- + +# Token Transfers with Payload via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to [transfer tokens with a message](/docs/protocol/infrastructure/vaas/#token-transfer-with-message){target=\_blank} via the Token Bridge contract, where arbitrary byte payloads can be attached to the token transfer, enabling more complex chain interactions. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with a payload via the Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. +- A formatted payload to be executed in the destination chain. + +## Transfer Tokens with Payload + +While a standard token transfer moves tokens between chains, a transfer with a payload allows you to embed arbitrary data in the [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank}. This data can be used on the destination chain to execute additional logic—such as automatically depositing tokens into a DeFi protocol, initiating a swap on a DEX, or interacting with a custom smart contract. + +Call `transferTokensWithPayload()` instead of `transferTokens()` to include a custom payload (arbitrary bytes) with the token transfer. + +```solidity +function transferTokensWithPayload( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint32 nonce, + bytes memory payload +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + + --- + + `payload` ++"bytes memory"++ + + Arbitrary data payload attached to the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +After initiating a transfer on the source chain, the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network observes and signs the resulting message, creating a VAA. You'll need to fetch this VAA and then call `completeTransferWithPayload()`. + +Only the designated recipient contract can redeem tokens. This ensures that the intended contract securely handles the attached payload. On successful redemption, the tokens are minted (if foreign) or released (if native) to the recipient address on the destination chain. For payload transfers, the designated contract can execute the payload's logic at this time. + +```solidity +function completeTransferWithPayload( + bytes memory encodedVm +) external returns (bytes memory); +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +??? interface "Returns" + + ++"bytes memory"++ + + The extracted payload data. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} +--- END CONTENT --- + +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/transfer-tokens/ +--- BEGIN CONTENT --- +--- +title: Transfer Tokens - Token Bridge Contract +description: Learn how to transfer your token via Wormhole's Token Bridge for seamless multichain transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Token Transfers via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to transfer tokens via the Token Bridge contract. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with the Wormhole Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. + +## Transfer Tokens + +Once a token is attested, a cross-chain token transfer can be initiated following the lock-and-mint mechanism. On the source chain, tokens are locked (or burned if they're already a wrapped asset), and a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} is emitted. On the destination chain, that VAA is used to mint or release the corresponding amount of wrapped tokens. + +Call `transferTokens()` to lock/burn tokens and produce a VAA with transfer details. + +```solidity +function transferTokens( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint256 arbiterFee, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `arbiterFee` ++"uint256"++ + + Optional fee to be paid to an arbiter for relaying the transfer. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +Once a transfer VAA is obtained from the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network, the final step is to redeem the tokens on the destination chain. Redemption verifies the VAA's authenticity and releases (or mints) tokens to the specified recipient. To redeem the tokens, call `completeTransfer()`. + +```solidity +function completeTransfer(bytes memory encodedVm) external; +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +!!!note + - The Token Bridge normalizes token amounts to 8 decimals when passing them between chains. Make sure your application accounts for potential decimal truncation. + - The VAA ensures the integrity of the message. Only after the Guardians sign the VAA can it be redeemed on the destination chain. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} + +## Portal Bridge + +A practical implementation of the Wormhole Token Bridge can be seen in [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides an easy-to-use interface for transferring tokens across multiple blockchain networks. It leverages the Wormhole infrastructure to handle cross-chain asset transfers seamlessly, offering users a convenient way to bridge their assets while ensuring security and maintaining token integrity. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/token-bridge/overview/ --- BEGIN CONTENT --- --- @@ -2232,6 +2567,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-transfer.txt b/llms-files/llms-transfer.txt index 8886537fe..b1a0d8a51 100644 --- a/llms-files/llms-transfer.txt +++ b/llms-files/llms-transfer.txt @@ -41,13 +41,17 @@ Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/re Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/native-token-transfers/reference/cli-commands.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/native-token-transfers/reference/managers-transceivers.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/overview.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/products.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/settlement/concepts/architecture.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/settlement/faqs.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/settlement/get-started.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/settlement/overview.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/concepts/transfer-flow.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/faqs.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/attest-tokens.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/token-bridge-contracts.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens-payload.md [type: other] +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens.md [type: other] Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/overview.md [type: other] ## Full content for each doc page @@ -6804,6 +6808,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/settlement/concepts/architecture/ --- BEGIN CONTENT --- --- @@ -7529,6 +7601,105 @@ Updating the metadata (such as the token image, name, or symbol) of a wrapped to To request an update, contact Solscan via [support@solscan.io](mailto:support@solscan.io) or their [contact form](https://solscan.io/contactus){target=\_blank}. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/attest-tokens/ +--- BEGIN CONTENT --- +--- +title: Attesting Tokens via Token Bridge Contracts +description: Learn how to attest your token via Wormhole's Token Bridge for seamless multichain token transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Attesting Tokens via Token Bridge Contracts + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to attest your token via the Token Bridge contracts. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To attest your token with the Token Bridge contract, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. + + +## How to Attest Your Token + +Suppose a token has never been transferred to the target chain before transferring it cross-chain. In that case, its metadata must be registered so the Token Bridge can recognize it and create a wrapped version if necessary. + +The attestation process doesn't require you to manually input token details like name, symbol, or decimals. Instead, the Token Bridge contract retrieves these values from the token contract itself when you call the `attestToken()` method. + +```solidity +function attestToken( + address tokenAddress, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `tokenAddress` ++"address"++ + + The contract address of the token to be attested. + + --- + + `nonce` ++"uint32"++ + + An arbitrary value provided by the caller to ensure uniqueness. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the attestation transaction. + +When `attestToken()` is called, the contract emits a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} containing the token's metadata, which the [Guardians](/docs/protocol/infrastructure/guardians/){target=\_blank} sign and publish. + +You must ensure the token is ERC-20 compliant. If it does not implement the standard functions, the attestation may fail or produce incomplete metadata. + +## How to Verify an Attested Token + +To verify if a token has a wrapped representation in a given chain, you can call the `wrappedAsset()` function of the Token Bridge contract in the destination chain that you want to check. The function call will return the address of the wrapped token, or `0x0` if no wrapped token has been attested. + +```wrappedAsset +function attestToken( + uint16 tokenChainId, + bytes32 tokenAddress +) external view returns (address); +``` + +??? interface "Parameters" + + `uint16` ++"tokenChainId"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the source chain. + + --- + + `tokenAddress` ++"bytes32"++ + + The token's [Universal Address](/docs/products/reference/wormhole-formatted-addresses/#universal-address-methods){target=\_blank} in the source chain. + +??? interface "Returns" + + `wrappedTokenAddress` ++"address"++ + + The address of the wrapped token in this chain, or `0x0` if the token has not been attested. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/token-bridge-contracts/ --- BEGIN CONTENT --- --- @@ -7803,6 +7974,239 @@ For a deeper understanding of the Token Bridge implementation and to review the A practical implementation of the Wormhole Token Bridge can be seen in [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides an easy-to-use interface for transferring tokens across multiple blockchain networks. It leverages the Wormhole infrastructure to handle cross-chain asset transfers seamlessly, offering users a convenient way to bridge their assets while ensuring security and maintaining token integrity. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/transfer-tokens-payload/ +--- BEGIN CONTENT --- +--- +title: Transfer Tokens with Payload - Token Bridge +description: Learn how to transfer your token with an additional payload via Wormhole's Token Bridge for seamless multichain token transfers with payload execution. +categories: Token-Bridge, Transfer +--- + +# Token Transfers with Payload via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to [transfer tokens with a message](/docs/protocol/infrastructure/vaas/#token-transfer-with-message){target=\_blank} via the Token Bridge contract, where arbitrary byte payloads can be attached to the token transfer, enabling more complex chain interactions. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with a payload via the Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. +- A formatted payload to be executed in the destination chain. + +## Transfer Tokens with Payload + +While a standard token transfer moves tokens between chains, a transfer with a payload allows you to embed arbitrary data in the [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank}. This data can be used on the destination chain to execute additional logic—such as automatically depositing tokens into a DeFi protocol, initiating a swap on a DEX, or interacting with a custom smart contract. + +Call `transferTokensWithPayload()` instead of `transferTokens()` to include a custom payload (arbitrary bytes) with the token transfer. + +```solidity +function transferTokensWithPayload( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint32 nonce, + bytes memory payload +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + + --- + + `payload` ++"bytes memory"++ + + Arbitrary data payload attached to the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +After initiating a transfer on the source chain, the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network observes and signs the resulting message, creating a VAA. You'll need to fetch this VAA and then call `completeTransferWithPayload()`. + +Only the designated recipient contract can redeem tokens. This ensures that the intended contract securely handles the attached payload. On successful redemption, the tokens are minted (if foreign) or released (if native) to the recipient address on the destination chain. For payload transfers, the designated contract can execute the payload's logic at this time. + +```solidity +function completeTransferWithPayload( + bytes memory encodedVm +) external returns (bytes memory); +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +??? interface "Returns" + + ++"bytes memory"++ + + The extracted payload data. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} +--- END CONTENT --- + +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/transfer-tokens/ +--- BEGIN CONTENT --- +--- +title: Transfer Tokens - Token Bridge Contract +description: Learn how to transfer your token via Wormhole's Token Bridge for seamless multichain transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Token Transfers via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to transfer tokens via the Token Bridge contract. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with the Wormhole Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. + +## Transfer Tokens + +Once a token is attested, a cross-chain token transfer can be initiated following the lock-and-mint mechanism. On the source chain, tokens are locked (or burned if they're already a wrapped asset), and a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} is emitted. On the destination chain, that VAA is used to mint or release the corresponding amount of wrapped tokens. + +Call `transferTokens()` to lock/burn tokens and produce a VAA with transfer details. + +```solidity +function transferTokens( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint256 arbiterFee, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `arbiterFee` ++"uint256"++ + + Optional fee to be paid to an arbiter for relaying the transfer. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +Once a transfer VAA is obtained from the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network, the final step is to redeem the tokens on the destination chain. Redemption verifies the VAA's authenticity and releases (or mints) tokens to the specified recipient. To redeem the tokens, call `completeTransfer()`. + +```solidity +function completeTransfer(bytes memory encodedVm) external; +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +!!!note + - The Token Bridge normalizes token amounts to 8 decimals when passing them between chains. Make sure your application accounts for potential decimal truncation. + - The VAA ensures the integrity of the message. Only after the Guardians sign the VAA can it be redeemed on the destination chain. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} + +## Portal Bridge + +A practical implementation of the Wormhole Token Bridge can be seen in [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides an easy-to-use interface for transferring tokens across multiple blockchain networks. It leverages the Wormhole infrastructure to handle cross-chain asset transfers seamlessly, offering users a convenient way to bridge their assets while ensuring security and maintaining token integrity. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/token-bridge/overview/ --- BEGIN CONTENT --- --- @@ -8924,6 +9328,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-files/llms-typescript-sdk.txt b/llms-files/llms-typescript-sdk.txt index cc996ce38..f44ba8b8b 100644 --- a/llms-files/llms-typescript-sdk.txt +++ b/llms-files/llms-typescript-sdk.txt @@ -4883,6 +4883,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/reference/glossary/ --- BEGIN CONTENT --- --- diff --git a/llms-full.txt b/llms-full.txt index ed511506f..9409b7c93 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -53,6 +53,7 @@ Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/re Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/native-token-transfers/reference/cli-commands.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/native-token-transfers/reference/managers-transceivers.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/overview.md +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/products.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/queries/faqs.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/queries/get-started.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/queries/guides/use-queries.md @@ -74,7 +75,10 @@ Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/re Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/concepts/transfer-flow.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/faqs.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/get-started.md +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/attest-tokens.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/token-bridge-contracts.md +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens-payload.md +Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/overview.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/tutorials/multichain-token.md Doc-Page: https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/tutorials/transfer-workflow.md @@ -13741,6 +13745,74 @@ Beyond asset transfers, Wormhole provides additional tools for cross-chain data [**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/products/ +--- BEGIN CONTENT --- +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/queries/faqs/ --- BEGIN CONTENT --- --- @@ -16801,6 +16873,105 @@ Now that you've completed a manual multichain token transfer, explore these guid - [Create Multichain Tokens](/docs/products/token-bridge/tutorials/multichain-token){target=\_blank}: Learn how to issue tokens that work across chains. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/attest-tokens/ +--- BEGIN CONTENT --- +--- +title: Attesting Tokens via Token Bridge Contracts +description: Learn how to attest your token via Wormhole's Token Bridge for seamless multichain token transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Attesting Tokens via Token Bridge Contracts + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to attest your token via the Token Bridge contracts. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To attest your token with the Token Bridge contract, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. + + +## How to Attest Your Token + +Suppose a token has never been transferred to the target chain before transferring it cross-chain. In that case, its metadata must be registered so the Token Bridge can recognize it and create a wrapped version if necessary. + +The attestation process doesn't require you to manually input token details like name, symbol, or decimals. Instead, the Token Bridge contract retrieves these values from the token contract itself when you call the `attestToken()` method. + +```solidity +function attestToken( + address tokenAddress, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `tokenAddress` ++"address"++ + + The contract address of the token to be attested. + + --- + + `nonce` ++"uint32"++ + + An arbitrary value provided by the caller to ensure uniqueness. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the attestation transaction. + +When `attestToken()` is called, the contract emits a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} containing the token's metadata, which the [Guardians](/docs/protocol/infrastructure/guardians/){target=\_blank} sign and publish. + +You must ensure the token is ERC-20 compliant. If it does not implement the standard functions, the attestation may fail or produce incomplete metadata. + +## How to Verify an Attested Token + +To verify if a token has a wrapped representation in a given chain, you can call the `wrappedAsset()` function of the Token Bridge contract in the destination chain that you want to check. The function call will return the address of the wrapped token, or `0x0` if no wrapped token has been attested. + +```wrappedAsset +function attestToken( + uint16 tokenChainId, + bytes32 tokenAddress +) external view returns (address); +``` + +??? interface "Parameters" + + `uint16` ++"tokenChainId"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the source chain. + + --- + + `tokenAddress` ++"bytes32"++ + + The token's [Universal Address](/docs/products/reference/wormhole-formatted-addresses/#universal-address-methods){target=\_blank} in the source chain. + +??? interface "Returns" + + `wrappedTokenAddress` ++"address"++ + + The address of the wrapped token in this chain, or `0x0` if the token has not been attested. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/token-bridge-contracts/ --- BEGIN CONTENT --- --- @@ -17075,6 +17246,239 @@ For a deeper understanding of the Token Bridge implementation and to review the A practical implementation of the Wormhole Token Bridge can be seen in [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides an easy-to-use interface for transferring tokens across multiple blockchain networks. It leverages the Wormhole infrastructure to handle cross-chain asset transfers seamlessly, offering users a convenient way to bridge their assets while ensuring security and maintaining token integrity. --- END CONTENT --- +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/transfer-tokens-payload/ +--- BEGIN CONTENT --- +--- +title: Transfer Tokens with Payload - Token Bridge +description: Learn how to transfer your token with an additional payload via Wormhole's Token Bridge for seamless multichain token transfers with payload execution. +categories: Token-Bridge, Transfer +--- + +# Token Transfers with Payload via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to [transfer tokens with a message](/docs/protocol/infrastructure/vaas/#token-transfer-with-message){target=\_blank} via the Token Bridge contract, where arbitrary byte payloads can be attached to the token transfer, enabling more complex chain interactions. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with a payload via the Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. +- A formatted payload to be executed in the destination chain. + +## Transfer Tokens with Payload + +While a standard token transfer moves tokens between chains, a transfer with a payload allows you to embed arbitrary data in the [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank}. This data can be used on the destination chain to execute additional logic—such as automatically depositing tokens into a DeFi protocol, initiating a swap on a DEX, or interacting with a custom smart contract. + +Call `transferTokensWithPayload()` instead of `transferTokens()` to include a custom payload (arbitrary bytes) with the token transfer. + +```solidity +function transferTokensWithPayload( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint32 nonce, + bytes memory payload +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + + --- + + `payload` ++"bytes memory"++ + + Arbitrary data payload attached to the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +After initiating a transfer on the source chain, the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network observes and signs the resulting message, creating a VAA. You'll need to fetch this VAA and then call `completeTransferWithPayload()`. + +Only the designated recipient contract can redeem tokens. This ensures that the intended contract securely handles the attached payload. On successful redemption, the tokens are minted (if foreign) or released (if native) to the recipient address on the destination chain. For payload transfers, the designated contract can execute the payload's logic at this time. + +```solidity +function completeTransferWithPayload( + bytes memory encodedVm +) external returns (bytes memory); +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +??? interface "Returns" + + ++"bytes memory"++ + + The extracted payload data. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} +--- END CONTENT --- + +Doc-Content: https://wormhole.com/docs/products/token-bridge/guides/transfer-tokens/ +--- BEGIN CONTENT --- +--- +title: Transfer Tokens - Token Bridge Contract +description: Learn how to transfer your token via Wormhole's Token Bridge for seamless multichain transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Token Transfers via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to transfer tokens via the Token Bridge contract. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with the Wormhole Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. + +## Transfer Tokens + +Once a token is attested, a cross-chain token transfer can be initiated following the lock-and-mint mechanism. On the source chain, tokens are locked (or burned if they're already a wrapped asset), and a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} is emitted. On the destination chain, that VAA is used to mint or release the corresponding amount of wrapped tokens. + +Call `transferTokens()` to lock/burn tokens and produce a VAA with transfer details. + +```solidity +function transferTokens( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint256 arbiterFee, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `arbiterFee` ++"uint256"++ + + Optional fee to be paid to an arbiter for relaying the transfer. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +Once a transfer VAA is obtained from the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network, the final step is to redeem the tokens on the destination chain. Redemption verifies the VAA's authenticity and releases (or mints) tokens to the specified recipient. To redeem the tokens, call `completeTransfer()`. + +```solidity +function completeTransfer(bytes memory encodedVm) external; +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +!!!note + - The Token Bridge normalizes token amounts to 8 decimals when passing them between chains. Make sure your application accounts for potential decimal truncation. + - The VAA ensures the integrity of the message. Only after the Guardians sign the VAA can it be redeemed on the destination chain. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} + +## Portal Bridge + +A practical implementation of the Wormhole Token Bridge can be seen in [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides an easy-to-use interface for transferring tokens across multiple blockchain networks. It leverages the Wormhole infrastructure to handle cross-chain asset transfers seamlessly, offering users a convenient way to bridge their assets while ensuring security and maintaining token integrity. +--- END CONTENT --- + Doc-Content: https://wormhole.com/docs/products/token-bridge/overview/ --- BEGIN CONTENT --- --- @@ -17171,7 +17575,7 @@ description: Learn how to create a multichain token, bridge tokens across blockc Blockchain ecosystems are becoming increasingly interconnected, with assets often needing to exist across multiple networks to maximize their utility and reach. For example, tokens created on one chain may want to expand to others to tap into broader audiences and liquidity pools. -This guide explains how to create a multichain token—a token that seamlessly bridges across blockchains using the Wormhole protocol. The process is designed to be user-friendly. With just a few steps, your token can become multichain, enabling it to be traded or used on various networks. +This guide explains how to create a multichain token, a token that seamlessly bridges across blockchains using the Wormhole protocol. The process is designed to be user-friendly. With just a few steps, your token can become multichain, enabling it to be traded or used on various networks. By the end of this tutorial, you'll learn: @@ -17181,11 +17585,18 @@ By the end of this tutorial, you'll learn: Let’s begin with a straightforward, step-by-step process for creating a multichain token and expanding its reach. +## Prerequisites + +Before you start, ensure you have the following: + + - A compatible wallet (e.g., MetaMask, Phantom) + - Native tokens (testnet or mainnet) in your wallet on both the source and target chains + ## Register the Token on the Source Chain The first step in creating a multichain token is registering your token on its source chain. This ensures the token is prepared for bridging across blockchains. Follow these steps: -1. Open the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} +1. Open the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool 2. Select the blockchain where your token is currently deployed (source chain) 3. Connect your wallet by following the on-screen instructions 4. Locate the **Asset** field and paste the token contract address @@ -17195,7 +17606,9 @@ The first step in creating a multichain token is registering your token on its s ## Register the Token on the Target Chain -After registering your token on the source chain, the next step is to select the target chain—the blockchain where you want the wrapped version of your token to exist. This step connects your token to its destination network. +After registering your token on the source chain, the next step is to select the target chain, the blockchain where you want the wrapped version of your token to exist. This step connects your token to its destination network. + +In the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool, with the token already registered, take the following steps: 1. Choose the blockchain where you want the token to be bridged (target chain) 2. Connect your wallet to the target chain @@ -17204,8 +17617,11 @@ After registering your token on the source chain, the next step is to select the ![Target Chain Registration Screen](/docs/images/products/token-bridge/tutorials/multichain-tokens/multichain-token-2.webp) ## Send an Attestation + Attestation is a key step in the process. It verifies your token’s metadata, ensuring it is correctly recognized on the target chain’s blockchain explorer (e.g., [Etherscan](https://etherscan.io/){target=\_blank}). +In the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool, after the token has already been registered in both source and target chains, take the following steps: + 1. Click **Attest** to initiate the attestation process 2. Approve the transaction in your wallet when prompted @@ -17219,6 +17635,8 @@ Attestation is a key step in the process. It verifies your token’s metadata, e The final step is to create the wrapped token on the target chain. This token represents the original asset and enables its use within the target blockchain. +In the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool, after the token has already been registered in both source and target chains and the attestation sent, take the following steps: + 1. Click **Create** to generate the wrapped token 2. Approve the transaction in your wallet when prompted @@ -17276,7 +17694,7 @@ By leveraging Wormhole’s Token Bridge, this guide shows you how to build an ap - Non-EVM to EVM chains (e.g., Sui to Avalanche) - Non-EVM to non-EVM chains (e.g., Solana to Sui) -Existing solutions for cross-chain transfers can be complex and inefficient, requiring multiple steps and transaction fees. However, the Token Bridge method from Wormhole simplifies the process by handling the underlying attestation, transaction validation, and message passing across blockchains. +Existing solutions for multichain transfers can be complex and inefficient, requiring multiple steps and transaction fees. However, the Token Bridge method from Wormhole simplifies the process by handling the underlying attestation, transaction validation, and message passing across blockchains. At the end of this guide, you’ll have a fully functional setup for transferring assets across chains using Wormhole’s Token Bridge method. @@ -17305,11 +17723,11 @@ In this section, we’ll guide you through initializing the project, installing npm init -y ``` -2. **Create a `.gitignore` file** - ensure your private key isn't accidentally exposed or committed to version control +2. **Set up secure access to your wallets** - this guide assumes you are loading your private keys from a secure keystore of your choice, such as a secrets manager or a CLI-based tool like [`cast wallet`](https://book.getfoundry.sh/reference/cast/cast-wallet){target=\_blank}. + + !!! warning + If you use a `.env` file during development, add it to your `.gitignore` to exclude it from version control. Never commit private keys or mnemonics to your repository. - ```bash - echo ".env" >> .gitignore - ``` 3. **Install dependencies** - install the required dependencies, including the Wormhole SDK and helper libraries @@ -17317,24 +17735,7 @@ In this section, we’ll guide you through initializing the project, installing npm install @wormhole-foundation/sdk dotenv tsx ``` -4. **Set up environment variables** - to securely store your private key, create a `.env` file in the root of your project - - ```bash - touch .env - ``` - - Inside the `.env` file, add your private keys. - - ```env - ETH_PRIVATE_KEY="INSERT_YOUR_PRIVATE_KEY" - SOL_PRIVATE_KEY="INSERT_YOUR_PRIVATE_KEY" - SUI_PRIVATE_KEY="INSERT_SUI_MNEMONIC" - ``` - - !!! note - Ensure your private key contains native tokens for gas on both the source and destination chains. For Sui, you must provide a mnemonic instead of a private key. - -5. **Create a `helpers.ts` file** - to simplify the interaction between chains, create a file to store utility functions for fetching your private key, set up signers for different chains, and manage transaction relays +4. **Create a `helpers.ts` file** - to simplify the interaction between chains, create a file to store utility functions for fetching your private key, set up signers for different chains, and manage transaction relays 1. Create the helpers file @@ -17369,14 +17770,12 @@ export interface SignerStuff { address: ChainAddress; } -// Function to fetch environment variables (like your private key) -function getEnv(key: string): string { - const val = process.env[key]; - if (!val) throw new Error(`Missing environment variable: ${key}`); - return val; -} - -// Signer setup function for different blockchain platforms +/** + * Returns a signer for the given chain using locally scoped credentials. + * The required values (EVM_PRIVATE_KEY, SOL_PRIVATE_KEY, SUI_MNEMONIC, APTOS_PRIVATE_KEY) must + * be loaded securely beforehand, for example via a keystore, secrets + * manager, or environment variables (not recommended). + */ export async function getSigner( chain: ChainContext, gasLimit?: bigint @@ -17392,27 +17791,23 @@ export async function getSigner( case 'Solana': signer = await ( await solana() - ).getSigner(await chain.getRpc(), getEnv('SOL_PRIVATE_KEY')); + ).getSigner(await chain.getRpc(), 'SOL_PRIVATE_KEY'); break; case 'Evm': const evmSignerOptions = gasLimit ? { gasLimit } : {}; signer = await ( await evm() - ).getSigner( - await chain.getRpc(), - getEnv('ETH_PRIVATE_KEY'), - evmSignerOptions - ); + ).getSigner(await chain.getRpc(), 'ETH_PRIVATE_KEY', evmSignerOptions); break; case 'Sui': signer = await ( await sui() - ).getSigner(await chain.getRpc(), getEnv('SUI_MNEMONIC')); + ).getSigner(await chain.getRpc(), 'SUI_MNEMONIC'); break; case 'Aptos': signer = await ( await aptos() - ).getSigner(await chain.getRpc(), getEnv('APTOS_PRIVATE_KEY')); + ).getSigner(await chain.getRpc(), 'APTOS_PRIVATE_KEY'); break; default: throw new Error('Unsupported platform: ' + platform); @@ -17439,8 +17834,7 @@ export async function getTokenDecimals<
``` - - **`getEnv`** - this function fetches environment variables like your private key from the `.env` file - - **`getSigner`** - based on the chain you're working with (EVM, Solana, Sui, etc.), this function retrieves a signer for that specific platform. The signer is responsible for signing transactions and interacting with the blockchain. It securely uses the private key stored in your `.env` file + - **`getSigner`** - based on the chain you're working with (EVM, Solana, Sui, etc.), this function retrieves a signer for that specific platform. The signer is responsible for signing transactions and interacting with the blockchain. Private keys must be securely loaded beforehand, for example, via keystore or secrets managers - **`getTokenDecimals`** - this function fetches the number of decimals for a token on a specific chain. It helps handle token amounts accurately during transfers ## Check and Create Wrapped Tokens diff --git a/llms.txt b/llms.txt index b96b1956f..89be745ed 100644 --- a/llms.txt +++ b/llms.txt @@ -51,6 +51,7 @@ - [NTT CLI Commands](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/native-token-transfers/reference/cli-commands.md): A comprehensive guide to the Native Token Transfers (NTT) CLI, detailing commands for managing token transfers across chains within the Wormhole ecosystem. - [Managers and Transceivers](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/native-token-transfers/reference/managers-transceivers.md): Explore the roles of Managers and Transceivers in NTT cross-chain token transfers, including key functions, lifecycle events, and rate-limiting mechanisms. - [Compare Wormhole's Cross-Chain Solutions](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/overview.md): Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +- [Compare Wormhole's Cross-Chain Solutions](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/products.md): Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. - [Queries FAQs](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/queries/faqs.md): Wormhole Queries FAQ covering available libraries, query examples, response formats, and details about running query proxy servers. - [Get Started with Queries](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/queries/get-started.md): Follow this guide to run your first multichain, verifiable query with the Wormhole Queries SDK and Proxy, using eth_call to fetch token metadata. - [Use Queries](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/queries/guides/use-queries.md): Explore a simple demo of interacting with Wormhole Queries using an eth_call request to query the supply of wETH on Ethereum using a Wormhole query. @@ -72,7 +73,10 @@ - [Flow of a Token Bridge Transfer](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/concepts/transfer-flow.md): Learn how the Wormhole Token Bridge enables secure, cross-chain token transfers by combining token-specific logic with Wormhole's core message-passing layer. - [Token Bridge FAQs](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/faqs.md): Find answers to common questions about the Wormhole Token Bridge, including managing wrapped assets and understanding gas fees. - [Get Started with Token Bridge](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/get-started.md): Perform token transfers using Wormhole’s Token Bridge with the TypeScript SDK, including manual (Solana–Sepolia) and automatic (Fuji–Alfajores). +- [Attesting Tokens via Token Bridge Contracts](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/attest-tokens.md): Learn how to attest your token via Wormhole's Token Bridge for seamless multichain token transfers with a lock-and-mint mechanism and cross-chain asset management. - [Get Started with Token Bridge](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/token-bridge-contracts.md): Learn how to integrate Wormhole's Token Bridge for seamless multichain token transfers with a lock-and-mint mechanism and cross-chain asset management. +- [Transfer Tokens with Payload - Token Bridge](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens-payload.md): Learn how to transfer your token with an additional payload via Wormhole's Token Bridge for seamless multichain token transfers with payload execution. +- [Transfer Tokens - Token Bridge Contract](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/guides/transfer-tokens.md): Learn how to transfer your token via Wormhole's Token Bridge for seamless multichain transfers with a lock-and-mint mechanism and cross-chain asset management. - [Token Bridge Overview](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/overview.md): With Wormhole Token Bridge, you can enable secure, multichain communication, build multichain apps, sync data, and coordinate actions across blockchains. - [Create Multichain Tokens](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/tutorials/multichain-token.md): Learn how to create a multichain token, bridge tokens across blockchains, and update metadata for seamless multichain interoperability. - [Transfer Tokens via Token Bridge Tutorial](https://raw.githubusercontent.com/wormhole-foundation/wormhole-docs/refs/heads/main/products/token-bridge/tutorials/transfer-workflow.md): Learn to build a cross-chain native token transfer app using Wormhole’s TypeScript SDK, supporting native token transfers across EVM and non-EVM chains diff --git a/products/connect/configuration/data.md b/products/connect/configuration/data.md index 736c5ead9..cc72273b5 100644 --- a/products/connect/configuration/data.md +++ b/products/connect/configuration/data.md @@ -157,4 +157,4 @@ Your selected blockchain network determines the available wallet options when us The wallet options automatically adjust based on the selected chain, providing a seamless user experience without additional configuration. -If you would like to offer Reown Cloud (formerly WalletConnect) as a supported wallet option, you'll need to obtain a project ID on the [Reown Cloud dashboard](https://cloud.reown.com/){target=\_blank}. \ No newline at end of file +If you would like to offer Reown Cloud (formerly WalletConnect) as a supported wallet option, you'll need to obtain a project ID on the [Reown Cloud dashboard](https://cloud.reown.com/){target=\_blank}. diff --git a/products/connect/tutorials/react-dapp.md b/products/connect/tutorials/react-dapp.md index ae659a0ed..f343b5399 100644 --- a/products/connect/tutorials/react-dapp.md +++ b/products/connect/tutorials/react-dapp.md @@ -144,4 +144,4 @@ By following these steps, you've learned how to: - Implement a streamlined UI for selecting source and destination chains, connecting wallets, and initiating transfers - Execute a token transfer from Sui to Avalanche Fuji, monitoring each step and confirming the transaction on both networks -With these tools and knowledge, you're now equipped to build powerful cross-chain applications using Connect, opening up possibilities for users to move assets across ecosystems securely and efficiently. \ No newline at end of file +With these tools and knowledge, you're now equipped to build powerful cross-chain applications using Connect, opening up possibilities for users to move assets across ecosystems securely and efficiently. diff --git a/products/products.md b/products/products.md new file mode 100644 index 000000000..0c524ceda --- /dev/null +++ b/products/products.md @@ -0,0 +1,64 @@ +--- +title: Compare Wormhole's Cross-Chain Solutions +description: Compare Wormhole’s cross-chain solutions for bridging, native transfers, data queries, and governance to enable seamless blockchain interoperability. +categories: Transfer, Basics +--- + +# Products + +Wormhole provides a comprehensive suite of cross-chain solutions, enabling seamless asset transfers, data retrieval, and governance across blockchain ecosystems. + +Wormhole provides multiple options for asset transfers: Connect for a plug-and-play bridging UI, Native Token Transfers (NTT) for moving native assets without wrapped representations, and Token Bridge for a secure lock-and-mint mechanism. + +Beyond transfers, Wormhole extends interoperability with tools for cross-chain data access, decentralized governance, and an intent-based protocol through Wormhole Settlement. + +## Transfer Products + +Wormhole offers different solutions for cross-chain asset transfer, each designed for various use cases and integration requirements. + +- [**Native Token Transfers (NTT)**](/docs/products/native-token-transfers/overview/){target=\_blank} - a mechanism to transfer native tokens cross-chain seamlessly without conversion to a wrapped asset. Best for projects that require maintaining token fungibility and native chain functionality across multiple networks +- [**Token Bridge**](/docs/products/token-bridge/overview/){target=\_blank} - a bridging solution that uses a lock and mint mechanism. Best for projects that need cross-chain liquidity using wrapped assets and the ability to send messages +- [**Settlement**](/docs/products/settlement/overview/){target=\_blank} - intent-based protocols enabling fast multichain transfers, optimized liquidity flows, and interoperability without relying on traditional bridging methods + +
+ +::spantable:: + +| | Criteria | NTT | Token Bridge | Settlement | +|--------------------------------|---------------------------------------|--------------------|--------------------|--------------------| +| Supported Transfer Types @span | Token Transfers | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | Token Transfers with Payloads | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Supported Assets @span | Wrapped Assets | :x: | :white_check_mark: | :white_check_mark: | +| | Native Assets | :white_check_mark: | :x: | :white_check_mark: | +| | ERC-721s (NFTs) | :x: | :white_check_mark: | :white_check_mark: | +| Features @span | Out-of-the-Box UI | :x: | :x: | :white_check_mark: | +| | Event-Based Actions | :white_check_mark: | :white_check_mark: | :x: | +| | Intent-Based Execution | :x: | :x: | :white_check_mark: | +| | Fast Settlement | :x: | :x: | :white_check_mark: | +| | Liquidity Optimization | :x: | :x: | :white_check_mark: | +| Integration Details @span | | | | | +| Requirements @span | Contract Deployment | :white_check_mark: | :x: |:x: | +| Ease of Integration | Implementation Complexity | :green_circle: :green_circle: :white_circle:
Moderate | :green_circle: :green_circle: :white_circle:
Moderate |:green_circle: :white_circle: :white_circle:
Low | +| Technology @span | Supported Languages | Solidity, Rust | Solidity, Rust, TypeScript | TypeScript | + +::end-spantable:: + +
+ +In the following video, Wormhole Foundation DevRel Pauline Barnades walks you through the key differences between Wormhole’s Native Token Transfers (NTT) and Token Bridge and how to select the best option for your use case: + +
+ +Beyond asset transfers, Wormhole provides additional tools for cross-chain data and governance. + +## Bridging UI + +[**Connect**](/docs/products/connect/overview/){target=\_blank} is a pre-built bridging UI for cross-chain token transfers, requiring minimal setup. Best for projects seeking an easy-to-integrate UI for bridging without modifying contracts. + +## Real-time Data + +[**Queries**](/docs/products/queries/overview/){target=\_blank} is a data retrieval service to fetch on-chain data from multiple networks. Best for applications that need multichain analytics, reporting, and data aggregation. + +## Multichain Governance + +[**MultiGov**](/docs/products/multigov/overview/){target=\_blank} is a unified governance framework that manages multichain protocol governance through a single mechanism. Best for projects managing multichain governance and protocol updates. \ No newline at end of file diff --git a/products/settlement/guides/.pages b/products/settlement/guides/.pages new file mode 100644 index 000000000..8569cf10a --- /dev/null +++ b/products/settlement/guides/.pages @@ -0,0 +1,4 @@ +title: Guides +nav: +- 'Build on the Liquidity Layer': 'liquidity-layer.md' +- 'Run a Solver': 'solver.md' diff --git a/products/settlement/overview.md b/products/settlement/overview.md index 30895e233..c6168ae26 100644 --- a/products/settlement/overview.md +++ b/products/settlement/overview.md @@ -90,4 +90,4 @@ Mayan MCTP is a fallback protocol that wraps Circle’s CCTP into the Settlement Start building with Settlement or dive deeper into specific components: - **[Get Started with Settlement](/docs/products/settlement/get-started/)**: Follow a hands-on demo using Mayan Swift. -- **[Architecture Documentation](/docs/products/settlement/concepts/architecture/)**: Explore the Settlement architecture and components. \ No newline at end of file +- **[Architecture Documentation](/docs/products/settlement/concepts/architecture/)**: Explore the Settlement architecture and components. diff --git a/products/token-bridge/guides/attest-tokens.md b/products/token-bridge/guides/attest-tokens.md new file mode 100644 index 000000000..eaf66f5a6 --- /dev/null +++ b/products/token-bridge/guides/attest-tokens.md @@ -0,0 +1,95 @@ +--- +title: Attesting Tokens via Token Bridge Contracts +description: Learn how to attest your token via Wormhole's Token Bridge for seamless multichain token transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Attesting Tokens via Token Bridge Contracts + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to attest your token via the Token Bridge contracts. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To attest your token with the Token Bridge contract, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. + + +## How to Attest Your Token + +Suppose a token has never been transferred to the target chain before transferring it cross-chain. In that case, its metadata must be registered so the Token Bridge can recognize it and create a wrapped version if necessary. + +The attestation process doesn't require you to manually input token details like name, symbol, or decimals. Instead, the Token Bridge contract retrieves these values from the token contract itself when you call the `attestToken()` method. + +```solidity +function attestToken( + address tokenAddress, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `tokenAddress` ++"address"++ + + The contract address of the token to be attested. + + --- + + `nonce` ++"uint32"++ + + An arbitrary value provided by the caller to ensure uniqueness. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the attestation transaction. + +When `attestToken()` is called, the contract emits a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} containing the token's metadata, which the [Guardians](/docs/protocol/infrastructure/guardians/){target=\_blank} sign and publish. + +You must ensure the token is ERC-20 compliant. If it does not implement the standard functions, the attestation may fail or produce incomplete metadata. + +## How to Verify an Attested Token + +To verify if a token has a wrapped representation in a given chain, you can call the `wrappedAsset()` function of the Token Bridge contract in the destination chain that you want to check. The function call will return the address of the wrapped token, or `0x0` if no wrapped token has been attested. + +```wrappedAsset +function attestToken( + uint16 tokenChainId, + bytes32 tokenAddress +) external view returns (address); +``` + +??? interface "Parameters" + + `uint16` ++"tokenChainId"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the source chain. + + --- + + `tokenAddress` ++"bytes32"++ + + The token's [Universal Address](/docs/products/reference/wormhole-formatted-addresses/#universal-address-methods){target=\_blank} in the source chain. + +??? interface "Returns" + + `wrappedTokenAddress` ++"address"++ + + The address of the wrapped token in this chain, or `0x0` if the token has not been attested. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} diff --git a/products/token-bridge/guides/transfer-tokens-payload.md b/products/token-bridge/guides/transfer-tokens-payload.md new file mode 100644 index 000000000..89ed36d1e --- /dev/null +++ b/products/token-bridge/guides/transfer-tokens-payload.md @@ -0,0 +1,114 @@ +--- +title: Transfer Tokens with Payload - Token Bridge +description: Learn how to transfer your token with an additional payload via Wormhole's Token Bridge for seamless multichain token transfers with payload execution. +categories: Token-Bridge, Transfer +--- + +# Token Transfers with Payload via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to [transfer tokens with a message](/docs/protocol/infrastructure/vaas/#token-transfer-with-message){target=\_blank} via the Token Bridge contract, where arbitrary byte payloads can be attached to the token transfer, enabling more complex chain interactions. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with a payload via the Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. +- A formatted payload to be executed in the destination chain. + +## Transfer Tokens with Payload + +While a standard token transfer moves tokens between chains, a transfer with a payload allows you to embed arbitrary data in the [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank}. This data can be used on the destination chain to execute additional logic—such as automatically depositing tokens into a DeFi protocol, initiating a swap on a DEX, or interacting with a custom smart contract. + +Call `transferTokensWithPayload()` instead of `transferTokens()` to include a custom payload (arbitrary bytes) with the token transfer. + +```solidity +function transferTokensWithPayload( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint32 nonce, + bytes memory payload +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + + --- + + `payload` ++"bytes memory"++ + + Arbitrary data payload attached to the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +After initiating a transfer on the source chain, the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network observes and signs the resulting message, creating a VAA. You'll need to fetch this VAA and then call `completeTransferWithPayload()`. + +Only the designated recipient contract can redeem tokens. This ensures that the intended contract securely handles the attached payload. On successful redemption, the tokens are minted (if foreign) or released (if native) to the recipient address on the destination chain. For payload transfers, the designated contract can execute the payload's logic at this time. + +```solidity +function completeTransferWithPayload( + bytes memory encodedVm +) external returns (bytes memory); +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +??? interface "Returns" + + ++"bytes memory"++ + + The extracted payload data. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} \ No newline at end of file diff --git a/products/token-bridge/guides/transfer-tokens.md b/products/token-bridge/guides/transfer-tokens.md new file mode 100644 index 000000000..4e338cfcc --- /dev/null +++ b/products/token-bridge/guides/transfer-tokens.md @@ -0,0 +1,111 @@ +--- +title: Transfer Tokens - Token Bridge Contract +description: Learn how to transfer your token via Wormhole's Token Bridge for seamless multichain transfers with a lock-and-mint mechanism and cross-chain asset management. +categories: Token-Bridge, Transfer +--- + +# Token Transfers via the Token Bridge Contract + +## Introduction + +Wormhole's [Token Bridge](/docs/products/token-bridge/overview/){target=\_blank} enables seamless cross-chain token transfers using a lock-and-mint mechanism. The bridge locks tokens on the source chain and mints them as wrapped assets on the destination chain. The primary functions of the Token Bridge contracts revolve around: + +- **Attesting a token**: Registering a new token for cross-chain transfers. +- **Transferring tokens**: Locking and minting tokens across chains. +- **Transferring tokens with a payload**: Including additional data with transfers. + +This page outlines how to transfer tokens via the Token Bridge contract. To understand the theoretical workings of the Token Bridge, refer to the [Token Bridge Overview](/docs/products/token-bridge/overview/){target=\_blank} page. + +## Prerequisites + +To transfer a token with the Wormhole Token Bridge, you'll need the following: + +- [The address of the Token Bridge contract](/docs/products/reference/contract-addresses/#token-bridge){target=\_blank} on the chains you're working with. +- [The Wormhole chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the chains you're targeting for token transfers. +- The token you want to transfer must be [attested](/docs/products/token-bridge/guides/attest-tokens/){target=\_blank} beforehand. + +## Transfer Tokens + +Once a token is attested, a cross-chain token transfer can be initiated following the lock-and-mint mechanism. On the source chain, tokens are locked (or burned if they're already a wrapped asset), and a [Verifiable Action Approval (VAA)](/docs/protocol/infrastructure/vaas/){target=\_blank} is emitted. On the destination chain, that VAA is used to mint or release the corresponding amount of wrapped tokens. + +Call `transferTokens()` to lock/burn tokens and produce a VAA with transfer details. + +```solidity +function transferTokens( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint256 arbiterFee, + uint32 nonce +) external payable returns (uint64 sequence); +``` + +??? interface "Parameters" + + `token` ++"address"++ + + The address of the token being transferred. + + --- + + `amount` ++"uint256"++ + + The amount of tokens to be transferred. + + --- + + `recipientChain` ++"uint16"++ + + The Wormhole [chain ID](/docs/products/reference/chain-ids/){target=\_blank} of the destination chain. + + --- + + `recipient` ++"bytes32"++ + + The recipient's address on the destination chain. + + --- + + `arbiterFee` ++"uint256"++ + + Optional fee to be paid to an arbiter for relaying the transfer. + + --- + + `nonce` ++"uint32"++ + + A unique identifier for the transaction. + +??? interface "Returns" + + `sequence` ++"uint64"++ + + A unique identifier for the transfer transaction. + +Once a transfer VAA is obtained from the [Guardian](/docs/protocol/infrastructure/guardians/){target=\_blank} network, the final step is to redeem the tokens on the destination chain. Redemption verifies the VAA's authenticity and releases (or mints) tokens to the specified recipient. To redeem the tokens, call `completeTransfer()`. + +```solidity +function completeTransfer(bytes memory encodedVm) external; +``` + +??? interface "Parameters" + + `encodedVm` ++"bytes memory"++ + + The signed VAA containing the transfer details. + +!!!note + - The Token Bridge normalizes token amounts to 8 decimals when passing them between chains. Make sure your application accounts for potential decimal truncation. + - The VAA ensures the integrity of the message. Only after the Guardians sign the VAA can it be redeemed on the destination chain. + +## Source Code References + +For a deeper understanding of the Token Bridge implementation and to review the actual source code, please refer to the following links: + +- [Token Bridge contract](https://github.com/wormhole-foundation/wormhole/blob/main/ethereum/contracts/bridge/Bridge.sol){target=\_blank} +- [Token Bridge interface](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/main/src/interfaces/ITokenBridge.sol){target=\_blank} + +## Portal Bridge + +A practical implementation of the Wormhole Token Bridge can be seen in [Portal Bridge](https://portalbridge.com/){target=\_blank}, which provides an easy-to-use interface for transferring tokens across multiple blockchain networks. It leverages the Wormhole infrastructure to handle cross-chain asset transfers seamlessly, offering users a convenient way to bridge their assets while ensuring security and maintaining token integrity. diff --git a/products/token-bridge/tutorials/.pages b/products/token-bridge/tutorials/.pages index cce40e0be..faa963dc8 100644 --- a/products/token-bridge/tutorials/.pages +++ b/products/token-bridge/tutorials/.pages @@ -1,4 +1,4 @@ title: Tutorials nav: - 'Complete Token Transfer Workflow': transfer-workflow.md -- 'Create Multichain Tokens': multichain-token.md \ No newline at end of file +- 'Create Multichain Tokens': multichain-token.md diff --git a/products/token-bridge/tutorials/multichain-token.md b/products/token-bridge/tutorials/multichain-token.md index 3efdb309e..a5d407f48 100644 --- a/products/token-bridge/tutorials/multichain-token.md +++ b/products/token-bridge/tutorials/multichain-token.md @@ -9,7 +9,7 @@ description: Learn how to create a multichain token, bridge tokens across blockc Blockchain ecosystems are becoming increasingly interconnected, with assets often needing to exist across multiple networks to maximize their utility and reach. For example, tokens created on one chain may want to expand to others to tap into broader audiences and liquidity pools. -This guide explains how to create a multichain token—a token that seamlessly bridges across blockchains using the Wormhole protocol. The process is designed to be user-friendly. With just a few steps, your token can become multichain, enabling it to be traded or used on various networks. +This guide explains how to create a multichain token, a token that seamlessly bridges across blockchains using the Wormhole protocol. The process is designed to be user-friendly. With just a few steps, your token can become multichain, enabling it to be traded or used on various networks. By the end of this tutorial, you'll learn: @@ -19,11 +19,18 @@ By the end of this tutorial, you'll learn: Let’s begin with a straightforward, step-by-step process for creating a multichain token and expanding its reach. +## Prerequisites + +Before you start, ensure you have the following: + + - A compatible wallet (e.g., MetaMask, Phantom) + - Native tokens (testnet or mainnet) in your wallet on both the source and target chains + ## Register the Token on the Source Chain The first step in creating a multichain token is registering your token on its source chain. This ensures the token is prepared for bridging across blockchains. Follow these steps: -1. Open the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} +1. Open the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool 2. Select the blockchain where your token is currently deployed (source chain) 3. Connect your wallet by following the on-screen instructions 4. Locate the **Asset** field and paste the token contract address @@ -33,7 +40,9 @@ The first step in creating a multichain token is registering your token on its s ## Register the Token on the Target Chain -After registering your token on the source chain, the next step is to select the target chain—the blockchain where you want the wrapped version of your token to exist. This step connects your token to its destination network. +After registering your token on the source chain, the next step is to select the target chain, the blockchain where you want the wrapped version of your token to exist. This step connects your token to its destination network. + +In the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool, with the token already registered, take the following steps: 1. Choose the blockchain where you want the token to be bridged (target chain) 2. Connect your wallet to the target chain @@ -42,8 +51,11 @@ After registering your token on the source chain, the next step is to select the ![Target Chain Registration Screen](/docs/images/products/token-bridge/tutorials/multichain-tokens/multichain-token-2.webp) ## Send an Attestation + Attestation is a key step in the process. It verifies your token’s metadata, ensuring it is correctly recognized on the target chain’s blockchain explorer (e.g., [Etherscan](https://etherscan.io/){target=\_blank}). +In the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool, after the token has already been registered in both source and target chains, take the following steps: + 1. Click **Attest** to initiate the attestation process 2. Approve the transaction in your wallet when prompted @@ -57,6 +69,8 @@ Attestation is a key step in the process. It verifies your token’s metadata, e The final step is to create the wrapped token on the target chain. This token represents the original asset and enables its use within the target blockchain. +In the [Portal Bridge](https://portalbridge.com/advanced-tools/#/register){target=\_blank} token registration tool, after the token has already been registered in both source and target chains and the attestation sent, take the following steps: + 1. Click **Create** to generate the wrapped token 2. Approve the transaction in your wallet when prompted diff --git a/products/token-bridge/tutorials/transfer-workflow.md b/products/token-bridge/tutorials/transfer-workflow.md index ecee1f16e..d63d40fa6 100644 --- a/products/token-bridge/tutorials/transfer-workflow.md +++ b/products/token-bridge/tutorials/transfer-workflow.md @@ -18,7 +18,7 @@ By leveraging Wormhole’s Token Bridge, this guide shows you how to build an ap - Non-EVM to EVM chains (e.g., Sui to Avalanche) - Non-EVM to non-EVM chains (e.g., Solana to Sui) -Existing solutions for cross-chain transfers can be complex and inefficient, requiring multiple steps and transaction fees. However, the Token Bridge method from Wormhole simplifies the process by handling the underlying attestation, transaction validation, and message passing across blockchains. +Existing solutions for multichain transfers can be complex and inefficient, requiring multiple steps and transaction fees. However, the Token Bridge method from Wormhole simplifies the process by handling the underlying attestation, transaction validation, and message passing across blockchains. At the end of this guide, you’ll have a fully functional setup for transferring assets across chains using Wormhole’s Token Bridge method. @@ -47,11 +47,11 @@ In this section, we’ll guide you through initializing the project, installing npm init -y ``` -2. **Create a `.gitignore` file** - ensure your private key isn't accidentally exposed or committed to version control +2. **Set up secure access to your wallets** - this guide assumes you are loading your private keys from a secure keystore of your choice, such as a secrets manager or a CLI-based tool like [`cast wallet`](https://book.getfoundry.sh/reference/cast/cast-wallet){target=\_blank}. + + !!! warning + If you use a `.env` file during development, add it to your `.gitignore` to exclude it from version control. Never commit private keys or mnemonics to your repository. - ```bash - echo ".env" >> .gitignore - ``` 3. **Install dependencies** - install the required dependencies, including the Wormhole SDK and helper libraries @@ -59,24 +59,7 @@ In this section, we’ll guide you through initializing the project, installing npm install @wormhole-foundation/sdk dotenv tsx ``` -4. **Set up environment variables** - to securely store your private key, create a `.env` file in the root of your project - - ```bash - touch .env - ``` - - Inside the `.env` file, add your private keys. - - ```env - ETH_PRIVATE_KEY="INSERT_YOUR_PRIVATE_KEY" - SOL_PRIVATE_KEY="INSERT_YOUR_PRIVATE_KEY" - SUI_PRIVATE_KEY="INSERT_SUI_MNEMONIC" - ``` - - !!! note - Ensure your private key contains native tokens for gas on both the source and destination chains. For Sui, you must provide a mnemonic instead of a private key. - -5. **Create a `helpers.ts` file** - to simplify the interaction between chains, create a file to store utility functions for fetching your private key, set up signers for different chains, and manage transaction relays +4. **Create a `helpers.ts` file** - to simplify the interaction between chains, create a file to store utility functions for fetching your private key, set up signers for different chains, and manage transaction relays 1. Create the helpers file @@ -91,8 +74,7 @@ In this section, we’ll guide you through initializing the project, installing --8<-- "code/products/token-bridge/tutorials/transfer-workflow/token-bridge-1.ts" ``` - - **`getEnv`** - this function fetches environment variables like your private key from the `.env` file - - **`getSigner`** - based on the chain you're working with (EVM, Solana, Sui, etc.), this function retrieves a signer for that specific platform. The signer is responsible for signing transactions and interacting with the blockchain. It securely uses the private key stored in your `.env` file + - **`getSigner`** - based on the chain you're working with (EVM, Solana, Sui, etc.), this function retrieves a signer for that specific platform. The signer is responsible for signing transactions and interacting with the blockchain. Private keys must be securely loaded beforehand, for example, via keystore or secrets managers - **`getTokenDecimals`** - this function fetches the number of decimals for a token on a specific chain. It helps handle token amounts accurately during transfers ## Check and Create Wrapped Tokens