Verona 백서

Verona

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 54쪽 중 22쪽

tract-development-environment-on-windows-wsl2-+-ubuntu">Setting up Smart Contract Development on Windows (WSL2 + Ubuntu)</a></td></tr><tr><td>Integrated Development d Environment(IDE)</td><td><a href="/en/build-on-verona/computation/local-development/setting-up-env/setup-cosmwasm-ide">Set Up an Integrated Development Environment (IDE)</a></td></tr></tbody></table> # Setting up your Local Smart Contract Development Environment A properly configured local development environment is essential for building and testing smart contracts on the Verona network. This guide covers the necessary tools, dependencies, and configurations needed to get started. The following tools will be installed: * [**Rust & Cargo**](#rust) – The programming language and package manager used for writing and compiling smart contracts. * [**cargo-generate**](#cargo-generate) – A tool for quickly setting up new Rust projects from templates. * [**Go**](#go) – Required for interacting with blockchain tooling and dependencies. * [**Docker**](#docker) – Used for optimizing Rust smart contracts via the Rust Optimizer. * [**xiond**](#xiond) – The Verona network daemon for running a local node, deploying smart contracts, and interacting with the blockchain. Each section provides step-by-step installation instructions for macOS, Debian-based Linux, Red Hat-based Linux and Arch Linux. Once these dependencies are installed, you will have everything needed to start developing on Verona. ## **Prerequisites** * A Unix-like operating system (Linux, macOS, or Windows Subsystem for Linux). If you're using Windows, refer to this [guide](https://learn.microsoft.com/en-us/windows/wsl/install) for installing Windows Subsystem for Linux (WSL). ## **Rust** [Rust](https://www.rust-lang.org/) is the programming language for developing smart contracts on the Verona network. Known for its performance, security, and memory safety, Rust is well-suited for blockchain development. To build, test, and deploy smart contracts, developers need a properly configured Rust toolchain. The recommended way to install Rust is through [**rustup**](https://rustup.rs/), the official Rust toolchain installer. {% tabs %} {% tab title="macOS" %} Install Rust using Homebrew: `brew install rustup` `rustup-init` Follow the on-screen instructions, then restart your terminal or run: `source $HOME/.cargo/env` {% endtab %} {% tab title="Debian-based Linux" %} Install required dependencies: `sudo apt update && sudo apt install -y curl build-essential` Then install Rust using rustup: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` Follow the setup instructions and restart your terminal or run: `source $HOME/.cargo/env` {% endtab %} {% tab title="Red Hat-based Linux" %} Install required dependencies: `sudo dnf install -y curl gcc-c++ make` Then install Rust: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` Follow the setup instructions and restart your terminal or run: `source $HOME/.cargo/env` {% endtab %} {% tab title="Arch Linux" %} Install Rust using Pacman: `sudo pacman -S rustup` Then initialize Rust: `rustup default stable` {% endtab %} {% endtabs %} ### **Verifying Installation** After installation, verify **Rust** is correctly installed: ``` rustc --version ``` You should see output similar to the following (your exact version may differ): ``` rustc 1.86.0 ``` Your global Rust install does not need to match **1.86** exactly, but each **contract repo** should pin **1.86** for WASM builds that upload to Verona (see below). ### Pin the Rust toolchain for Verona Network {% hint style="warning" %} WASM built with the **latest stable Rust** may fail to upload to Verona because the chain does not support WebAssembly **bulk memory**. If `xiond tx wasm store` or validation fails after a Rust upgrade, create `rust-toolchain.toml` at your **contract project root** (not only in your global Rust install): {% endhint %} ```toml [toolchain] channel = "1.86" targets = ["wasm32-unknown-unknown"] ``` **Why 1.86?** Rust **1.87+** may enable bulk memory for `wasm32-unknown-unknown`, which the Verona network rejects today. **1.86** is the latest stable release known to produce upload-compatible WASM for Verona at the time of writing (May 2026). Re-test uploads and update this pin when you upgrade Rust or when Verona adds bulk memory support. Commit this file with your contract repo so CI and teammates use the same toolchain, then rebuild before deploying. ## Cargo Cargo is Rust's package manager and build system, essential for compiling and managing dependencies in Verona smart contract development. When installing Rust using **rustup** which we did earlier, Cargo is automatically included. However, if Cargo is missing or needs to be installed separately, follow the steps below. ### **Check if Cargo is Installed** Run the following command to check if Cargo is already installed: ``` cargo --version ``` If Cargo is installed, you should see an output similar to (your exact version may differ): ``` cargo 1.86.0 ``` If Cargo is missing, follow the installation steps below. {% tabs %} {% tab title="macOS" %} If Rust is installed via **rustup**, install Cargo with: `rustup component add cargo` {% endtab %} {% tab title="Debian-based Linux" %} `sudo apt update && sudo apt install -y cargo` {% endtab %} {% tab title="Red Hat-based Linux" %} `sudo dnf install -y cargo` {% endtab %} {% tab title="Arch Linux" %} `sudo pacman -S cargo` {% endtab %} {% endtabs %} ## **Cargo Generate** **cargo-generate** is a Rust tool that simplifies the creation of new Rust projects from pre-existing templates. It is particularly useful for setting up smart contract projects on Verona by automating the scaffolding process. Execute the following command to install **cargo-generate**: ``` cargo install cargo-generate ``` ### **Verifying Installation** After installation, confirm that `cargo-generate` is working correctly: ``` cargo generate --version ``` If cargo-generate is installed, you should see an output similar to: ``` cargo generate-generate 0.17.3 ``` ## **Go** **Go** is required for certain blockchain development tasks, including working with Verona’s tooling and dependencies for example `xiond`. Follow the installation steps below for your operating system: {% tabs %} {% tab title="macOS" %} `brew install go` {% endtab %} {% tab title="Debian-based Linux" %} `sudo apt update && sudo apt install -y golang` {% endtab %} {% tab title="Red Hat-based Linux" %} `sudo dnf install -y golang` {% endtab %} {% tab title="Arch Linux" %} `sudo pacman -S go` {% endtab %} {% endtabs %} Alternatively, download and install Go manually from the [official website](https://go.dev/doc/install). ### **Verifying Installation** After installation, verify that Go is correctly installed: ``` go version ``` If **go** is installed, you should see an output similar to: ``` go version go1.22.3 darwin/arm64 ``` To ensure **Go** modules work correctly, set up the Go environment: ``` echo 'export GOPATH=$HOME/go' >> ~/.bashrc echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc source ~/.bashrc ``` If you are using a different shell, replace `~/.bashrc` with the corresponding configuration file for your shell. For example, if you're using **Zsh**, replace `~/.bashrc` with `~/.zshrc`. After setting up your environment, restart your terminal to apply the changes. ## Docker Docker is required for optimizing Rust smart contracts using the [**Rust Optimizer**](https://github.com/CosmWasm/optimizer), which ensures that contracts are compiled efficiently for deployment on **Verona**. It can also be used to run `xiond`. You can install Docker for your operating system [here](https://docs.docker.com/get-docker/). {% hint style="warning" %} For Linux users, it's recommended to run the Docker daemon in [**Rootless Mode**](https://docs.docker.com/engine/security/rootless/)**.** {% endhint %} ## xiond `xiond` is the core command-line tool for running and interacting with the **Verona network**. It serves as the blockchain daemon, enabling developers and node operators to manage network operations, deploy smart contracts, and interact with the Verona ecosystem. To install `xiond`, you can either use an [**installer**](#installers), download a [**pre-built binary**](#use-pre-built-binary)**,** [**build it from source**](#build-from-source) or utilize a [**docker**](#run-xiond-with-docker) build. Ensure that you use the release corresponding to the version of `xiond` being used on the network where you will be interacting with. ### Installers We recommend installing xiond with one of the following installers for your respective operating system: {% tabs %} {% tab title="macOS" %} Tap the burnt-labs/xion repository ```bash brew tap burnt-labs/xion ``` Install xiond ```bash brew install xiond ``` Verify Installation ```bash xiond version ``` {% endtab %} {% tab title="Debian-based Linux" %} Download the repository key ```bash wget -qO - https://packages.burnt.com/apt/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/burnt-keyring.gpg ``` Add the burnt repository to your apt sources list, include the signing key ```bash echo "deb [signed-by=/usr/share/keyrings/burnt-keyring.gpg] http://packages.burnt.com/apt /" | sudo tee /etc/apt/sources.list.d/burnt.list ``` Update sources, and install xiond ```bash sudo apt update sudo apt install xiond ``` Verify Installation ```bash xiond version ``` {% endtab %} {% tab title="Red Hat-based Linux" %} Import the burnt repository key ```bash sudo rpm --import https://packages.burnt.com/yum/gpg.key ``` Add the burnt repository to your repos list ```bash printf "[burnt]\nname=Burnt Repo\nenabled=1\nbaseurl=https://packages.burnt.com/yum/\n" | sudo tee /etc/yum.repos.d/burnt.repo ``` Install xiond ```bash sudo dnf install xiond ``` Verify Installation ```bash xiond version ``` {% endtab %} {% tab title="Alpine Linux" %} Download the repository key ```bash wget -qO - https://alpine.fury.io/burnt/burnt@fury.io-b8abd990.rsa.pub | sudo tee /etc/apk/keys/burnt@fury.io-b8abd990.rsa.pub ``` Add the burnt repository to your repository list, include the signing key ```bash echo "https://alpine.fury.io/burnt" | sudo tee -a /etc/apk/repositories ``` Update sources, and install xiond ```bash sudo apk update sudo apk add xiond ``` Verify Installation ```bash xiond version ``` {% endtab %} {% endtabs %} ### **Use Pre-built Binary** You will need to download the appropriate binary for your system architecture <https://github.com/burnt-labs/xion/releases/tag/v18.0.0>: {% tabs %} {% tab title="Linux" %} Download the linux binary. For **x86\_64 architecture** it would be: ```sh wget https://github.com/burnt-labs/xion/releases/download/v18.0.0/xiond_18.0.0_linux_amd64.tgz ``` For **ARM64 architecture**: ```sh wget https://github.com/burnt-labs/xion/releases/download/v18.0.0/xiond_18.0.0_linux_arm64.tgz ``` **Verify the Integrity of the Binary** Generate the SHA256 hash of the downloaded file: ```sh sha256sum <downloaded_file_name> ``` {% endtab %} {% tab title="macOS" %} Download the binary. For **x86\_64 architecture** it would be: ```sh wget https://github.com/burnt-labs/xion/releases/download/v18.0.0/xiond_18.0.0_darwin_amd64.tgz ``` For **ARM64 architecture**: ```sh wget https://github.com/burnt-labs/xion/releases/download/v18.0.0/xiond_18.0.0_darwin_arm64.tgz ``` **Verify the Integrity of the Binary** Generate the SHA256 hash of the downloaded file: ```sh sha256sum <name-of-file> ``` {% endtab %} {% endtabs %} The `sha256sum` command should generate a hash string (e.g., `d41d8cd98f00b204e9800998ecf8427e`). Download the official checksum file: ```sh wget https://github.com/burnt-labs/xion/releases/download/v18.0.0/xiond-18.0.0-checksums.txt ``` Compare the two hash strings to ensure they match. This confirms that the downloaded file is authentic and unaltered. #### Extract the Binary Extract the `.tgz` file: ```shell tar -xvzf <downloaded_file_name> ``` #### **Add Executable Permissions** Make the binary executable: ```sh chmod +x <binary_file_name> ``` #### **Move the Binary to a System Directory** Move the binary to a directory in your `PATH` (e.g., `/usr/local/bin`) and rename it to `xiond`: ```sh sudo mv <binary_file_name> /usr/local/bin/xiond ``` After this, `xiond` should be available for use. *** ### Run xiond with Docker Instead of installing `xiond` manually, you can run it using Docker. #### **Download the Image from Docker Hub** We publish Docker images to Docker Hub on every commit to the `main` branch. The images are tagged with their respective Git SHA. ``` docker pull burntnetwork/xion:latest ``` For the latest available tags, check out the [Docker Hub](https://hub.docker.com/r/burntnetwork/xion) page for this image. #### **Obtain a Shell in the Docker Container** Once the image is pulled, you can invoke the `xiond` binary inside a Docker container: ``` docker run -ti burntnetwork/xion:latest /bin/bash ``` From within the container, you can interact with `xiond`: ``` xiond version xiond version --long xiond --help ``` Using Docker ensures a clean and isolated environment for running `xiond`, eliminating the need for manual installation and dependency management. #### Optional: Persist Keys and Configuration By default, any keys or configuration you create inside a Docker container will be lost once the container is closed. If you want to **persist account data and configuration** across container sessions, you can mount a local volume. First create a dedicated directory on your host: ``` mkdir -p $HOME/.xion_docker ``` Then run the following command to start the `xiond` container session: ```bash docker run -ti \ -v $HOME/xiond_data:/root/.xiond \ burntnetwork/xion:latest /bin/bash ``` This mounts your host's `$HOME/xiond_data` directory to the location inside the container where `xiond` stores its data (`/root/.xiond`). Any accounts or configurations created inside the container will now persist even after the container is stopped or removed. To verify persistence: 1. Run the container and create a key: ```bash xiond keys add myaccount ``` 2. Exit the container and re-run it with the same volume: ```bash docker run -ti -v $HOME/xiond_data:/root/.xiond burntnetwork/xion:latest /bin/bash xiond keys list ``` You should still see `myaccount` listed. *** ### **Build from Source** If downloading the pre-built binary or utilizing the installer is not an option, you can install `xiond` from source. Ensure that **Go**, **Git**, and **Make** are installed. #### **Clone the Repository and Build `xiond`** ```sh git clone https://github.com/burnt-labs/xion.git cd xion git checkout main make install ``` This will install the `xiond` binary to your `GOPATH`. #### **Verify Installation** You might need to restart your terminal. Check that `xiond` is properly installed: ```sh xiond version ``` If a version number is returned, `xiond` is now ready for use. # Setting up Smart Contract Development on Windows (WSL2 + Ubuntu) This guide walks you through setting up a local Verona developer environment on a Windows machine using **WSL2** with **Ubuntu**. This is the recommended setup for Windows users who want to work with `xiond`, build and interact with their CosmWasm smart contracts. ## Prerequisites 1. **Windows 10 or 11 (64-bit)** ## Install WSL2 with Ubuntu If you don’t have **WSL2** set up, execute the following command in **PowerShell**: ```powershell wsl --install ``` The `--install` comand performs the following actions: * Set WSL2 as the default * Downloads and installs the default Ubuntu Linux distribution. You will need to restart your machine during the installation process. If you want to install a different Linux distribution or another version of Ubuntu, first run the following command to view the list of available distributions: ```powershell wsl --list --online ``` To change the distribution installed, enter: ```powershell wsl --install -d <Distribution Name> ``` Replace `<Distribution Name>` with the name of the distribution you would like to install. {% hint style="info" %} This guide assumes that you have Ubuntu installed as your Linux distribution. {% endhint %} Check to make sure WSL2 is set as default: ```powershell wsl --status ``` This should display the following "**Default Version: 2**". > If you're already using WSL1, you can upgrade to WSL2 using the following: ```powershell wsl --set-version Ubuntu 2 ``` You can list your installed Linux distributions and check the version of WSL each is set to by entering the command: ```powershell wsl -l -v ``` ## Set up your Linux username and password <a href="#set-up-your-linux-username-and-password" id="set-up-your-linux-username-and-password"></a> Click the Windows **start menu** button and in the search field enter "**Ubuntu**". <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FAsRLdDnzWkH81w0h22Zy%2FScreenshot%202025-05-01%20145216.png?alt=media&amp;token=dcd964bb-2692-40db-902e-e3dad0ab95c1" alt=""><figcaption></figcaption></figure> Click the **Ubuntu app** to open the distribution and in the terminal that's loaded you will be asked to create a **User Name** and **Password** for the Linux distribution. This **User Name** and **Password** is specific to each separate Linux distribution that you install and has no bearing on your Windows user name. <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FrZxuLLkztG2HCnpSD1F4%2Fimage.png?alt=media&amp;token=b9c08115-9d8e-40ed-b321-3b0ec9b8a061" alt=""><figcaption></figcaption></figure> ## Update and upgrade packages <a href="#update-and-upgrade-packages" id="update-and-upgrade-packages"></a> In the Ubuntu terminal use the following command to update the Ubuntu distribution to reduce the chance of a package not working: ```bash sudo apt update && sudo apt upgrade ``` ### Install Build Essentials and Development Tools ```bash sudo apt install -y build-essential pkg-config libssl-dev curl git jq unzip wget ``` ## Install Docker (for CosmWasm Optimizer) Follow [Docker's official instructions for WSL2](https://docs.docker.com/desktop/windows/wsl/) or install Docker Desktop and enable **WSL2 backend**. The general steps include: 1. Download and install the latest version of [Docker Desktop for Windows](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe). 2. Follow the usual installation instructions to install Docker Desktop. Depending on which version of Windows you are using, Docker Desktop may prompt you to turn on WSL 2 during installation. Read the information displayed on the screen and turn on the WSL 2 feature to continue. <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FYIP6ohfxnbltBtf0ANvJ%2FScreenshot%202025-05-01%20155509.png?alt=media&amp;token=a740c310-a6f4-4829-8c44-6d61dc068d37" alt=""><figcaption></figcaption></figure> 3. Start Docker Desktop from the **Windows Start** menu. 4. Navigate to **Settings**. 5. From the **General** tab, select **Use WSL 2 based engine**.. If you have installed Docker Desktop on a system that supports WSL 2, this option is turned on by default. 6. Select **Apply & Restart**. Once installed, make sure docker is running. You can verify that docker is installed and accessible via the **Ubuntu** distribution by executing: ```bash docker --version ``` ## Setting up Visual Studio Code <a href="#use-visual-studio-code" id="use-visual-studio-code"></a> Follow this step-by-step guide to [Get started using Visual Studio Code with WSL](https://learn.microsoft.com/en-us/wind
프로젝트로 돌아가기