Initia 백서

Initia

원문

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

eryClient = new QueryClient() const wagmiConfig = createConfig({ chains: [mainnet], transports: { [mainnet.id]: http() }, }) const feeDenom = "<YOUR_FEE_DENOM>" const customChain = { chain_id: "<YOUR_CHAIN_ID>", chain_name: "My Appchain", network_type: "testnet", bech32_prefix: "init", apis: { rpc: [{ address: "http://localhost:26657" }], rest: [{ address: "http://localhost:1317" }], indexer: [{ address: "http://localhost:8080" }], }, fees: { fee_tokens: [{ denom: feeDenom, fixed_min_gas_price: 0, low_gas_price: 0, average_gas_price: 0, high_gas_price: 0 }] }, staking: { staking_tokens: [{ denom: feeDenom }] }, native_assets: [{ denom: feeDenom, name: "Token", symbol: "TKN", decimals: 6 }], metadata: { is_l1: false, minitia: { type: "minimove" } }, } injectStyles(InterwovenKitStyles) function App() { return ( <QueryClientProvider client={queryClient}> <WagmiProvider config={wagmiConfig}> <InterwovenKitProvider {...TESTNET} defaultChainId="<YOUR_CHAIN_ID>" customChain={customChain} customChains={[customChain]} > <LotteryApp /> </InterwovenKitProvider> </WagmiProvider> </QueryClientProvider> ) } ``` ### Connecting a Wallet The `useInterwovenKit` hook provides everything you need for wallet connection. Here is a simplified wallet connection component based on the wallet controls in Lotteria's `Header.tsx`: ```tsx theme={null} import { useInterwovenKit } from "@initia/interwovenkit-react" // truncate is a simple display utility — inline it or use your own preferred implementation const truncate = (str: string, maxLength = 12): string => str.length > maxLength ? `${str.slice(0, 6)}...${str.slice(-4)}` : str const Connection = () => { const { address, username, openWallet, openConnect } = useInterwovenKit() if (!address) { return <button onClick={openConnect}>Connect</button> } return ( <button onClick={openWallet}>{truncate(username ?? address)}</button> ) } export default Connection ``` When no wallet is connected, the component renders a "Connect" button that calls `openConnect` to launch the wallet connection drawer. Once connected, it displays the user's Initia username (if they have one) or a truncated version of their address. Clicking the button calls `openWallet` to open the wallet detail panel. ### Depositing Assets Users need tokens on your appchain to interact with it. InterwovenKit provides a built-in deposit flow that handles cross-chain bridging. Here is the `openDeposit` pattern used by Lotteria: ```tsx theme={null} import { useInterwovenKit } from "@initia/interwovenkit-react" const Deposit = () => { const { address, openDeposit } = useInterwovenKit() if (!address) return null return ( <button onClick={() => openDeposit({ denoms: [ "<YOUR_ROLLUP_DENOMS>", ], chainId: "<YOUR_CHAIN_ID>", }) } > Deposit </button> ) } export default Deposit ``` The `openDeposit` method opens a drawer that lets users bridge tokens from Initia L1 (or other connected chains) to your appchain. The `denoms` array specifies which token denominations are accepted. The `chainId` should match your appchain's chain ID. <Tip> If you want to support deposits from Initia L1, include `uinit` in the allowed denoms. Initia L1 uses `initiation-2` on testnet and `interwoven-1` on mainnet. </Tip> The component only renders when a wallet is connected (`address` is truthy), since depositing requires an active wallet session. ### Sending Transactions To interact with your Move module from the frontend, use `requestTxSync` to construct and send transactions: ```tsx theme={null} import { useInterwovenKit } from '@initia/interwovenkit-react' function encodeVectorU8(numbers: number[]): Uint8Array { const bytes = new Uint8Array(numbers.length + 1) bytes[0] = numbers.length for (let i = 0; i < numbers.length; i++) { bytes[i + 1] = numbers[i] } return bytes } function BuyTicketButton() { const { initiaAddress, requestTxSync } = useInterwovenKit() const handleBuyTicket = async () => { if (!initiaAddress) return const selectedNumbers = [1, 2, 3, 4, 5, 6] // replace with numbers chosen in your UI try { const txHash = await requestTxSync({ chainId: '<YOUR_CHAIN_ID>', messages: [ { typeUrl: "/initia.move.v1.MsgExecute", value: { sender: initiaAddress, moduleAddress: "<YOUR_MODULE_HEX_ADDRESS>", moduleName: "lottery", functionName: "buy_ticket", typeArgs: [], args: [encodeVectorU8(selectedNumbers)], }, }, ], }) console.log("Transaction hash:", txHash) } catch (error) { console.error("Transaction failed:", error) } } return <button onClick={handleBuyTicket}>Buy Ticket</button> } ``` The `requestTxSync` method prompts the user's wallet to sign and broadcast the transaction. It returns the transaction hash on success. ### Querying Onchain State To query and read data using the view functions of your Move module, you can utilize the chain's REST endpoint as follows: ```tsx theme={null} async function fetchTicketPrice() { const res = await fetch( `http://localhost:1317/initia/move/v1/accounts/<MODULE_ADDRESS>/modules/lottery/view_functions/get_ticket_price`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ type_args: [], args: [] }), } ) const data = await res.json() return data } ``` You can wrap this in a React hook with polling or use a library like TanStack Query for automatic refetching. # 3. Connecting to the Chain ### Chain Configuration Your appchain runs locally after `weave init`. The default endpoints are: | Service | URL | | ------- | ------------------------ | | RPC | `http://localhost:26657` | | REST | `http://localhost:1317` | These endpoints are what your frontend uses to query state and broadcast transactions. ### Bridging Assets via IBC Once the IBC Relayer is running (see [Set Up Your Appchain](/hackathon/get-started)), you can bridge INIT tokens from the L1 testnet to your appchain. This is how users fund their accounts on your rollup. The bridge flow works through IBC transfer channels that the relayer establishes between Initia L1 and your rollup. Users can send tokens from L1 to your chain, and the tokens arrive as IBC-denominated assets. ### Frontend Development Workflow A practical development loop looks like this: 1. Write or update your Move module in `move/sources/` 2. Build and deploy with `minitiad move deploy` 3. Test the module via CLI with `minitiad tx move execute` and `minitiad query move view` 4. Build your frontend components using InterwovenKit hooks 5. Run the frontend dev server and test end-to-end # Summary Building an appchain on Initia with the Move track involves three layers: 1. **Move modules** define your onchain logic. Write your structs and entry functions, build with `initiad move build`, and deploy with `minitiad move deploy`. 2. **InterwovenKit** connects your React frontend to the chain. Wrap your app in `InterwovenKitProvider`, use `useInterwovenKit` for wallet connection and `requestTxSync` for transactions. 3. **Chain connectivity** is handled by the Interwoven Stack. Your local rollup exposes RPC and REST endpoints, and the IBC Relayer enables cross-chain token transfers. For the full working example, check out the [Lotteria repository](https://github.com/yonnie-park/lotteria). Happy building. # Submission Requirements Source: https://docs.initia.xyz/hackathon/submission-requirements Use this page to prepare your final submission. Complete the required submission files and fill in any missing details before you submit. ## Requirements If you followed [Set Up Your Appchain](/hackathon/get-started) and completed one of the Blueprint tutorials, you likely already satisfy the first three requirements below: appchain deployment, frontend experience, and native feature. Use this section to verify those pieces and complete the required submission files. <CardGroup> <Card title="Appchain Deployment" icon="diagram-project"> Your project should run as its own Initia appchain, with its own rollup identity and deployed application logic. </Card> <Card title="Frontend Experience" icon="display"> Your frontend should use `InterwovenKit` for wallet connection and transaction flows so the app reflects the core Initia user experience. </Card> <Card title="Native Feature" icon="bolt"> Your project should implement at least one supported Native Feature: * `auto-signing` * `interwoven-bridge` * `initia-usernames` </Card> <Card title="Submission Files" icon="file-lines"> Your repository should include: * `.initia/submission.json` * `README.md` at the repository root </Card> </CardGroup> <Note> **Showcase your app's originality:** Projects that only reproduce a Blueprint without meaningful customization are not eligible for prizes. Your submission should include clear custom logic, UX, or product differentiation. </Note> ## Submission JSON Required file path: `.initia/submission.json` Use this exact structure: ```json title=".initia/submission.json" theme={null} { "project_name": "My Project", "repo_url": "https://github.com/<org>/<repo>", "commit_sha": "0123456789abcdef0123456789abcdef01234567", "rollup_chain_id": "my-game-1", "deployed_address": "0x...", "vm": "move", "native_feature": "auto-signing", "core_logic_path": "blockforge/sources/items.move", "native_feature_frontend_path": "blockforge-frontend/src/Game.jsx", "demo_video_url": "https://youtu.be/..." } ``` ## Submission JSON Field Reference All fields in `.initia/submission.json` are required. | Field | Expected value | | :----------------------------- | :----------------------------------------------------------------------------------------------------------------------- | | `project_name` | Non-empty string | | `repo_url` | Reachable public GitHub repository URL | | `commit_sha` | 40-character hex Git commit SHA | | `rollup_chain_id` | Non-empty string | | `deployed_address` | Primary deployed address for your application logic. Use your contract address, or your module address for Move projects | | `vm` | `move`, `evm`, or `wasm` | | `native_feature` | `auto-signing`, `interwoven-bridge`, or `initia-usernames` | | `core_logic_path` | Repo-relative file path that must exist at `commit_sha` | | `native_feature_frontend_path` | Repo-relative file path that must exist at `commit_sha` | | `demo_video_url` | Public Loom or YouTube URL for a 1 to 3 minute walkthrough video | ## Project Description Required file path: `README.md` at the repository root Copy this block near the top of your `README.md` and fill it in: ```markdown title="README.md" theme={null} ## Initia Hackathon Submission - **Project Name**: [Your Project Name] ### Project Overview [Provide a 2-3 sentence description of your application, the problem it solves, who it is for, and why it is valuable to users.] ### Implementation Detail - **The Custom Implementation**: Briefly describe the unique logic you added. What original functionality did you design and implement? - **The Native Feature**: Which Interwoven feature did you use, and exactly how does it improve the user experience? ### How to Run Locally [Provide 3-4 clear steps for a judge to run your frontend and connect it to a local environment if necessary.] ``` # Introduction Source: https://docs.initia.xyz/home/core-concepts/enshrined-liquidity/introduction Enshrined Liquidity is Initia’s solution to address some inherent challenges of the Proof of Stake (PoS) and rollup models. These challenges include: 1. Trade-offs between chain security and liquidity 2. Lack of capital efficiency 3. Liquidity fragmentation This solution allows governance-whitelisted InitiaDEX INIT-TOKEN liquidity positions to be used as staking assets with validators, in addition to the native INIT token. This approach helps alleviate the aforementioned issues in several ways. ## Maximizing Chain Security and Liquidity In traditional PoS models, token holders can stake their assets with validators to secure the chain and earn rewards. However, this creates a tradeoff: the more assets staked, the more secure the chain, but fewer assets are available as liquidity within the application layer. This tradeoff impacts both chain security and liquidity. By enabling liquidity positions to be staked, you can simultaneously increase the chain's security and promote liquidity growth while earning rewards from both staking and liquidity provision. ## Enhancing Capital Efficiency From your perspective, having to choose between staking assets and providing liquidity also means sacrificing either trading fees or staking rewards. If you aim to earn both rewards, you need to split your capital into multiple positions, reducing your overall capital efficiency. By using liquidity positions as staking assets, Enshrined Liquidity eliminates the need to choose between staking and liquidity provision. You can now earn both staking rewards and trading fees from a single position, leading to improved capital efficiency and a streamlined approach to capital allocation. # Whitelisting and Rewards Source: https://docs.initia.xyz/home/core-concepts/enshrined-liquidity/whitelisting-and-rewards ## Eligibility To be eligible for staking and earning rewards on InitiaDEX, L1 governance must whitelist the LP pair. Before whitelisting, the LP token must meet the following prerequisites: 1. The LP token must include INIT as part of its pair. 2. For Balancer pool positions, the INIT weight within the pool must be equal to or greater than 50%. ## Determining Rewards and Reward Weights When a new LP token $a$ is whitelisted, the proposal must also include a suggested reward weight $w_a$ for the token. This weight represents the relative amount of rewards allocated to the token per block compared to the overall distribution among all whitelisted tokens. Governance can later adjust this weight once the asset is whitelisted. To determine the distribution of rewards per token per block for a stakable asset $a$ among $N$ total stakable assets, we use the following formula that incorporates individual reward weights: $$ r_a = \frac{w_a \cdot r_{\text{total}}}{\sum_{i=1}^{N} w_i} $$ where: * $r_a$ represents the inflationary INIT rewards for the asset $a$. * $r_{\text{total}}$ denotes the total INIT rewards allocated for a given block. * $w_a$ is the governance-set reward weight parameter for the asset $a$. * $\sum_{i=1}^{N} w_i$ is the sum of reward weights for all $N$ whitelisted tokens. # Tokenomics Source: https://docs.initia.xyz/home/core-concepts/init-token/tokenomics ## Introduction Initia's native token, \$INIT, has a fixed supply of 1 billion (1,000,000,000) tokens. These tokens are split across eight major categories as outlined below. <Frame> <img alt="" /> </Frame> | Category | Amount | % of Supply | Vesting | | ----------------------------- | ------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Foundation | 77.5M | 7.75% | 50% upfront, remaining 50% vested every 6 months over 48 months | | Protocol Developers | 150M | 15.00% | 25% after 12 month cliff, remaining 75% linearly vested over 36 months | | Protocol Sales (Investors) | 152.5M | 15.25% | 25% after 12 month cliff, remaining 75% linearly vested over 36 months | | Enshrined Liquidity & Staking | 250M | 25.00% | 5% will be released each year on a block-by-block basis, with a slightly shortened schedule due to [accelerated emissions](https://forum.initia.xyz/t/inflation-correction-and-unstaking-subsidy-plan) in the first month. | | VIP Rewards | 250M | 25.00% | 7% released per year, linearly distributed over 12 months | | Binance Launch Campaign | 60M | 6.00% | 100% unlocked | | Airdrop | 50M | 5.00% | 100% unlocked | | Echo.xyz Community Sale | 10M | 1.00% | 25% of the total amount on the 12/15/18/24th month post TGE | ## Breakdown ### Foundation **77,500,000 INIT (7.75% of total supply)** The Initia Foundation's main goal is to advance the Interwoven Economy, help redefine the boundaries of multichain capabilities, and ensure a vibrant ecosystem of diverse applications. To this end, 7.75% of the total token supply is set aside for the Initia Foundation. This covers initial liquidity bootstrapping for Enshrined Liquidity, genesis validator delegations, and future strategic initiatives and ecosystem grants. ### Protocol Developers (Team) **150,000,000 INIT (15% of total supply)** Protocol developers, including current and future Initia team members and contributors, have been allocated 15% of the supply in aggregate. All recipients of tokens from this category are subject to a 4 year vesting period that includes a 12 month lock and a 36 month unlocking period. ### Protocol Sales (Investors) **Amount: 152,500,000 INIT (15.25% of total supply)** The Interwoven Economy's progress would not have been possible without the early backing of Initia by its investors. Across three total rounds of fundraises, Initia has maintained dilution to investors at 15.25% of the total supply. This marks a distinct departure from many other L1 chains with high investor allocations. Similar to tokens allocated to Protocol Developers, tokens in the Protocol Sales category are subject to a 4 year vesting period that includes a 12 month lock and a 36 month unlocking period. ### Enshrined Liquidity & Staking Rewards **250,000,000 INIT (25% of total supply)** At the core of the Interwoven Economy is Initia's Enshrined Liquidity mechanism, which replaces the typical L1 PoS system. In Enshrined Liquidity, capital is put to effective use through liquidity provision. Users can simultaneously provide L1 economic security while earning staking rewards, trading fees, and external ecosystem incentives allocated for voting in VIP gauge votes. Initially, EL & staking rewards have a block-by-block release rate of 5% per year (12,500,000 INIT per year). Due to a [governance proposal](https://forum.initia.xyz/t/inflation-correction-and-unstaking-subsidy-plan/201/10) to fix inflation rate, the overall emission schedule has been shortened slightly to stay within the 250M INIT cap. ### Vested Interest Program (VIP) Rewards **250,000,000 INIT (25% of total supply)** The Vested Interest Program is Initia's novel incentive mechanism that aligns the interests of all participants in the Interwoven Economy. This includes application end users, application builders, and L1 stakeholders. These rewards are wholly allocated to the community of users. VIP rewards are distributed in escrowed form and can be vested through maintaining VIP KPIs over several epochs. Similar to staking rewards, VIP rewards have an initial release rate of 7% per year (17,500,000 INIT per year). ### Binance Launch Campaign **60,000,000 INIT (6% of total supply)** For the initial CEX liquidity bootstrapping, 6% of the total supply is allocated towards Binance's Launch Campaign. ### Airdrop **50,000,000 INIT (5% of total supply)** Initia's airdrop distributes 50,000,000 INIT tokens (5% of the total network supply) to network testers, advocates, and early contributors. These tokens are immediately available on genesis for eligible participants to claim. ### Echo.xyz Community Sale **10,000,000 INIT (1% of total supply)** Tokens in this category have been allocated to the community of users who participated in Echo.xyz's investment round. Tokens in this category unlock in four equal tranches 12/15/18/24 months post-genesis. ## Release Schedule The monthly and annual release schedules for the Initia token for the first four years are shown below. **Annual Release Schedule** <img alt="INIT Release Schedule Annual" /> **Monthly Release Schedule** <img alt="INIT Release Schedule Monthly" /> # High Level Architecture Source: https://docs.i
프로젝트로 돌아가기