getProtocol

Tezos RPC

Archive Method

Only on the full archive nodes. Complex queries might take longer and incur additional cost

Overview

The getProtocolByHash method retrieves information about a specific Tezos protocol based on its protocol hash. You can use this method to obtain details about the environment the protocol relies on and its components.

How to use it

Here's a sample code snippet in TypeScript to call the getProtocolByHash method using the Tatum SDK:

// Import required libraries and modules from Tatum SDK
import { TatumSDK, Tezos, Network } from '@tatumio/tatum';

// Initialize the Tatum SDK for Tezos
const tatum = await TatumSDK.init<Tezos>({ network: Network.TEZOS });

// Define the protocol hash for the protocol you want to retrieve information about
const protocolHash = { protocolHash: 'YOUR_PROTOCOL_HASH' };

// Call the getProtocolByHash method to retrieve information about the protocol
const protocolInfo = await tatum.rpc.getProtocolByHash(protocolHash);

// Log the protocol information
console.log('Protocol Information:', protocolInfo);

// Always destroy the Tatum SDK instance when done to stop any background processes
tatum.destroy();

Example Use Cases

  1. Protocol Version Information:
    Developers can use this method to fetch details about a specific Tezos protocol version based on its protocol hash.

  2. Protocol Analysis:
    Researchers and analysts can use this method to study the environment and components of a particular protocol for research or auditing purposes.

Request Parameters

  • Protocol_hash (string, required):
    The protocol hash of the Tezos protocol you want to retrieve information about.

Return Object

The getProtocolByHash method returns an object with the following properties:

  • expected_env_version (string): The expected environment version of the protocol.

  • components (array of objects): An array of components that make up the protocol, where each component has the following properties:

    • name (string): The name of the component.
    • interface (string): The interface of the component.
    • implementation (string): The implementation of the component.

    (Note: The exact fields in the return object might vary based on the Tezos blockchain's implementation and version.)