Verona 백서

Verona

원문

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

ain**, not a backend. ### Misconception #2: "I’ll store user data in a database like MySQL or Firebase" Databases are standard in Web2 for storing everything from user profiles to app data. In Web3, data stored off-chain is not **trustless**, **transparent**, or **verifiable**. #### The Web3 mindset: * Use smart contract **on-chain storage** for important, verifiable state. * If off-chain data is needed (e.g. large files), consider decentralized solutions like **IPFS**, **Arweave**, or **Jackal**. * Indexing services like **SubQuery** or **Numia** can help you efficiently read blockchain data. {% hint style="info" %} Only use off-chain databases when the data is not critical to contract logic or on-chain interactions or you need do do complex data agregation. {% endhint %} ### Misconception #3: "Users should register with email and password" Web3 applications rely on **wallets**, not usernames and passwords. Wallets represent a user's identity, and every action is verified using cryptographic signatures and therefore there's no need to manage credentials. #### The Web3 mindset: * **Wallets = Identity**. A user’s address is their identity. * Authentication is done through **message signing**. * **Verona simplifies this even further**: With the `abstraxion` library, developers can create a smooth, OAuth2-style login and registration experience directly in the frontend. Behind the scenes, every user that authenticates via Abstraxion is issued a Meta Account, a smart contract account on Verona that abstracts away private key management that is linked to their authenticator of choice which includes: * **Email** * **Social login** (e.g., Google) * **External wallets** (e.g., Keplr, MetaMask) * **Passkey support** for biometric authentication (e.g., Face ID, fingerprint) ### Misconception #4: "I’ll create an API layer between the frontend and the blockchain" This introduces unnecessary centralization. If your frontend talks to a custom backend that relays messages to the blockchain, you reintroduce a point of failure. #### The Web3 mindset: * Interact with smart contracts directly from the frontend using `xion.js` or `cosmjs` communicating with the blockchain through RPC, gRPC, REST APIs, or WebSockets via connected network nodes. * If needed, rely on indexers, to expose aggregated and filtered data which is usually just used for displaying data on the frontend. ### Misconception #5: "I can update my backend logic anytime" Smart contracts are **immutable by default** once deployed. You can't just push a quick update like you would on a backend server. #### The Web3 mindset: * Treat every deployment as a **versioned release**. * Design your contracts to support **migrations** which also requires setting an **admin** for each instantiated contract. * Implement upgradability only when necessary using patterns like contract proxies or admin-controlled updates (with care). # Recommended Architecture for Apps Building apps on Verona opens the door to a decentralized and user-friendly development model, but to fully take advantage of it, you need to rethink how your app is structured. This guide outlines a **recommended architecture** for developing scalable, secure, and gasless apps on Verona using smart contracts, modern frontend tools, and built-in wallet functionality. ## Architectural Overview <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FHUiReklaZaBcbTeTxuF9%2FRecommended-Architecture-for-Dapps-on-XION-flow-chart.png?alt=media&amp;token=5e077ca5-0a1c-4d0f-9e53-d6a82be484c3" alt=""><figcaption></figcaption></figure> At a high level, a typical Verona app consists of the following components: * **Frontend**: A browser-based or mobile user interface that connects directly to the blockchain. * **Wallet Layer**: Wallets are generated and managed on the frontend using the `abstraxion` library. * **Smart Contracts**: Core business logic written in Rust using the CosmWasm framework and deployed to the Verona network. * **Optional Indexer**: An off-chain service (e.g. SubQuery) that provides advanced filtering, aggregation, and data access from the blockchain for frontend consumption. * **Optional Storage Layer**: For storing large or private files, decentralized storage solutions like IPFS or Jackal can be integrated. ## Key Components Explained ### **Frontend (React/Vue + xion.js)** * Built using modern JavaScript frameworks like **React** or **Vue**, the frontend serves as the primary interface for users to interact with your app. * Wallet creation, login, and transaction signing are handled via **`abstraxion`**, a sub-package of `xion.js`, which eliminates the need for external wallets or browser extensions. * User onboarding is seamless, you can programmatically set up a **fee grant** via Verona **Treasury Contracts**, allowing your app to cover the gas costs for users. * Verona’s treasury contracts go even further by enabling a **Web2-style authorization model**. Users can approve a Grantz (similar to OAuth2 scopes), authorizing your frontend to send signed transactions on their behalf, no wallet popups required. * The frontend communicates **directly with deployed smart contracts and the Verona network** via RPC, gRPC, REST APIs, or WebSockets using `xion.js`. * Since your frontend is entirely static, it can be deployed to platforms like **Vercel**, **Netlify**, or any CDN. The full app loads in the user's browser, there's no need for server-side rendering or backend infrastructure. ### **Smart Contracts (CosmWasm in Rust)** * All core business logic is implemented as **CosmWasm smart contracts**, written in **Rust** and deployed to the Verona network. * Contracts store critical application state using a key-value data model, secured and managed on-chain. * Common use cases include: * Managing token balances * Storing profile metadata * Handling voting, staking, or other custom logic {% hint style="info" %} Smart contracts are deterministic, upgradeable (via migrations), and auditable, forming the trusted core of your app. {% endhint %} ### **Optional Indexer (SubQuery, Numia indexer)** * For apps that require **complex queries, analytics, filtering, or historical lookups**, an indexer is essential. * Tools like **SubQuery** or **Numia** parse blockchain data and expose it via **GraphQL** or **REST APIs**, making it easy to power advanced frontend views without querying the chain directly. * Improves performance, scalability, and responsiveness of your UI. ### **Optional Storage Layer (IPFS / Jackal)** * On-chain storage is expensive and limited, use decentralized storage networks like **IPFS** or **Jackal** to store: * Large files (images, PDFs) * Encrypted or private user content * NFT metadata and media * Smart contracts can reference these assets via **content hashes**, ensuring verifiability while offloading heavy data. # Run a Node Operate a node on the **Verona** network (`xiond`). Chain IDs such as `xion-testnet-2` are unchanged under the Verona rebrand. ## Section Content <table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>System Specifications</strong></td><td></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/system-config">System Specifications</a></td></tr><tr><td><strong>Build the Daemon</strong></td><td></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/build-the-daemon">Build the Daemon</a></td></tr><tr><td><strong>Download the Daemon</strong></td><td></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/download-the-daemon">Download the Daemon</a></td></tr><tr><td><strong>Configure the Daemon</strong></td><td></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/configure-the-daemon">Configure the Daemon</a></td></tr><tr><td><strong>Join the Network</strong></td><td></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/join-the-network">Join the Network</a></td></tr><tr><td></td><td></td><td></td><td></td></tr></tbody></table> # System Specifications Recommended system specs {% hint style="info" %} 🐧 **Recommended operating systems** We've tested our technology on several Linux distributions. If you're considering running another OS, your mileage may vary, and we'll be unable to assist you to get up and running. {% endhint %} ## Hardware Requirements The minimum recommended specs for running an instance of `xiond` on the Burnt Networks are: | Network | CPU cores | RAM | Disk (SSD) | Bandwidth | | ---------------- | ----------------- | ----- | ---------- | ---------- | | `xion-testnet-2` | 8 (gen-purpose) | 32 GB | 128 GB | \~120 Mbps | | `xion-mainnet-1` | 8 (compute-optim) | 32 GB | 256 GB | \~120 Mbps | {% hint style="info" %} :warning: **Monitor your system** As the network grows, the minimum hardware requirements will also grow. It is recommended that you monitor your system so you can prevent it from running out of resources. {% endhint %} ## Commonly used ports The Verona daemon uses the following TCP ports. Please adapt their settings to match your needs. In most cases, node operators only need to open the following port: * `26656`: The default port for the P2P protocol. * This port is used to communicate with other nodes and must be open to join a network. However, it does not have to be open to the public. For validator nodes, configuring `persistent_peers` and closing this port to the public are recommended. Additional ports: * `1317`: The default port for the Lite Client Daemon (LCD). * The LCD provides a RESTful API to allow applications and services to interact with your instance. In the default configuration, it is disabled. * `26657`: The default port for the Tendermint RPC protocol. * Because this port is used for querying and sending transactions, it must be open for serving queries. In the default configuration it is listening on `127.0.0.1`. * `26660`: The default port for interacting with the [Prometheus](https://prometheus.io) database * This port can be used to monitor the node itself, and gather information about the network. In the default configuration, it is disabled. {% hint style="info" %} :warning: **Caution** Do not open ports `1317` and / or `26657` to the public unless you explicitly plan to run a publicly-accessible node. {% endhint %} # Build the Daemon How to build the xiond binary If you want to build the `xiond` binary yourself, this section will show you how. {% hint style="info" %} :warning: **Development environment** The Verona daemon is written using [the Go programming language](https://go.dev/). This guide assumes you have a pre-existing installation on your workstation. Adequate installation and configuration of your environment is out of scope. Please refer to [the appropriate documentation](https://go.dev/doc/install) for assistance. {% endhint %} {% hint style="info" %} :warning: **Go Versions** We use Go version 1.22 internally at Burnt. If you are building the binary yourself, please make sure you are using Go 1.22, as we have observed consensus-breaking behavior on nodes that are not running the same version as the majority of the network.\ A specific symptom of this would be an `AppHash` mismatch. {% endhint %} ## Fetch the Source Code * Use `git` to retrieve the [Verona](https://github.com/burnt-labs/xion) repository, whose default branch contains the latest and greatest code. ``` $ git clone https://github.com/burnt-labs/xion.git ``` * If you want a specific stable version, refer to [the Releases page](https://github.com/burnt-labs/burnt/releases). ``` $ git clone https://github.com/burnt-labs/xion.git -b vX.Y.Z ``` ## Build the Binary {% hint style="info" %} If using Windows the following must be run using WSL (Windows Subsystem for Linux) {% endhint %} ```bash # If on windows run the following sudo apt update && sudo apt install coreutils # check if make is already installed make --version # if it's not installed run sudo apt install make ``` * We provide a `Makefile` with several targets common to projects in the Cosmos ecosystem. ``` $ cd xion $ make install ``` ## Verify that the Binary was installed * Assuming everything went well, the binary is now available in your `$PATH` ``` $ xiond version $ xiond version --long $ xiond --help ``` # Download the Daemon How to download pre-built versions of the xiond binary We provide pre-built versions of the `xiond` binary. This section shows how to avail yourself of these versions, should you prefer. {% hint style="info" %} :warning: **Development environment** We use [Docker](https://www.docker.com/) and [Kubernetes](https://kubernetes.io/) internally at Burnt Labs. This guide assumes that you are familiar with these technologies, and have a pre-existing installation on your workstation. Adequate installation and configuration of your environment is out of scope. Please refer to the [appropriate](https://docs.docker.com/get-docker/) [documentation](https://kind.sigs.k8s.io/docs/user/quick-start/) for assistance. {% endhint %} ## Download the image from Docker Hub * We publish Docker images to Docker Hub on every commit to `main`. * The image versions are tagged with the short Git SHA. * We do not use the `latest` tag, to avoid confusion and mistakes. ``` $ docker pull burntnetwork/xion:latest ``` {% hint style="info" %} For more up to date tags checkout the docker hub page for this image [here](https://hub.docker.com/r/burntnetwork/xion). The most current generally is the release marked "latest" [here](https://github.com/burnt-labs/xion/releases/latest). {% endhint %} ## Obtain a shell in the Docker container * We can now invoke the `xiond` binary inside the container. ``` $ docker run -ti burntnetwork/xion:latest /bin/bash # xiond version # xiond version --long # xiond --help ``` # Configure the Daemon How to initialize and configure the xiond binary As an application-specific blockchain using the Cosmos SDK, we benefit from its extensive configuration options. {% hint style="info" %} :warning: **Custom Configuration** The configuration in this guide is provided as-is, with no guarantee of any kind. You are highly encouraged to tweak the Cosmos SDK configuration values to accommodate your specific environment and use case. The [Cosmos SDK documentation](https://docs.cosmos.network/v0.47) is a good place to start exploring the different options. {% endhint %} ## Initialize the Verona daemon * As is the case for most Cosmos-based chains, the daemon is initialized like so: ``` $ xiond init my-awesome-moniker \ --chain-id xion-testnet-2 \ --home /tmp/node ``` ## Refer to the config directory * The `xiond init` command will output this structure to the specified `--home:` ``` . # /tmp/node |- data # Contains the databases used by the node. |- config/ |- app.toml # Application-related configuration file. |- config.toml # Tendermint-related configuration file. |- genesis.json # The genesis file. |- node_key.json # Private key to use for node authentication in the p2p protocol. |- priv_validator_key.json # Private key to use as a validator in the consensus protocol. ``` {% hint style="info" %} :warning: **Node Keys** Take note of the `node_key.json` and `priv_validator_key.json`files. The combination of these two private keys serves to uniquely identify your node on the Verona network. If the purpose of your node is ephemeral, such that it can be discarded with no adverse effects, then these files can be discarded and regenerated at will. However, if the purpose of your node is persistent, such as running a Validator, then protecting and preserving these files becomes paramount. {% endhint %} <table data-view="cards"><thead><tr><th></th><th align="center"></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td align="center"><code>app.toml</code></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/configure-the-daemon/app.toml">app.toml</a></td></tr><tr><td></td><td align="center"><code>client.toml</code></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/configure-the-daemon/client.toml">client.toml</a></td></tr><tr><td></td><td align="center"><code>config.toml</code></td><td></td><td><a href="/en/nodes-and-validators/run-a-node/configure-the-daemon/config.toml">config.toml</a></td></tr></tbody></table> # app.toml Sample app.toml file {% hint style="info" %} :warning: **Use at Your Own Risk** The configuration below is provided as-is, with no guarantee of any kind. Any mishaps or unfortunate events resulting from using this configuration are purely your responsibility. Specifically, all daemon subprocesses are disabled and serving on `localhost.` You definitely want to change that. {% endhint %} ``` # This is a TOML config file. # For more information, see https://github.com/toml-lang/toml ############################################################################### ### Base Configuration ### ############################################################################### # The minimum gas prices a validator is willing to accept for processing a # transaction. A transaction's fees must meet the minimum of any denomination # specified in this config (e.g. 0.25token1;0.0001token2). minimum-gas-prices = "0uxion" # default: the last 362880 states are kept, pruning at 10 block intervals # nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) # everything: 2 latest states will be kept; pruning at 10 block intervals. # custom: allow pruning options to be manually specified through 'pruning-keep-recent', and 'pruning-interval' pruning = "default" # These are applied if and only if the pruning strategy is custom. pruning-keep-recent = "0" pruning-interval = "0" # HaltHeight contains a non-zero block height at which a node will gracefully # halt and shutdown that can be used to assist upgrades and testing. # # Note: Commitment of state will be attempted on the corresponding block. halt-height = 0 # HaltTime contains a non-zero minimum block time (in Unix seconds) at which # a node will gracefully halt and shutdown that can be used to assist upgrades # and testing. # # Note: Commitment of state will be attempted on the corresponding block. halt-time = 0 # MinRetainBlocks defines the minimum block height offset from the current # block being committed, such that all blocks past this offset are pruned # from Tendermint. It is used as part of the process of determining the # ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates # that no blocks should be pruned. # # This configuration value is only responsible for pruning Tendermint blocks. # It has no bearing on application state pruning which is determined by the # "pruning-*" configurations. # # Note: Tendermint block pruning is dependant on this parameter in conunction # with the unbonding (safety threshold) period, state pruning and state sync # snapshot parameters to determine the correct minimum value of # ResponseCommit.RetainHeight. min-retain-blocks = 0 # InterBlockCache enables inter-block caching. inter-block-cache = true # IndexEvents defines the set of events in the form {eventType}.{attributeKey}, # which informs Tendermint what to index. If empty, all events will be indexed. # # Example: # ["message.sender", "message.recipient"] index-events = [] # IavlCacheSize set the size of the iavl tree cache (in number of nodes). iavl-cache-size = 781250 # IAVLDisableFastNode enables or disables the fast node feature of IAVL. # Default is false. iavl-disable-fastnode = false # IAVLLazyLoading enable/disable the lazy loading of iavl store. # Default is false. iavl-lazy-loading = false # AppDBBackend defines the database backend type t
프로젝트로 돌아가기