Gravity 백서

Gravity

원문

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

mainnet-l2/bridge-back-to-ethereum). {% endhint %} > **Legacy.** This page documents third-party oracle integrations from the legacy **Gravity Alpha Mainnet (L2)**. **Gravity Mainnet (L1)** is integrating a range of oracle services; for now the protocol-level [**Native Oracle**](/research-and-development/native-oracle) — validator-attested external data with consensus-grade security — is supported by default. ## Overview Blockchain oracles act as bridges between smart contracts and real-world data. They provide essential off-chain information such as price feeds, random numbers, and event outcomes that blockchains cannot access natively. Oracles vary in design, with some using push models (regular on-chain updates) and others using pull models (on-demand data requests). The quality of an oracle is measured by its speed, accuracy, cost-efficiency, and security against manipulation. ## Third-Party Oracles ### Pyth The [Pyth Network](https://pyth.network/) is the largest first-party Oracle network, delivering real-time data across [a vast number of chains](https://docs.pyth.network/price-feeds/contract-addresses). Pyth introduces an innovative low-latency [pull oracle design](https://docs.pyth.network/documentation/pythnet-price-feeds/on-demand), where users can pull price updates on-chain when needed, enabling everyone in the blockchain environment to access that data point most efficiently. Pyth network updates the prices every 400ms, making Pyth the fastest on-chain oracle. Users can also opt to use push model oracles through Pyth by running a [scheduler](https://docs.pyth.network/price-feeds/schedule-price-updates/using-scheduler). Pyth Oracle Features: * 400ms latency * Most efficient and cost-effective Oracle * [First-party](https://pyth.network/publishers) data sourced directly from financial institutions * [Price feeds ranging from Crypto, Stock, FX, Metals](https://pyth.network/developers/price-feed-ids) * [Available on all the largest chains](https://docs.pyth.network/price-feeds/contract-addresses) Check out the following links to get started with Pyth. * [Pyth EVM Integration Guide](https://docs.pyth.network/price-feeds/use-real-time-data/evm) * [Pyth Docs](https://docs.pyth.network/home) * [Pyth API Reference](https://api-reference.pyth.network/price-feeds/evm/getPrice) * [Pyth Examples](https://github.com/pyth-network/pyth-examples) * [Pyth Price Feed Ids](https://pyth.network/developers/price-feed-ids) * [Website](https://pyth.network/) * [Twitter](https://x.com/PythNetwork) # Indexers (legacy L2) {% hint style="danger" %} **Legacy network — bridge out before November 1, 2026.** Gravity Alpha Mainnet (L2) is being deprecated in favor of [Gravity Mainnet (L1)](/gravity-networks/l1-mainnet) and will be unsettled in **December 2026**. Move all assets back to Ethereum before **November 1, 2026** — see [Bridge Assets back to Ethereum](/legacy-alpha-mainnet-l2/bridge-back-to-ethereum). {% endhint %} > **Legacy.** This page documents The Graph on the legacy **Gravity Alpha Mainnet (L2)** — the `gravity-mainnet` subgraph listed below. It does not apply to Gravity Mainnet (L1). ## Overview Blockchain indexers are specialized tools or services that extract, process, and organize data from blockchain networks, transforming it into formats that are easily queryable and accessible for developers and applications. Given that blockchain data is inherently decentralized and stored in a sequential manner, retrieving specific information can be challenging. Indexers address this by creating structured databases or APIs, enabling efficient data retrieval and analysis. ## Indexers ### The Graph The Graph is a decentralized indexing protocol that allows developers to build and publish open APIs, known as subgraphs, which applications can query using GraphQL. Indexers in The Graph Network operate nodes that index these subgraphs and serve queries, earning rewards for their services. #### Supported Networks | Network | ID | Documentation | | --------------------------------- | ----------------- | --------------------------------------------------- | | Gravity Alpha Mainnet (legacy L2) | `gravity-mainnet` | [View Documentation](https://thegraph.com/docs/en/) | # Gravity Name Service (legacy L2) SPACE ID Web3 Name SDK (legacy Gravity Alpha Mainnet, L2) {% hint style="danger" %} **Legacy network — bridge out before November 1, 2026.** Gravity Alpha Mainnet (L2) is being deprecated in favor of [Gravity Mainnet (L1)](/gravity-networks/l1-mainnet) and will be unsettled in **December 2026**. Move all assets back to Ethereum before **November 1, 2026** — see [Bridge Assets back to Ethereum](/legacy-alpha-mainnet-l2/bridge-back-to-ethereum). {% endhint %} > **Legacy.** This page documents the SPACE ID `.g` name service on the legacy **Gravity Alpha Mainnet (L2, chain ID `1625`)** — the chain ID used in the resolution examples below. ### Overview[​](https://docs.manta.network/docs/manta-pacific/Space%20ID#overview) The primary capabilities of the SDK include: 1. Domain Name Resolution: It resolves domain names to obtain essential information about the domain, including its associated conventional address, various records (such as avatars, IPFS links, social data), and metadata, etc. 2. Reverse Resolution: The SDK facilitates reverse address resolution. This feature makes it possible to determine the primary domain name associated with a given address, even across different blockchains or TLDs, returning Chain Primary Name or TLD Primary Name. #### Key Terminology: TLD Primary Name: * Every address is able to set TLD Primary Name to configure a reverse resolution domain for each Top-Level Domain, regardless of whether it has been verified or not on SPACE ID. * Examples include setting "charles.eth" as TLD Primary Name for .eth, "charles.g" for .g, "charles.bnb" for .bnb. Chain Primary Name: * Each address is permitted to have only one unique Chain Primary Name for each blockchain or network. * Specifically, when multiple TLDs verified on a single chain exist, only one domain name can be chosen as such reverse resolution domain for that particular chain. * For instance, "charles.eth" could serve as Chain Primary Name for Ethereum, and "charles.g" might function as the primary name for Gravity Chain. By default, all EVM-based domain names are supported for domain resolution in the Web3 Name SDK. Reverse resolution returns a Chain Primary Name for each EVM chain. Project administrators have the flexibility to choose whether to integrate support for all or only specific chains and TLDs. They can also configure custom settings for reverse resolution as needed. This adaptability allows projects to tailor the SDK's functionality to their specific requirements. ## Get Started[​](https://docs.manta.network/docs/manta-pacific/Space%20ID#get-started) Developers can resolve web3 domain name or reverse resolve conventional address with Web3 Name SDK with zero configuration. ### Install[​](https://docs.manta.network/docs/manta-pacific/Space%20ID#install) npm install @web3-name-sdk/core viem@^1.20 If you are using next.js, please add the following configuration in your next.config.js in order to transpile commonjs dependencies: ``` const nextConfig = { transpilePackages: ["@web3-name-sdk/core"], }; ``` #### 1. Setup client ``` import { createWeb3Name } from "@web3-name-sdk/core"; const web3Name = createWeb3Name(); ``` #### 2. Resolve a domain name[​](https://docs.manta.network/docs/manta-pacific/Space%20ID#2resolve-a-domain-name) You can get address from domain name with a single request: ``` const address = await web3name.getAddress("gravity.g"); const address = await web3name.getAddress("bts_official.lens"); const address = await web3name.getAddress("beresnev.crypto"); const address = await web3name.getAddress("registry.g"); ``` #### 3. Resolve an address[​](https://docs.manta.network/docs/manta-pacific/Space%20ID#3-resolve-an-address) There are optional parameters in the method to select your target chain or TLD (top-level Domain). By providing chain IDs, you can resolve addresses on selected chains and get an available domain name from all TLDs deployed on these chains. ``` // Resolve an address from Gravity Chain const name = await web3name.getDomainName({ address: "0x2886d6792503e04b19640c1f1430d23219af177f", queryChainIdList: [1625], }); ``` By providing TLDs, address can be resolved from the selected TLDs and get an available TLD primary name. ``` // Resolve an address from .g TLD const name = await web3name.getDomainName({ address: "0x2886d6792503e04b19640c1f1430d23219af177f", queryTldList: ["g"], }); ``` #### 4. Record[​](https://docs.manta.network/docs/manta-pacific/Space%20ID#4-record) Domain text records can be fetched by providing domain name and the key. For example, the avatar record of gravity.g is returned from this method given key name avatar: ``` // const record = await sid.getDomainRecord({ name: "gravity.g", key: "avatar", }); ``` #### 5. Metadata[​](https://docs.manta.network/docs/manta-pacific/Space%20ID#5-metadata) Domain metadata can be fetched by SDK directly. ``` // requesting const metadata = await web3Name.getMetadata({ name: "public.g" }); ```
프로젝트로 돌아가기