|
| 1 | +# GM world rollup: Deploying to Avail |
| 2 | + |
| 3 | +## 🌞 Introduction {#introduction} |
| 4 | + |
| 5 | +Avail DA offers scalable data availability that underpins the Avail ecosystem and ensures instantaneous and reliable data integrity, enabling rollups to grow, through the use of cutting-edge zero knowledge and KZG Polynomial commitments. |
| 6 | + |
| 7 | +This tutorial serves as a comprehensive guide for deploying your GM world rollup on Avail's data availability (DA) network. |
| 8 | + |
| 9 | +Before proceeding, ensure that you have completed the [GM world rollup](/tutorials/gm-world) tutorial, which covers setting up a local sovereign gm-world rollup and connecting it to a local (mock) DA node. |
| 10 | + |
| 11 | +## 🪶 Running an Avail light node |
| 12 | + |
| 13 | +Before you can start your rollup node, you need to initiate, sync, and possibly fund a light node on Turing Testnet which is the test network of Avail |
| 14 | + |
| 15 | +- [Local development](https://github.com/rollkit/avail-da/blob/main/README.md) |
| 16 | +- [Turing Testnet](https://docs.availproject.org/docs/networks) |
| 17 | + |
| 18 | +### 🚀 Using Turing Testnet |
| 19 | + |
| 20 | +- To fund your wallet address for using Turing Testnet: get AVAIL tokens from [the faucet]((https://faucet.avail.tools/)) |
| 21 | +- Paste your mnemonic in the `identity.toml` file by creating a `identity.toml` with the following command: |
| 22 | +`touch identity.toml` |
| 23 | +Example: |
| 24 | + |
| 25 | +```bash |
| 26 | +avail_secret_uri = '<paste your mnemonic here>' |
| 27 | +``` |
| 28 | + |
| 29 | +Running just an Avail light node is enough for Turing testnet. Run the Avail light node using the following command |
| 30 | + |
| 31 | +```bash |
| 32 | +cargo run --release -- --network turing --app-id 1 --clean --identity identity.toml |
| 33 | +``` |
| 34 | + |
| 35 | +If you want to sync Avail light node with your desired block number, you can add the following config in your `config.yaml` file from [here]( https://github.com/availproject/avail-light/blob/main/config.yaml.template ) |
| 36 | + |
| 37 | +```bash |
| 38 | +http_server_host = '127.0.0.1' |
| 39 | +http_server_port = 8000 |
| 40 | +port = 38000 |
| 41 | +sync_start_block = 322264 |
| 42 | +``` |
| 43 | + |
| 44 | +After successfully starting a light node, it's time to start posting the batches of blocks of data that your rollup generates. |
| 45 | + |
| 46 | +## 🧹 Cleaning previous chain history |
| 47 | + |
| 48 | +From the [GM world rollup]( /tutorials/gm-world ) tutorial, you should already have the `gmd` binary and the `$HOME/.gm` directory. |
| 49 | + |
| 50 | +To clear old rollup data: |
| 51 | + |
| 52 | +```bash |
| 53 | +rm -r $(which gmd) && rm -rf $HOME/.gm |
| 54 | +``` |
| 55 | + |
| 56 | +## 🏗️ Building your rollup |
| 57 | + |
| 58 | +Now we need to rebuild our rollup by simply running the existing `init.sh` script: |
| 59 | + |
| 60 | +```bash |
| 61 | +cd $HOME/gm && bash init.sh |
| 62 | +``` |
| 63 | + |
| 64 | +This process creates a new `$HOME/.gm` directory and a new `gmd` binary. Next, we need to connect our rollup to the running Avail light node. |
| 65 | + |
| 66 | +## 🛠️ Configuring flags for DA |
| 67 | + |
| 68 | +Now we're prepared to initiate our rollup and establish a connection with the Avail light node. The `gmd start` command requires two DA configuration flags: |
| 69 | + |
| 70 | +- `--rollkit.da_start_height` |
| 71 | +- `--rollkit.da_address` |
| 72 | + |
| 73 | +Let's determine what to provide for each of them. |
| 74 | + |
| 75 | +First, let's query the DA Layer start height using an RPC endpoint provided by Avail Labs. For local, it would be - [https://localhost:8000/v1/latest_block]( https://localhost:8000/v1/latest_block ), and for Turing Testnet - [https://avail-turing-rpc.publicnode.com]( https://avail-turing-rpc.publicnode.com ) |
| 76 | + |
| 77 | +Here is an example for the local development (replace URL for Turing Testnet if needed): |
| 78 | + |
| 79 | +```bash |
| 80 | +DA_BLOCK_HEIGHT=$(curl https://localhost:8000/v1/latest_block | jq -r '.result.block.header.height') |
| 81 | +echo -e "\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n" |
| 82 | +``` |
| 83 | + |
| 84 | +You will see the output like this: |
| 85 | + |
| 86 | +```bash |
| 87 | + Your DA_BLOCK_HEIGHT is 35 |
| 88 | +``` |
| 89 | + |
| 90 | +## 🔥 Running your rollup connected to an avail light node |
| 91 | + |
| 92 | +Now let's run our rollup node with all DA flags: |
| 93 | + |
| 94 | +```bash |
| 95 | + gmd start \ |
| 96 | + --rollkit.aggregator \ |
| 97 | + --rollkit.da_address="grpc://localhost:3000" \ |
| 98 | + --rollkit.da_start_height $DA_BLOCK_HEIGHT \ |
| 99 | + --minimum-gas-prices="0.1stake" |
| 100 | +``` |
| 101 | + |
| 102 | +Now, the rollup is running and posting blocks (aggregated in batches) to Avail. You can view your rollup by finding your account on [Turing testnet]( https://avail-turing.subscan.io/ ) |
| 103 | + |
| 104 | +::: info |
| 105 | +For details on configuring gas prices specifically for the DA network, see our [DA Network Gas Price Guide](/guides/gas-price). This is separate from the `--minimum-gas-prices="0.025stake"` setting, which is used for rollup network operations. |
| 106 | +::: |
| 107 | + |
| 108 | +## 🎉 Next steps |
| 109 | + |
| 110 | +Congratulations! You've built a local rollup that posts to Avail's testnets as well as locally. Well done! Now, go forth and build something great! Good luck! |
0 commit comments