---
description: Example bridging from Ethereum to Algorand
---

# Ethereum -> Algorand

### Code Flow

<figure><img src="https://1682556920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXi05eRCaKu25tAkbP7nQ%2Fuploads%2FpqdA2BRw7XXkGioD2ku3%2Feth.drawio.png?alt=media&#x26;token=c6aa6a2c-7a5a-41a2-85e1-ddfb137a483f" alt=""><figcaption></figcaption></figure>

### Steps

1. getAllowanceEth()
2. approveEth()
3. transferFromEth()
4. getEmitterAddressEth()
5. parseSequenceFromLogEth()
6. getSignedVAA()
7. redeemOnAlgorand()

### 1. getAllowanceEth()

```javascript
const allowance: ethers.BigNumber = await getAllowanceEth("0xf72a04B891bA46819D83c75687d31f22f6d646c1","0xbF0482884043B7ea1eB55516770C217C77CC7A48",signer);
```

### 2. approveEth()

```javascript
await approveEth(
      "0xf72a04B891bA46819D83c75687d31f22f6d646c1",
      "0xbF0482884043B7ea1eB55516770C217C77CC7A48",
      signer, // Wallet from ethers js
      AMOUNT_TO_TRANSFER
    );
```

### 3. transferFromEth()

```javascript
const receipt: ethers.ContractReceipt = await transferFromEth(
      "0xf72a04B891bA46819D83c75687d31f22f6d646c1",
      signer, // Wallet from ethers js
      ethAsset,
      BigInt(1000000), // AMOUNT_TO_TRANSFER * (10 ^ ASSET_DECIMALS)
      CHAIN_ID_ALGORAND,
      algosdk.decodeAddress(wallet.addr).publicKey,
      "WORMHOLE"
  );
```

### 4. getEmitterAddressEth()

```javascript
const emitterAddr = getEmitterAddressEth("0xf72a04B891bA46819D83c75687d31f22f6d646c1");
```

### 5. parseSequenceFromLogEth()

```javascript
const sequence: string = parseSequenceFromLogEth(receipt, "0xE4DF23D087ef706a536527a41bef769a43656C91");
```

### 6. getSignedVAA()

```javascript
const signedVAA = await getSignedVAA(GUARDIAN_GRPC, emitterAddr, 'CHAIN_ID_ETHEREUM', sequence, 1000, 20)
```

### 7. redeemOnAlgorand()

```javascript
const redeemTxs = await redeemOnAlgorand(
      client, // Algodv2 from algosdk
      BigInt(114976173),
      BigInt(114976156),
      vaaBytes, // parsed signed vaa
      SENDER_ADDRESS
    );
```
