Hyperlane Bridge Creation Part 2

This instruction provides a detailed overview of how to use Hyperlane Registries and explains how developers can interact with and contribute to them. Key...

Hyperlane Bridge Creation Part 2

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1727318678281/62cfd83f-59c3-4a5a-9ed6-c3fba4be1a88.png align=“center”)

This instruction provides a detailed overview of how to use Hyperlane Registries and explains how developers can interact with and contribute to them.

Key Points:

  1. Purpose of Registries:

    • Hyperlane allows anyone to deploy contracts on any chain. However, for these deployments to be useful, the necessary details (chain metadata, contract addresses, etc.) must be known.

    • Registries are collections of this important information. There is an official registry maintained by the Hyperlane core team, which provides the core information needed for interacting with Hyperlane contracts.

  2. Canonical Registry:

    • The canonical registry is maintained by Hyperlane’s core team, and it holds the official metadata for their deployments. This registry can be accessed via their GitHub repository.

    • Developers and community members can also contribute to this canonical registry by following these steps:

  3. Custom Registries:

    • Users can create and maintain their own custom registries. These custom registries should follow the same format and structure as the canonical registry.

    • To use a custom registry:

      • You can use the --registry flag in the CLI to set the path to your custom registry.

      • You can also use the --overrides flag if you want to customize specific data, such as overriding the default metadata or RPC URL.

    • After you’ve finished adding or updating data in your custom registry, you can test it. If useful, consider opening a PR to the canonical registry to benefit the wider community.

  4. Installation & Usage in Javascript/Typescript:

    • To use Hyperlane’s registry in your project, you can install the package using npm or yarn:

      npm install @hyperlane-xyz/registry
      # Or
      yarn add @hyperlane-xyz/registry
    • There are two ways to access registry data:

      • Static Data Access: You can directly import chain metadata and contract addresses from the package:

        import { ethereum, ethereumAddresses } from '@hyperlane-xyz/registry';
      • Dynamic Data Access: If you need real-time data, you can use the GithubRegistry class to fetch data directly from GitHub:

        import { GithubRegistry } from '@hyperlane-xyz/registry';
        const registry = new GithubRegistry();
        const chainMetadata = await registry.getMetadata();

In summary, Hyperlane provides a system for registering important metadata about chain deployments. The canonical registry is maintained by the Hyperlane team, but anyone can contribute to or create their own registries as long as they follow the standard format. Additionally, developers can use Hyperlane’s registry tools and data in their Javascript/Typescript projects for easier access and interaction.

Jadeofwallstreet

Tutorials, technical deep-dives, and thoughts on Web3 and software.

Comments

Loading comments...