Initia 백서

Initia

원문

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

n](#pagination) | | `pagination.offset` | query | integer | - | See [Pagination](#pagination) | | `pagination.limit` | query | integer | `100` | See [Pagination](#pagination) | | `pagination.count_total` | query | boolean | `true` | See [Pagination](#pagination) | | `pagination.reverse` | query | boolean | `true` | See [Pagination](#pagination) | ### Response **200 OK** Schema: `nft.CollectionsResponse` ## GET `/indexer/nft/v1/collections/by_name/{name}` Get NFT collections by name. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ------- | ----------------------------- | | `name` | path | string | - | Collection name | | `pagination.key` | query | string | - | See [Pagination](#pagination) | | `pagination.offset` | query | integer | - | See [Pagination](#pagination) | | `pagination.limit` | query | integer | `100` | See [Pagination](#pagination) | | `pagination.count_total` | query | boolean | `true` | See [Pagination](#pagination) | | `pagination.reverse` | query | boolean | `true` | See [Pagination](#pagination) | ### Response **200 OK** Schema: `nft.CollectionsResponse` ## GET `/indexer/nft/v1/collections/{collection_addr}` Get NFT collection by address. ### Parameters | Name | In | Type | Default | Description | | ----------------- | ---- | ------ | ------- | ------------------ | | `collection_addr` | path | string | - | Collection address | ### Response **200 OK** Schema: `nft.CollectionResponse` ## GET `/indexer/nft/v1/tokens/by_account/{account}` Get NFT tokens by account. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ---------- | ------------------------------------------------------ | | `account` | path | string | - | Account address | | `collection_addr` | query | string | - | Collection address to filter by (optional) | | `token_id` | query | string | - | Token ID to filter by (optional) | | `order_by` | query | string | `token_id` | Order by field. Available values: `token_id`, `height` | | `pagination.key` | query | string | - | See [Pagination](#pagination) | | `pagination.offset` | query | integer | - | See [Pagination](#pagination) | | `pagination.limit` | query | integer | `100` | See [Pagination](#pagination) | | `pagination.count_total` | query | boolean | `true` | See [Pagination](#pagination) | | `pagination.reverse` | query | boolean | `true` | See [Pagination](#pagination) | ### Response **200 OK** Schema: `nft.NftsResponse` Example response: ```json theme={null} { "tokens": [ { "collection_addr": "initia1collectionaddress", "collection_name": "Initia Badges", "collection_origin_name": "initia.badges", "object_addr": "initia1nftobject", "owner": "initia1owneraddress", "nft": { "token_id": "42", "uri": "ipfs://bafy.../metadata.json" }, "height": 123456, "timestamp": "2024-01-12T10:20:30Z" } ], "pagination": { "next_key": "AQID", "previous_key": "", "total": "1" } } ``` ## GET `/indexer/nft/v1/tokens/by_collection/{collection_addr}` Get NFT tokens by collection. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ---------- | ------------------------------------------------------ | | `collection_addr` | path | string | - | Collection address | | `token_id` | query | string | - | Token ID to filter by (optional) | | `order_by` | query | string | `token_id` | Order by field. Available values: `token_id`, `height` | | `pagination.key` | query | string | - | See [Pagination](#pagination) | | `pagination.offset` | query | integer | - | See [Pagination](#pagination) | | `pagination.limit` | query | integer | `100` | See [Pagination](#pagination) | | `pagination.count_total` | query | boolean | `true` | See [Pagination](#pagination) | | `pagination.reverse` | query | boolean | `true` | See [Pagination](#pagination) | ### Response **200 OK** Schema: `nft.NftsResponse` ## GET `/indexer/nft/v1/txs/{collection_addr}/{token_id}` Get NFT transactions by collection and token ID. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ------- | ----------------------------- | | `collection_addr` | path | string | - | Collection address | | `token_id` | path | string | - | Token ID | | `pagination.key` | query | string | - | See [Pagination](#pagination) | | `pagination.offset` | query | integer | - | See [Pagination](#pagination) | | `pagination.limit` | query | integer | `100` | See [Pagination](#pagination) | | `pagination.count_total` | query | boolean | `true` | See [Pagination](#pagination) | | `pagination.reverse` | query | boolean | `true` | See [Pagination](#pagination) | ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) *** # Rich List <Note> Rich list indexing is currently available only for EVM rollups. Move and Wasm rollups are not yet supported. </Note> ## GET `/indexer/richlist/v1/{denom}` Get token holders. Get a list of token holders for a specific denomination, ordered by amount in descending order. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ------- | ----------------------------- | | `denom` | path | string | - | Token denomination | | `pagination.key` | query | string | - | See [Pagination](#pagination) | | `pagination.offset` | query | integer | - | See [Pagination](#pagination) | | `pagination.limit` | query | integer | `100` | See [Pagination](#pagination) | | `pagination.count_total` | query | boolean | `true` | See [Pagination](#pagination) | | `pagination.reverse` | query | boolean | `true` | See [Pagination](#pagination) | ### Response **200 OK** Schema: `richlist.TokenHoldersResponse` Example response: ```json theme={null} { "holders": [ { "account": "initia1holderaddress", "amount": "1000000" } ], "pagination": { "next_key": "AQID", "previous_key": "", "total": "1" } } ``` # FAQ Source: https://docs.initia.xyz/nodes-and-rollups/indexing/rollytics/faq Frequently asked questions about Rollytics and migrating from the legacy KV Indexer. ## What Is Rollytics? Rollytics is Initia's production indexing service that replaces the legacy KV Indexer. Unlike KV Indexer, which runs inside each RPC node and duplicates index storage, Rollytics runs as a dedicated external service that indexes chain data once into a shared Postgres database and serves queries via a KV-compatible HTTP API. Key benefits: * Eliminates duplicate index storage across RPC nodes * Simplifies operations (reindexing happens in one place) * Improves RPC node performance by removing indexing overhead ## Can We Keep Using KV Indexer? Yes, but it is **not recommended**. KV Indexer: * Duplicates storage on every RPC node * Increases operational cost as you scale * Adds load to RPC nodes * Is no longer actively maintained Rollytics is the long-term supported indexing solution for Initia rollups. ## Will Services Break If We Don’t Migrate? No immediate breakage is expected, but migration is recommended before production scale. ## Is Rollytics Compatible with Existing KV Indexer Endpoints? Yes, Rollytics is fully compatible with KV Indexer endpoints. Rollytics exposes a KV Indexer endpoint-compatible HTTP API, which means: * Existing tools and services continue to work without modification * No code changes are required * Only the base endpoint URL needs to be updated This allows Rollytics to act as a drop-in replacement, making migration straightforward and low-risk. ## Can Rollytics Run Alongside KV Indexer? Yes, and this is the recommended migration approach. You can: * Run both in parallel * Switch consumers incrementally * Validate correctness * Disable KV Indexer after confirmation This approach requires no downtime and allows easy rollback. ## Does Rollytics Require Archival Nodes? Yes. The indexer needs access to **historical data from genesis**, which requires: * Archival RPC * REST endpoint * JSON-RPC endpoint for EVM rollups ## What Postgres Version Is Required? Postgres 15+ is compatible. ## How Many Rollytics Instances Should We Run? * **Indexer**: one per chain * **API**: one or more, depending on query load * **Postgres**: one primary database, with replicas if needed ## What Data Does Rollytics Index? Rollytics indexes: * Blocks * Transactions * NFTs * EVM transactions * Internal EVM transactions (EVM rollups only) ## Which VM Types Are Supported? Rollytics supports Move, Wasm, and EVM rollups. ## Does Rollytics Support Internal EVM Transactions? Yes. For EVM rollups, internal transaction indexing is enabled by default. ## Where Is the API Reference? The API reference is documented separately and mirrors the KV Indexer endpoint structure. # Setup and Migration Guide Source: https://docs.initia.xyz/nodes-and-rollups/indexing/rollytics/setup-and-migration Step-by-step guide to deploying Rollytics and migrating from the legacy KV Indexer. This guide walks through deploying Rollytics (Initia's production indexing service) and migrating safely from the legacy KV Indexer with no downtime. Rollytics runs as a dedicated external service that indexes chain data into Postgres and exposes a KV-compatible API, eliminating the need to duplicate index storage across RPC nodes. The recommended approach is to **run Rollytics in parallel** with KV Indexer, validate correctness, then disable KV Indexer. If you are starting a new rollup or do not already run KV Indexer, deploy Rollytics and use its API directly. You can skip the migration and deprecation steps. ## Components Rollytics consists of two services: * **Indexer service** * Syncs historical and live chain data into Postgres * **API service** * Serves indexed data via a KV-compatible HTTP API These services should be deployed separately. ## Prerequisites * Access to an **archival RPC endpoint** (genesis → latest) * REST endpoint * For EVM rollups, JSON-RPC endpoint * Postgres database (15+ compatible) * Sufficient disk space for index growth You are responsible for provisioning and operating Postgres (managed service or self-hosted). ### Resource Guidance * Run **Indexer** and **API** on separate machines to avoid resource contention * Recommended starting spec (each service): 1 CPU / 2 GB memory * Plan initial disk space for index growth (20-50 GB to start; scale as needed) ### Supported VM Types * Move * Wasm * EVM ## Deployment Recommendations * Start with modest resources and scale as chain activity grows ## Step 1: Deploy Rollytics 1. Follow the official setup instructions in the [Rollytics repository](https://github.com/initia-labs/rollytics): * Use the latest release 2. Configure: * Archival RPC endpoint * REST endpoint * JSON-RPC endpoint (EVM rollups) * `CHAIN_ID`, `VM_TYPE`, and `DB_DSN` 3. For EVM rollups: * Internal transactions are enabled by default (`INTERNAL_TX=true`) * Set `INTERNAL_TX=false` only if you explicitly want to disable it 4. Start the indexer and allow it to sync from genesis Minimum config and run: ```bash theme={null} export CHAIN_ID="<chain-id>" export VM_TYPE="move|wasm|evm" export RPC_URL="https://<rpc>" export REST_URL="https://<rest>" export JSON_RPC_URL="https://<json-rpc>" # EVM only export DB_DSN="postgres://user:pass@host:5432/rollytics" rollytics indexer rollytics api ``` Initial sync speed varies by chain activity and infrastructure (reference: \~1M blocks/day). Use `/status` to track catch-up progress. ### Docker Quickstart (Optional) Rollytics is available as a container image: ```bash theme={null} docker pull ghcr.io/initia-labs/rollytics:<version> ``` Run the API service: ```bash theme={null} docker run --rm \ -p 8080:8080 \ -e CHAIN_ID="<chain-id>" \ -e VM_TYPE="move|wasm|evm" \ -e RPC_URL="https://<rpc>" \ -e REST_URL="https://<rest>" \ -e JSON_RPC_URL="https://<json-rpc>" \ -e DB_DSN="postgres://user:pass@host:5432/rollytics" \ ghcr.io/initia-labs/rollytics:<version> api ``` Run the indexer: ```bash theme={null} docker run --rm \ -e CHAIN_ID="<chain-id>" \ -e VM_TYPE="move|wasm|evm" \ -e RPC_URL="https://<rpc>" \ -e REST_URL="https://<rest>" \ -e JSON_RPC_URL="https://<json-rpc>" \ -e DB_DSN="postgres://user:pass@host:5432/rollytics" \ ghcr.io/initia-labs/rollytics:<version> indexer ``` For non-EVM rollups, omit `JSON_RPC_URL`. ### VM-Specific Defaults * **EVM**: internal transaction indexing is enabled by default * **Move/Wasm**: internal transaction indexing is disabled by default Setting `INTERNAL_TX=true` for Move or Wasm rollups is not supported and will be ignored. ## Step 2: Verify Sync Status Wait until the indexer has fully caught up. * Query the Rollytics API `/status` endpoint * Confirm the reported `height` matches the latest chain height Do not switch consumers until the indexer is fully synced. ## Step 3: Switch Consumers to Rollytics If you currently query the KV Indexer, update services to point to the Rollytics API instead. Because Rollytics is KV-compatible: * No code changes are required * Only the base URL needs to change Validate: * Transaction queries * NFT data * EVM transaction data (if applicable) ## Step 4: Update Initia Registry Update your rollup’s registry entry so Initia products use Rollytics: * Modify `apis.indexer` in your `chain.json` * Point it to the Rollytics API endpoint Example registry update: * Replace KV Indexer endpoint with Rollytics API endpoint * Reference: [https://github.com/initia-labs/initia-registry/blob/main/mainnets/moo/chain.json#L39](https://github.com/initia-labs/initia-registry/blob/main/mainnets/moo/chain.json#L39) ```json theme={null} { "apis": { "indexer": [ { "address": "https://<your-rollytics-api-host>" } ] } } ``` ## Step 5: Deprecate KV Indexer After validation: Disable KV Indexer in `~/.minitia/config/app.toml`: ```toml theme={null} [indexer] enable = false ``` ## Step 6: Reclaim Disk Space Reclaim disk space using one of the following approaches: ### Option A * Stop the node * Remove `~/.minitia/data/indexer.db` * Restart the node ### Option B * Deploy a fresh node * State-sync from an existing node * Retire the old node ### Important Notes * KV Indexer is no longer actively maintained * All future indexing improvements will be added only to Rollytics * Production rollups should treat Rollytics as required infrastructure # Introduction Source: https://docs.initia.xyz/nodes-and-rollups/introduction This section is for: * **Rollup teams** looking to launch their own Interwoven Rollup * **Node operators** looking to run their own Initia L1 or rollup nodes * **Validators** who want to spin up a node to secure the Initia L1 network # Cosmovisor (Optional) Source: https://docs.initia.xyz/nodes-and-rollups/running-nodes/manual-setup/cosmovisor Cosmovisor helps manage `initiad` binary upgrades automatically during chain upgrades. <Note> **Prerequisite:** complete the [Running L1 Nodes with Initiad](/nodes-and-rollups/running-nodes/running-l1-nodes/l1-nodes-initiad) guide first, then follow the steps below. </Note> ## Install Cosmovisor ```bash theme={null} go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest ``` ## Configure Cosmovisor Set the daemon environment variables and initialize Cosmovisor. The `<path-to-executable>` must be the path to your `initiad` binary. ```bash theme={null} export DAEMON_HOME=~/.initia export DAEMON_NAME=initiad cosmovisor init <path-to-executable> ``` You can find the `initiad` path with: ```bash theme={null} which initiad ``` ## Update System Service (Optional) If you run `initiad` as a service, update your `initiad.service` file: ```ini theme={null} [Unit] Description=initiad [Service] Type=simple User=ubuntu ExecStart=/home/ubuntu/go/bin/cosmovisor run start --home /home/ubuntu/.initia WorkingDirectory=/home/ubuntu/.initia Restart=on-abort StandardOutput=syslog StandardError=syslog SyslogIdentifier=initiad LimitNOFILE=4096 Environment="DAEMON_NAME=initiad" Environment="DAEMON_HOME=/home/ubuntu/.initia" Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true" Environment="DAEMON_RESTART_AFTER_UPGRADE=true" Environment="DAEMON_RESTART_DELAY=5s" Environment="UNSAFE_SKIP_BACKUP=true" [Install] WantedBy=multi-user.target ``` Reload and restart the service: ```bash theme={null} sudo systemctl daemon-reload sudo systemctl restart initiad ``` For more details, see the [Cosmovisor documentation](https://cosmos-docs.mintlify.app/sdk/v0.47/build/tooling/cosmovisor). # Becoming a Validator Source: https://docs.initia.xyz/nodes-and-rollups/running-nodes/running-a-validator/becoming-a-validator <Note> Before proceeding to create a validator, first make sure that your Initia node is fully synced to the latest height. You can verify this by comparing your node's latest block height with the network's. </Note> <Steps> <Step title="Create the Validator Account"> First, you need to create an account for your validator. This account will be used to run the validator node. To do so, you can run the following command: ```sh theme={null} initiad keys add validator ``` You then need to fund the account with the network's gas token. </Step> <Step title="Register the Validator"> Once you have funded the validator account, you can send a `CreateValidator` transaction to the network to register as a validator. ```sh theme={null} initiad tx mstaking create-validator \\ --amount="<bond_amount>" \\ --pubkey=$(initiad tendermint show-validator) \\ --moniker="<your_moniker>" \\ --identity="<keybase_identity>" \\ --chain-id="<chain_id>" \\ --from="<key_name>" \\ --commission-rate="0.10" \\ --commission-max-rate="0.20" \\ --commission-max-change-rate="0.01" ``` | Flag | Description | | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `bond_amount` | This is the amount of tokens you wish to self-bond. It can be in uinit or other tokens that are whitelisted as liquidity provider (LP) tokens. | | `pubkey` | The public key necessary for validator consensus. Typically, this is obtained from the output of the `initiad tendermint show-validator` command. | | `your_moniker` | A human-readable name for your validator. This should match either the moniker you used in the `initiad init` command or a moniker registered in the `~/.initia/config/config.toml` file. | | `chain_id` | The ID of the chain you wish to join as a validator. It must correspond with the ID specified in the `genesis.json` file. | | `key_name` | The account address or name used to submit the transaction. The output of `initiad keys show <key name>` should correctly display your account details. If not, verify the accuracy of your `key_name` or keyring settings. A fee is required to submit the transaction, paid in the blockchain's native tokens. | | `identity` | An optional field for adding your Keybase identity information, which allows displaying an icon for your validator. This requires a 16-digit string associated with your Keybase account. Without this, no icon will be displayed in user interfaces. | | `commission-rate` | The commission rate you charge delegators, expressed as a fraction. It must be set above the `min_commission_rate` parameter specified by the mStaking protocol. | | `commission-max-rate` | The maximum commission rate you can charge as a validator. | | `commission-max-change-rate` | The maximum daily change in commission rate that is permissible for the validator. | Once the message is submitted and successfully confirmed, your validator will be active and participating in the network. </Step> <Step title=
프로젝트로 돌아가기