# Teleporting DOT between Asset Hub and Relay Chain This guide is meant to show how to teleport DOT between the Asset Hub chain and the Relay Chain. We'll look at two ways, via a UI, for an easier one-off experience and via code, for a more programmatic experience. ## Via a UI This is a manual approach, meant for one-off teleports. Go to https://app.turtle.cool/, you'll see their main widget for cross-chain transfers. ![Screenshot 2025-06-30 at 11.28.31 am](https://hackmd.io/_uploads/S1ozyXgBgl.png) When you select the `Chain` option in `From`, you'll see a dropdown of all the chains turtle supports. From here you can pick `Asset Hub`. ![Screenshot 2025-06-30 at 11.29.30 am](https://hackmd.io/_uploads/rkYI17eSxx.png) After you choose `Asset Hub`, you'll see all the assets supported by this chain. You can choose `DOT` here. ![Screenshot 2025-06-30 at 11.30.27 am](https://hackmd.io/_uploads/H1xqkQxHle.png) Input some amount. ![Screenshot 2025-06-30 at 11.31.17 am](https://hackmd.io/_uploads/rJZ6JmxHlx.png) Click on the `connect` button to connect a wallet for doing the teleport. This will display a modal. ![Screenshot 2025-06-30 at 11.32.46 am](https://hackmd.io/_uploads/Syqfe7gHle.png) In this case I have both `Talisman` and `Subwallet` installed. If you don't have one, the link on the bottom of the modal will take you to a guide on how to install one and create/import an account. After your wallet is connected, you can go ahead and choose `Polkadot` (the Relay Chain) as the destination. It only supports `DOT` so you just have to select it. ![Screenshot 2025-06-30 at 11.34.08 am](https://hackmd.io/_uploads/S1nDeQxHge.png) You'll be shown that you want to teleport from your account on `Asset Hub` to the same account on the Relay Chain. You'll also be shown the estimated fees and an estimated duration. Note that the duration is usually much shorter than this. ![Screenshot 2025-06-30 at 11.35.56 am](https://hackmd.io/_uploads/r1qAlXeSex.png) Then you need to hit send. It will dry-run your transfer to make sure everything will succeed and then prompt your wallet for signing the transaction. After signing, you'll see the ongoing transaction at the bottom. You can click on it to see it in a block explorer. ![Screenshot 2025-06-30 at 11.39.43 am](https://hackmd.io/_uploads/r13hWQlSeg.png) ![Screenshot 2025-06-30 at 11.40.39 am](https://hackmd.io/_uploads/H14xf7grex.png) If you want to teleport from the Relay Chain to `Asset Hub` you just change the sender and destination, you can even click on the `Switch From and To` button to switch them easier. ## Via code While using the turtle app in the last step is a great solution for one-off teleports, if we want to integrate this in a pipeline, doing it programmatically is the best way. Turtle is powered by `Paraspell`, a typescript SDK for doing cross-chain transfers. Let's build a script with it to do the same teleport. To start using it, we can follow the [getting started](https://paraspell.github.io/docs/sdk/getting-started.html), either using `npm`, `yarn` or `pnpm`. We'll use `npm`. First we install all the necessary libraries, including some typescript dependencies. ```bash mkdir teleport-ah-relay cd teleport-ah-relay npm init -y npm install typescript tsx --save-dev npm install polkadot-api @paraspell/sdk ``` Next, we can either sign transactions with a browser extension, like it was done with turtle, or with the seed phrase locally in a `.env` file. In both of these scenarios, if you want to switch source and destination chains, you need to change the `from` and `to` parameters. We'll look at the case with a browser extension first. ### Signing with browser extension We can use the following code: ```typescript import { Builder } from '@paraspell/sdk'; // DOT has 10 decimals, we use this to simplify. const DOT_UNITS = 10_000_000_000n; // If using Westend, you should use these decimals. const WND_UNITS = 1_000_000_000_000n; // TODO: Add your account here. const YOUR_ACCOUNT = 'add_your_ss58_account_here'; teleport(); async function teleport() { // We build the teleport transaction. const builder = Builder() .from('AssetHubPolkadot') // Or AssetHubWestend .to('Polkadot') // Or Westend .currency({ symbol: 'DOT', // Or WND amount: 10n * DOT_UNITS // Or WND_UNITS }) // The beneficiary is the account you added previously. .address(YOUR_ACCOUNT); const tx = await builder.build(); const callData = await tx.getEncodedData(); // This generates a link the polkadot developer console. // Once there, it's easy to submit. // Use westend_asset_hub as the network if using Westend. console.log(`Send via PAPI console: https://dev.papi.how/extrinsics#networkId=polkadot_asset_hub&endpoint=wss%3A%2F%2Fsys.ibp.network%2Fasset-hub-polkadot&data=${callData.asHex()} `); } ``` If the file was named `index.ts`, we can run the script with: ```bash npx tsx index.ts ``` After running the script, we'll get a link to the developer console, where we can easily sign and submit our transaction. When in the developer console, you can click `Submit extrinsic` to open the modal with the wallet options, you then choose your wallet, your account and submit. ![Screenshot 2025-06-30 at 7.50.28 pm](https://hackmd.io/_uploads/Bk-6VqxSxl.png) ![Screenshot 2025-06-30 at 7.52.00 pm](https://hackmd.io/_uploads/Byk7S5eBxx.png) ### Signing with the seed phrase For signing with the seed phrase we need to install extra dependencies. ```bash npm install dotenv @polkadot-labs/hdkd @polkadot-labs/hdkd-helpers ``` In order to sign the transaction, we're going to need the seed phrase of our account. Once we have it, we put it in a `.env` file under `SEED_PHRASE`. Then we can use the following script: ```typescript // Imports. import { Builder } from '@paraspell/sdk'; import { entropyToMiniSecret, mnemonicToEntropy, ss58Address } from "@polkadot-labs/hdkd-helpers" import { getPolkadotSigner } from "polkadot-api/signer" import 'dotenv/config'; import { sr25519CreateDerive } from '@polkadot-labs/hdkd'; // DOT has 10 decimals, we use this to simplify. const DOT_UNITS = 10_000_000_000n; // WND has 12 decimals. const WND_UNITS = 1_000_000_000_000n; // Do the actual teleport. We defer the functionality to a function. teleport(); async function teleport() { // We build a signer. const signer = getSigner(); // We build the teleport transaction. const tx = await Builder() .from('AssetHubPolkadot') // Or AssetHubWestend .to('Polkadot') // Or Westend .currency({ symbol: 'DOT', // Or WND amount: 10n * DOT_UNITS // Or WND_UNITS }) // To the same address on the different chain. .address(ss58Address(signer.publicKey)) .build(); // Sign the tx and submit it. const result = await tx.signAndSubmit(signer); console.dir({ result }); } function getSigner() { const entropy = mnemonicToEntropy(process.env.SEED_PHRASE!); const miniSecret = entropyToMiniSecret(entropy); const derive = sr25519CreateDerive(miniSecret); // You can use HDKD (Hierarchical Deterministic Key Derivation) // here if you have a derived account. const keyPair = derive(""); const polkadotSigner = getPolkadotSigner( keyPair.publicKey, "Sr25519", keyPair.sign, ); return polkadotSigner; } ``` If we saved this file as `index.ts`, we can run it with: ```bash npx tsx index.ts ```