Initia 백서

Initia

원문

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

────────┐ │ Fiber v2.52.5 │ │ http://127.0.0.1:3000 │ │ │ │ Handlers ............. 9 Processes ........... 1 │ │ Prefork ....... Disabled PID ............. 17969 │ └───────────────────────────────────────────────────┘ 2025-02-11T17:28:46.207+0700 INFO executor batchsubmitter/batch.go:173 finalize batch {"height": 54, "batch start": 1, "batch end": 54, "batch size": 47462, "chunks": 1, "txs": 2} 2025-02-11T17:28:52.584+0700 INFO executor child/withdraw.go:174 finalize working tree {"tree_index": 1, "height": 54, "start_leaf_index": 1, "num_leaves": 0, "storage_root": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="} ``` </Step> <Step title="Start the OPinit Challenger"> <Warning> For production use, set up the Challenger bot on a separate machine from the Executor bot. </Warning> The OPinit Challenger bot is responsible for monitoring the Executor bot's output proposal and ensuring its validity. To start the bot, run: ```sh theme={null} weave opinit init ``` Again, you'll be guided through a series of questions similar to the Executor. The main difference is that you'll be setting up the Challenger instead of the Executor. ```sh theme={null} ✓ Existing keys in /Users/tansawit/.minitia/artifacts/config.json detected. Would you like to add these to the keyring before proceeding? > Yes, use detected keys ✓ Which bot would you like to run? > Challenger ✓ Existing /Users/tansawit/.minitia/artifacts/config.json detected. Would you like to use the data in this file to pre-fill some fields? > Yes, prefill ✓ Specify listen address of the bot ... localhost:3001 ✓ Specify L1 RPC endpoint ... https://rpc.testnet.initia.xyz:443/ ✓ Specify rollup chain ID ... demo-314 ✓ Specify rollup RPC endpoint ... http://localhost:26657 ✓ OPInit bot setup successfully. Config file is saved at /Users/tansawit/.opinit/challenger.json. Feel free to modify it as needed. ✓ You can start the bot by running `weave opinit start challenger` ``` Once all of that is complete, you can start the bot by running the following command. ```sh theme={null} weave opinit start challenger ``` You should see the bot running in the terminal. ```sh theme={null} Streaming logs from launchd com.opinitd.challenger.daemon 2025-02-11T17:31:59.060+0700 INFO challenger challenger/challenger.go:94 bridge info {"id": 659, "submission_interval": 60} 2025-02-11T17:31:59.200+0700 INFO challenger node/node.go:118 initialize height 2025-02-11T17:31:59.346+0700 INFO challenger node/node.go:118 initialize height 2025-02-11T17:31:59.347+0700 INFO challenger host/host.go:88 host start {"height": 5315486} 2025-02-11T17:31:59.347+0700 INFO challenger child/child.go:200 child start {"height": 1} 2025-02-11T17:31:59.347+0700 INFO challenger node/node.go:173 tx checker looper stopped ┌───────────────────────────────────────────────────┐ 2025-02-11T17:31:59.347+0700 INFO challenger node/node.go:173 tx checker looper stopped │ Fiber v2.52.5 │ 2025-02-11T17:31:59.452+0700 INFO challenger child/child.go:138 initialize tree {"index": 1} │ http://127.0.0.1:3001 │ │ │ │ Handlers ............ 11 Processes ........... 1 │ │ Prefork ....... Disabled PID ............. 20592 │ └───────────────────────────────────────────────────┘ ``` If everything is working correctly, you will now have both the Executor and Challenger bots running. </Step> <Step title="Start the IBC Relayer"> Finally, you need to set up the IBC Relayer bot. This bot relays IBC messages between the Initia L1 and your rollup. It is essential for oracle price updates and managing IBC bridging transactions, including Minitswap compatibility. ```sh theme={null} weave relayer init ``` By default, Weave also allows you to set up the relayer for any whitelisted rollup. However, in this case, set up the relayer for your local rollup. ```sh theme={null} ✓ Select the type of Interwoven rollup you want to relay > Local Rollup (demo-314) ✓ L1 network is auto-detected > initiation-2 ✓ Specify rollup RPC endpoint ... http://localhost:26657 ✓ Specify rollup GRPC endpoint ... http://localhost:9090 ✓ Specify rollup WebSocket endpoint ... ws://localhost:26657/websocket ✓ Select method to setup IBC channels for the relayer. > Subscribe to only `transfer` and `nft-transfer` IBC Channels (minimal setup) ✓ Select the IBC channels you would like to relay ... 2 IBC channels subscribed ✓ Do you want to setup relayer with the challenger key > Yes (recommended, open the tooltip to see the details) ✓ Relayer setup successfully. Config file is saved at /Users/tansawit/.hermes/config.toml. Feel free to modify it as needed. ✓ You can start the relayer by running `weave relayer start` ``` Once all of that is complete, you can start the bot by running the following command. ```sh theme={null} weave relayer start ``` You should see the bot running in the terminal. ```sh theme={null} Updating IBC client: 07-tendermint-1 of network: demo-314 Successfully updated IBC client: 07-tendermint-1 of network: demo-314 Updating IBC client: 07-tendermint-0 of network: demo-314 Successfully updated IBC client: 07-tendermint-0 of network: demo-314 Streaming logs from launchd com.hermes.daemon 2025-02-11T10:36:06.546411Z INFO ThreadId(01) using default configuration from '/Users/tansawit/.hermes/config.toml' 2025-02-11T10:36:06.547351Z INFO ThreadId(01) running Hermes v1.10.4+542e14f 2025-02-11T10:36:06.749253Z INFO ThreadId(16) REST service running, exposing REST API at http://127.0.0.1:7010 ``` </Step> </Steps> # Indexing on Initia Source: https://docs.initia.xyz/nodes-and-rollups/indexing/introduction Overview of indexing on Initia rollups and the recommended approach using Rollytics. Indexing provides fast, structured access to on-chain data for wallets, explorers, and backend services. On Initia, indexing is a core part of operating a production rollup. ## What Indexing Is Used For Indexed data powers common read-heavy use cases, including: * Transaction history * Account activity * NFT collections and tokens * Block and chain statistics * Token holder (rich list) queries Without indexing, these queries would be slow or impractical to serve directly from RPC nodes. ## What Is Rollytics? Rollytics is Initia's recommended indexing service. Unlike the legacy KV Indexer, Rollytics runs as a dedicated external service that indexes chain data once into a shared Postgres database. It supports Move, Wasm, and EVM rollups. If you do not already run KV Indexer, you can ignore the legacy sections and use Rollytics directly. ### Key Advantages * **Single source of truth**: Index once into Postgres, serve from multiple API instances * **Operational simplicity**: Reindexing and maintenance happen in one place, not across every RPC node * **Better performance**: RPC nodes focus on serving chain data without indexing overhead * **Scalability**: Add RPC nodes without duplicating index storage or reindexing * **KV-compatible API**: Compatible with existing KV Indexer consumers for migrations * **Better data accuracy**: Resolves known KV Indexer NFT data issues ## Indexing Options on Initia Historically, Initia rollups relied on the KV Indexer, which runs inside each RPC node and stores indexed data locally. Today, Initia recommends using Rollytics instead. ### KV Indexer (legacy) * Runs inside RPC nodes and stores index data locally per node * Requires reindexing on every node * Legacy and not recommended for production rollups ### Rollytics (recommended) * Runs as a dedicated external service * Indexes once into a shared Postgres database * Exposes a KV Indexer endpoint-compatible HTTP API ## Why Rollytics * **Index once, serve everywhere**: One shared Postgres database supports many API instances * **Operational simplicity**: Reindexing and upgrades happen in one place * **Better RPC performance**: RPC nodes are not competing with indexing workloads ## When to Use Rollytics Use Rollytics if you: * Operate more than one RPC node * Serve wallets, explorers, or public APIs * Plan to scale RPC nodes over time * Run an EVM rollup and need EVM transaction indexing ## Recommended Approach For new rollups: * Deploy Rollytics from the start * Use the Rollytics API for all indexed queries For existing rollups: * Run Rollytics alongside the KV Indexer * Switch consumers to the Rollytics API * Disable the KV Indexer after validation This approach allows migration with no downtime and minimal risk. ## Get Started * Deploy and migrate: [Setup and Migration Guide](./rollytics/setup-and-migration) * API endpoints: [API Reference](./rollytics/api-reference) * Common questions: [FAQ](./rollytics/faq) # KV Indexer (Legacy) Source: https://docs.initia.xyz/nodes-and-rollups/indexing/kv-indexer/legacy-overview Overview of the legacy KV Indexer, its limitations, and why Rollytics is the recommended replacement. ⚠️ **Legacy / Deprecated** KV Indexer is a legacy indexing solution and is not recommended for production rollups.\ New deployments should use Rollytics instead. Initia products discover indexer endpoints via the Initia registry (`chain.json` → `apis.indexer`). ## What KV Indexer Is KV Indexer is an indexing system embedded directly inside Cosmos RPC nodes. ## Why KV Indexer Is Deprecated KV Indexer does not scale well for production rollups: * **Duplicated storage and reindexing** * Each RPC node stores its own index and must be reindexed individually * **RPC performance impact** * Indexing competes with RPC traffic for CPU, memory, and I/O * **No active development** * KV Indexer is deprecated and no longer receives bug fixes or feature improvements Because of these fundamental limitations, KV Indexer is not the long-term indexing solution for Initia rollups. ## When You Might Still See KV Indexer You may still see KV Indexer on: * Older rollups that have not yet migrated * Existing RPC nodes with indexing enabled * Local development or test environments Its presence does not indicate an issue, but migration is strongly recommended. ## How to Disable KV Indexer After migrating to Rollytics, KV Indexer can be disabled in `~/.minitia/config/app.toml`: ```toml theme={null} [indexer] enable = false ``` Disabling KV Indexer reduces disk usage and removes unnecessary load from RPC nodes. ## What to Use Instead Initia recommends Rollytics as the production indexing solution. Rollytics is Initia's dedicated indexing service: * **Indexes once into a shared Postgres database** * **Exposes KV Indexer endpoint-compatible APIs** * **Runs separately from RPC nodes** Rollytics is the long-term indexing solution for Initia rollups and should be used for all production deployments. # API Reference Source: https://docs.initia.xyz/nodes-and-rollups/indexing/rollytics/api-reference Rollytics KV Indexer endpoint-compatible API reference, with endpoints for status, blocks, transactions, NFTs, and rich lists. Rollytics exposes a **read-only**, KV Indexer endpoint-compatible (drop-in for most consumers) HTTP API for indexed chain data. This section documents the endpoints commonly used by wallets, explorers, and backend services. Base URL: `https://<your-rollytics-api-host>` OpenAPI: `/swagger/doc.json` Response schemas and full field definitions are in the OpenAPI spec. Examples below show representative payloads. ## Conventions ### Response Format All responses are `application/json`. ### Pagination Many list endpoints accept Cosmos-style pagination parameters. **Pagination Parameters:** | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ------- | ---------------------------------------------------------------------------------------- | | `pagination.key` | query | string | - | Cursor-based pagination, preferred for large datasets | | `pagination.offset` | query | integer | - | Offset-based pagination | | `pagination.limit` | query | integer | `100` | Pagination limit | | `pagination.count_total` | query | boolean | `true` | Count total (when supported) | | `pagination.reverse` | query | boolean | `true` | Reverse order. Default is descending; set `pagination.reverse=false` for ascending order | Pagination responses may include `pagination.next_key`, `pagination.previous_key`, and `pagination.total`, depending on the endpoint and data set. For exact response fields, refer to OpenAPI. #### Pagination Examples **Key-based pagination:** ```bash theme={null} # First page curl "https://<host>/indexer/tx/v1/txs?pagination.limit=50" # Next page using next_key from response curl "https://<host>/indexer/tx/v1/txs?pagination.limit=50&pagination.key=<next_key_from_response>" ``` ### Filtering Some transaction endpoints support filtering by message type via the `msgs` parameter: | Name | In | Type | Default | Description | | ------ | ----- | -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | | `msgs` | query | array\[string] | - | Message types to filter (comma-separated or multiple params). Example: `"cosmos.bank.v1beta1.MsgSend,initia.move.v1.MsgExecute"` | Example: ```bash theme={null} curl "https://<host>/indexer/tx/v1/txs?msgs=cosmos.bank.v1beta1.MsgSend&msgs=initia.move.v1.MsgExecute" ``` *** # App ## GET `/status` Status check. Returns current indexer status including chain ID and latest indexed heights. ### Response **200 OK** Schema: `status.StatusResponse` Example response: ```json theme={null} { "version": "0.7.1", "commit_hash": "a1b2c3d", "chain_id": "initia-1", "height": 123456, "internal_tx_height": 123400, "rich_list_height": 123450 } ``` Field notes: * `height`: latest indexed block height * `internal_tx_height`: latest indexed internal EVM transaction height * `rich_list_height`: latest indexed rich list height *** # Block Block endpoints return JSON objects defined in OpenAPI; see `/swagger/doc.json` for full schema details. ## GET `/indexer/block/v1/avg_blocktime` Get average block time. Returns the average block time over recent blocks. ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) ## GET `/indexer/block/v1/blocks` Get blocks. Returns a list of blocks with pagination. ### Parameters | Name | In | Type | Default | Description | | -------------------- | ----- | ------- | ------- | ----------------------------- | | `pagination.key` | query | string | - | See [Pagination](#pagination) | | `pagination.offset` | query | integer | - | See [Pagination](#pagination) | | `pagination.limit` | query | integer | `100` | See [Pagination](#pagination) | | `pagination.reverse` | query | boolean | `true` | See [Pagination](#pagination) | ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) ## GET `/indexer/block/v1/blocks/{height}` Get block by height. **Note:** The `height` parameter is a string for this endpoint, but an integer for `GET /indexer/tx/v1/txs/by_height/{height}`. ### Parameters | Name | In | Type | Default | Description | | -------- | ---- | ------ | ------- | ------------ | | `height` | path | string | - | Block height | ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) *** # Transactions Transaction endpoints return JSON objects defined in OpenAPI; see `/swagger/doc.json` for full schema details. ## GET `/indexer/tx/v1/txs` Get transactions. Returns a list of transactions with pagination. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | -------------- | ------- | ----------------------------- | | `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) | | `msgs` | query | array\[string] | - | See [Filtering](#filtering) | ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) ## GET `/indexer/tx/v1/txs/by_account/{account}` Get transactions by account. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | -------------- | ------- | ----------------------------- | | `account` | path | string | - | Account address | | `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) | | `is_signer` | query | boolean | `false` | Filter by signer accounts | | `msgs` | query | array\[string] | - | See [Filtering](#filtering) | ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) ## GET `/indexer/tx/v1/txs/by_height/{height}` Get transactions by height. Get transactions at a specific block height. **Note:** The `height` parameter is an integer for this endpoint, but a string for `GET /indexer/block/v1/blocks/{height}`. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | -------------- | ------- | ----------------------------- | | `height` | path | integer | - | Block 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) | | `msgs` | query | array\[string] | - | See [Filtering](#filtering) | ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) ## GET `/indexer/tx/v1/txs/{tx_hash}` Get transaction by hash. ### Parameters | Name | In | Type | Default | Description | | --------- | ---- | ------ | ------- | ---------------- | | `tx_hash` | path | string | - | Transaction hash | ### Response **200 OK** Schema: see OpenAPI (`/swagger/doc.json`) *** # NFT NFT schemas in OpenAPI: `nft.CollectionsResponse`, `nft.CollectionResponse`, `nft.NftsResponse`. ## GET `/indexer/nft/v1/collections` Get NFT collections. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ------- | ----------------------------- | | `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` Example response: ```json theme={null} { "collections": [ { "object_addr": "initia1collectionaddress", "collection": { "creator": "initia1creatoraddress", "name": "Initia Badges", "origin_name": "initia.badges", "nfts": { "handle": "badge", "length": 12 } }, "height": 123456, "timestamp": "2024-01-12T10:20:30Z" } ], "pagination": { "next_key": "AQID", "previous_key": "", "total": "1" } } ``` ## GET `/indexer/nft/v1/collections/by_account/{account}` Get NFT collections by account. ### Parameters | Name | In | Type | Default | Description | | ------------------------ | ----- | ------- | ------- | ----------------------------- | | `account` | path | string | - | Account address | | `pagination.key` | query | string | - | See [Paginatio
프로젝트로 돌아가기