# Step by step guide to build your rollapp using dymention stack and Avail as DA This comprehensive guide walks you through the process of setting up and running a Dymension RollApp with Avail as the Data Availability (DA) layer. By following these instructions, you'll be able to create, configure, and operate your own modular blockchain that leverages Avail's data availability solutions. ## Prerequisites Before you begin, ensure you have: - **Avail Node Access** (choose one of the following): - **Local Development:** - Avail node running on `http://localhost:8000` - Follow the [official setup guide](https://github.com/rollkit/avail-da?tab=readme-ov-file#avail-light-installation-for-local-development-environment) for detailed installation instructions - Recommended for testing and development purposes - Note: Make sure to check the versions and checkout to the latest version while setting up Avail for local development. - **Testnet Environment:** - Access to Avail Goldberg testnet via `https://goldberg.avail.tools/api/v1/rpc` - Requires testnet tokens (available from the Avail Discord faucet) - Suitable for integration testing and pre-production validation - **Production Deployment:** - Access to Avail mainnet via `https://mainnet-rpc.avail.so/rpc:443` - Requires mainnet tokens - For production-ready applications with real economic value - **Development Environment**: - Go 1.23+ installed - Git installed on your system ## Installation > **Note**: This guide assumes you may already have a configured RollApp. If not, you can follow the [rollapp-evm documentation](https://github.com/dymensionxyz/rollapp-evm) to set up a Dymension-based RollApp locally before proceeding. First, clone the Roller repository from GitHub and build it: ```bash # Clone the repository git clone https://github.com/dymensionxyz/roller.git cd roller # Build the project make build # Verify the build ./build/roller version ``` For detailed local development instructions, refer to the [official documentation](https://github.com/dymensionxyz/roller?tab=readme-ov-file#local-development). ## Initializing Your RollApp Initialize a RollApp configuration with the following command: ```bash ./build/roller rollapp init ``` During the initialization process, you'll be guided through several important configuration choices: 1. **Select an environment**: ``` select the environment you want to initialize for [type to search]: > mock playground blumbus custom mainnet ``` - **mock**: Lightweight local testing environment - **playground**: Testing environment with connection to Dymension testnet - **blumbus**: Pre-configured environment for the Blumbus testnet - **custom**: Fully customizable environment - **mainnet**: Production environment connected to Dymension mainnet 2. **Provide a RollApp ID**: ``` provide a rollapp ID that you want to run the node for: ``` Enter a unique identifier for your RollApp (e.g., `rollappevm_1234-1`). This will be used as the base for your chain ID. **Note:** - **New RollApp Creation**: If you don't have an existing RollApp ID, follow the [rollapp-evm documentation](https://github.com/dymensionxyz/rollapp-evm) to create a new RollApp - **Local Environment Setup**: For local development, you must run a Dymension node alongside your RollApp by following the [Dymension setup guide](https://github.com/dymensionxyz/dymension) 3. **Sequencer key management**: ``` would you like to import an existing sequencer key? [y/N]: ``` - If you select `y`, you'll be prompted to provide an existing key. - If you select `N`, a new sequencer key will be generated for you. After successful completion, the system will display information similar to: ``` 💈 RollApp 'rollappevm_1234-1' configuration files have been successfully generated on your local machine. Congratulations! 🔑 Addresses hub_sequencer dym1ewuqxzgvtrj8qufyj7v3jgwlwgl3yl8wlfflty mammal reunion this exhibit brown take empower below bundle call enact original never hip scrub flip private track nominee mix camp brick aware arrange 💡 save this information and keep it safe avail 5CtEePy3hNApJodYoJw3XYp7zo3pe2vZKCJXo6dvZj2HukB7 💡 save this information and keep it safe ``` **Important**: Save this information securely as it includes your sequencer key and mnemonic. You'll need these credentials later and they're essential for the security of your RollApp. ## Configuring Avail as Data Availability Layer After initialization, you need to configure the Dymint settings to use Avail as the DA layer: 1. Open the Dymint configuration file: ```bash nano $HOME/.roller/rollapp/config/dymint.toml ``` 2. Update the DA configuration with your Avail details: ```toml da_config = "{\"seed\": \"bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice\", \"api_url\": \"http://localhost:8000\", \"app_id\": 1, \"tip\":0}" da_layer = "avail" ``` Adjust the following parameters according to your setup: - `seed`: Your Avail account seed phrase (keep this private and secure) - `api_url`: The URL of your Avail node: - Local: `http://localhost:8000` - Goldberg testnet: `https://goldberg.avail.tools/api/v1/rpc` - Mainnet: `https://mainnet-rpc.avail.so/rpc:443` - `app_id`: The application ID of Avail to post the data (this is a unique identifier for your application on the Avail network) - `tip`: Optional tip amount for prioritizing transactions (can usually remain 0) For a more robust configuration, you can add additional parameters: ```toml da_config = "{\"seed\": \"your-seed-phrase\", \"api_url\": \"http://localhost:8000\", \"app_id\": 1, \"tip\":0, \"batch_submit_max_size\": 1048576, \"batch_submit_interval\": \"60s\"}" ``` ## Setting Up Your RollApp Run the setup command to prepare the node configuration: ```bash ./build/roller rollapp setup ``` During the setup process, you'll need to make several important choices: 1. **Select the node type**: ``` select the node type you want to run [type to search]: > sequencer fullnode ``` - **sequencer**: Responsible for producing blocks and submitting them to DA - **fullnode**: Validates and relays blocks without producing them 2. **Follow the additional configuration prompts**: - **Bond amount**: Set the amount of tokens to bond for your sequencer - **Funding**: Ensure your sequencer address is funded with sufficient tokens - **RPC Endpoints**: Configure the endpoints for your RollApp's API services The setup process creates all necessary configuration files and prepares your node to run with Avail as the DA layer. ## Starting Your RollApp Once the setup is complete, start your RollApp: ```bash ./build/roller rollapp start ``` This command launches several components: 1. Your RollApp node (Cosmos SDK-based chain with EVM capabilities) 2. Sequencer process (if configured as a sequencer) 3. Dymint consensus module with Avail data availability connection You should see logs indicating successful block production and data submission to both Dymension and Avail. ## Monitoring and Troubleshooting ### Monitoring Your RollApp Keep track of your RollApp's operation with these commands: ```bash # Check the overall RollApp status ./build/roller rollapp status # Verify Avail connection curl -X POST -H "Content-Type: application/json" \ --data '{"jsonrpc":"2.0","method":"system_health","params":[],"id":1}' \ http://localhost:8000 ``` ### Common Issues and Solutions If you encounter problems: 1. **Node not starting**: - Check error logs of rollapp - Verify all dependencies are installed - Ensure ports aren't blocked by firewall 2. **Data availability issues**: - Confirm Avail node is running: `curl http://localhost:8000` - Verify seed phrase is correct in configuration - Check app_id is properly set 3. **Sequencer not producing blocks**: - Ensure sequencer account is funded - Verify sequencer key is correctly configured - Check connection to the settlement layer 4. **RPC connection failures**: - Verify endpoints are correctly configured - Check network connectivity - Ensure ports are open and accessible 5. **General recovery steps**: ```bash # Stop the RollApp ./build/roller rollapp stop # Clear state (if necessary) ./build/roller rollapp unsafe-reset-all # Restart the node ./build/roller rollapp start ``` ## Working with Your RollApp ### Interacting via JSON-RPC Your RollApp exposes Ethereum-compatible JSON-RPC endpoints (default: `http://localhost:8545`): ```bash # Query the latest block curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ -H "Content-Type: application/json" http://localhost:8545 # Get chain ID curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \ -H "Content-Type: application/json" http://localhost:8545 ``` ### Connecting with MetaMask 1. Open MetaMask and click "Add Network" 2. Configure the network: - **Network Name**: Your RollApp name (e.g., "My Avail RollApp") - **RPC URL**: http://localhost:8545 (or your custom endpoint) - **Chain ID**: The EVM chain ID configured for your RollApp - **Currency Symbol**: Custom token symbol (e.g., "AROLL") ## Advanced Configuration ### Customizing Block Parameters Edit `$HOME/.roller/rollapp/config/dymint.toml` to adjust: ```toml # Block time in milliseconds block_time = 5000 # Max block size max_bytes = 22020096 ``` ## Resources and Support - [Dymension Documentation](https://docs.dymension.xyz/) - [Roller GitHub Repository](https://github.com/dymensionxyz/roller) - [Avail Documentation](https://docs.availproject.org/) - [Dymension Discord](https://discord.gg/dymension) - Join the #technical-support channel - [Avail Discord](https://discord.gg/availproject) - For Avail-specific questions ---