The ‘chain’ GridScript 1.0 Utility

No Comment Yet

Introduction: Blockchain Technology and GRIDNET OS

Blockchain technology has revolutionized the way we conceive data, trust, and consensus. At its core, a blockchain is a type of distributed ledger that records transactions across many computers in such a way that the registered transactions cannot be altered retroactively. This immutability, along with features like decentralization and transparency, has led to widespread adoption of blockchain technology across numerous sectors.

In the context of the GRIDNET Operating System (OS), blockchain technology plays a pivotal role, providing the underlying mechanism that enables global consensus within the system.

Blocks are chained together through mathematics.

Global Consensus in GRIDNET OS

Global consensus refers to the state where all nodes in a distributed system agree on a single version of the truth, in this case, the state of the GRIDNET OS. This consensus is crucial for maintaining consistency across the decentralized system, ensuring every node in the network is operating with the same data and instructions.

The blockchain in GRIDNET OS functions as a decentralized state machine. Each block in the blockchain, beyond its role as a container of transactional data, also serves as a mechanism to either elect leaders (Key Blocks) or deliver instructions affecting the state of the system (Data Blocks).


By combining two types of blocks, GRIDNET OS has established a highly efficient consensus protocol that inherits many properties of the ‘Bitcoin NG’ consensus protocol. This design allows GRIDNET OS to maintain a very high throughput of processed instructions, providing the ability to handle a large volume of transactions with relative ease.

Efficiency and Throughput

Thanks to meticulous research and the innovative application of blockchain principles, GRIDNET OS boasts a very efficient consensus protocol. By combining elements of leader election and instruction delivery within the blockchain structure, GRIDNET OS has achieved high throughput. This efficiency is further boosted by the use of bytecode in Data Blocks, allowing for a concise yet powerful expression of state transitions.

Blockchain technology forms the backbone of the GRIDNET OS, enabling global consensus, efficient state transition, and high throughput. By leveraging the fundamental properties of blockchain, GRIDNET OS embodies a powerful and robust decentralized system.

Getting Started

Using the `chain` utility is an easy and straightforward process, thanks to its integration as a GridScript 1.0 command. As such, it’s accessible directly from the Virtual Terminal Interface (VTI) of GRIDNET OS.

Accessing The `chain` Utility

Through SSH

If you’re comfortable with using Secure Shell (SSH), you can access the GRIDNET OS’ Virtual Terminal and use the `chain` utility through it. Using your favorite SSH client, connect to the GRIDNET OS and enter your login credentials. Once logged in, you can use the `chain` command directly.

Through Terminal UI dApp

For a more user-friendly approach, especially if you’re not used to working with SSH, you can also access the chain utility through a web browser using the Terminal UI dApp. Simply navigate to the Terminal UI dApp on your GRIDNET OS, and you will have direct access to the Virtual Terminal. You can then enter and execute the `chain` command directly in the dApp.


In order to use the chain utility effectively, you should have a basic understanding of blockchain technology, as well as knowledge of the specific block you’re interested in investigating.

The primary piece of information you need is the “height” of the block. This refers to the position of the block in the blockchain, starting from the Genesis Block (height 0), and incrementing by one for each subsequent block. By knowing the height of the block, you can use the `chain` utility to view information about that particular block or its header, either from the ‘Heaviest’ or the ‘Verified’ chain-proof.

Once you are familiar with these concepts and have access to the Virtual Terminal Interface, you’re all set to start using the `chain` utility in GRIDNET OS.

Understanding the Blockchain on GRIDNET OS

The concept of the blockchain is integral to the functioning of GRIDNET OS. By representing a historical sequence of events, the blockchain aids in shaping the present state of GRIDNET OS’s decentralized state machine. This chapter elucidates the various facets of this intricate blockchain system.

And exchanged through UDT-based extremely fast data exchange protocol.

Overview of Blockchain

In simple terms, a blockchain is a continuously growing list of records, called blocks, which are linked and secured using cryptographic principles. Each block typically contains a cryptographic hash of the previous block, transaction data, and a timestamp. This design makes a blockchain resistant to data modification, as altering a single block would require changes in all subsequent blocks.

Understanding Key Blocks and Data Blocks

In GRIDNET OS’s blockchain, blocks are categorized into two distinct types: Key Blocks and Data Blocks.

    • Key Blocks: These blocks contain Proof-of-Work and are responsible for proclaiming a new leader in the blockchain. The leadership is determined by the entity that provides a solution to a complex computational problem, thereby ensuring fairness and resistance to malicious attempts. Once a Key Block is added to the chain, it can be followed by several Data Blocks signed with the same public key.
    • Data Blocks: Data Blocks are the carriers of transactional data. However, their primary function is to contain instructions that enable the decentralized state machine to transition into new states. This state-transition data forms the backbone of GRIDNET OS’s operations, effectively capturing the evolving global state of the system.

Understanding Chain-Proof: Heaviest and Verified

Within the GRIDNET OS environment, the sequence of blocks is maintained by a data structure called a ‘Chain-Proof’. Each node in the network holds two Chain-Proofs:

  • Heaviest Chain-Proof: This represents the sequence of events or blocks that has the most significant proof-of-work history known throughout the network. Nodes constantly share ‘partial chain-proofs’ to update the locally best-known ‘heaviest’ chain-proof. The Heaviest Chain-Proof guides the scheduling of block downloads from the network.
  • Verified Chain-Proof: The Verified Chain-Proof consists of blocks that have been downloaded, verified, and stored locally. Nodes present their world-view to each other based on this Verified Chain-Proof. Over time, the Verified Chain-Proof is expected to converge with the Heaviest Chain-Proof.

Understanding Genesis Block

The ‘Genesis Block’ refers to the very first block of the blockchain. This block serves as the foundation of the entire blockchain, setting the initial state from which all subsequent states evolve. In the context of GRIDNET OS, the Genesis Block has an index of 0.

Understanding these components forms the basis for effectively utilizing the `chain` utility, allowing users to delve into the intricacies of the GRIDNET OS’s blockchain with ease and precision.

Usage and Syntax

Understanding the syntax and usage of the `chain` utility is crucial for effective interaction with the blockchain of GRIDNET OS. This chapter will guide you through the general syntax of the command, the available options, usage of indices, and the differences between the `-verified` and `-heaviest` options.

General Syntax

The general syntax of the `chain` utility command is as follows:

chain [OPTIONS]

You start the command with the keyword `chain`, followed by one or more options. These options allow you to specify the type of operation you want to perform and target the desired object within the blockchain.

Available Options

Here are the options that you can use with the `chain` command:

        • show

          This option allows you to display information related to a specified object.

        • block [INDEX]

          This option targets an object of the ‘block’ type. It takes a numerical `[INDEX]` parameter, which denotes the index of the block in the chain-proof sequence.

        • header [INDEX]

          This option targets an object of the ‘header’ type. Similar to the `-block` option, it takes a numerical `[INDEX]` parameter to specify the index of the block in the chain-proof sequence.

        • verified

          This option indicates that the ‘verified’ chain-proof is to be used.

        • heaviest

          This option suggests the usage of the ‘heaviest’ chain-proof.

            Note: The `-block` and `-header` options can be combined together to check the local block availability.

Understanding Index Usage

Indices in the `chain` command are used to specify the position of a block within the chain-proof sequence. The index count starts from 0, which corresponds to the Genesis Block. Each subsequent block increases the index count by one.

Understanding the Difference Between ‘verified’ and ‘heaviest’

By default, the `chain` utility uses the Verified Chain-Proof. However, you can use the heaviest
option if you want to browse blocks in relation to the Heaviest Chain-Proof. The Verified Chain-Proof contains blocks that have been downloaded, verified, and stored locally, while the Heaviest Chain-Proof signifies the chain with the most significant proof-of-work history known to the network. The Heaviest Chain-Proof is typically used to schedule block downloads from the network.

In summary, understanding the syntax and usage of the chain utility command is key to browsing through the blockchain on GRIDNET OS effectively. Familiarizing yourself with these options will enable you to navigate through the blocks and headers with ease.

Examples and Use-Cases

This chapter will help solidify your understanding of the `chain` utility through concrete examples and use-case scenarios. Understanding these examples will provide you with a firm basis to use this utility in your own context.

Example Commands

1. Displaying Information about the Genesis Block

chain -show -block 0

This command displays information related to the Genesis Block, which is the first block in the blockchain (indexed at 0).

2. Displaying Information about a Specific Block in the Heaviest Chain-Proof

chain -show -heaviest -block 100

This command shows information about the 101st block in the Heaviest Chain-Proof. It also checks for local data availability of this block.

3. Displaying Information about a Specific Block in the Verified Chain-Proof

chain -show -block 50

This command shows information about the 51st block in the Verified Chain-Proof.

Use-case Scenarios

1. Verifying the Status of a Recent Transaction:

If you have recently performed a transaction and want to confirm its successful inclusion into the blockchain, you can use the `-block` option with the
chain command to inspect the specific block. This will provide information on the block and its constituent transactions, allowing you to verify the transaction status.

2. Comparing Chain-Proofs:

For advanced users or developers, comparing the Heaviest and Verified Chain-Proofs can provide valuable insights. The difference between the two can reflect network lag or potential issues with block verification. This can be achieved by using the-heaviest and -verified options along with theblock or header options.

3. Exploring Blockchain History:

For research or curiosity, one might want to explore historical blocks in the blockchain. This could be for studying transaction volumes, the evolution of proof-of-work, or the growth of the blockchain over time. In this scenario, the `chain` command provides an invaluable tool for this kind of exploration.

These examples and use-case scenarios should provide a strong basis for understanding the practical application of the
chain utility. The flexible and powerful features of the chain command make it a significant tool within the GRIDNET OS environment.

Sample Output

Let us present output of a sample command:

chain -show -block 0

The Holy Genesis Block

The sample output provided is the result of the command chain -show -block 0, which shows information about the Genesis Block (Block #0) of the GRIDNET OS blockchain. Here’s an analysis of each piece of information in the output:

  • Block #

    This indicates that the information presented relates to the Genesis Block, which is the first block in the blockchain.


    This is a unique identifier associated with the block. This string of characters is unique to this block and can be used to reference it.

  • Type

    The type of block is defined as a ‘Key Block.’ This means that this block contains proof-of-work and is involved in leader election within the blockchain consensus protocol.

  • Key Height

    This represents the position of the key block within the sequence of key blocks in the blockchain. A key height of 0 indicates this is the first key block.

  • Solved at

    This refers to the timestamp indicating when the computational problem related to this block’s proof-of-work was solved.

  • Miner's ID

    This is the unique identifier of the entity (node or miner) that successfully solved the computational problem, and therefore, was able to add this block to the blockchain.

  • Difficulty

    This value represents the computational difficulty of the problem that needed to be solved to add this block to the blockchain. The higher the number, the harder the problem was to solve.

  • Parent ID

    This value references the ID of the block that immediately precedes this one in the blockchain. Since this is the Genesis Block, its parent ID is 0.

  • ERG used

    This represents the amount of computational energy used to generate this block. For the Genesis Block, this value is 0.

  • ERG limit

    This indicates the maximum amount of computational energy that could be used to generate this block. For the Genesis Block, this value is also 0.

  • Nonce

    This is a one-time number used in the computational problem that was solved to generate this block. It is part of the proof-of-work system.

  • Reward

    This denotes the reward received for mining the block. For the Genesis Block, the reward is listed as ‘unknown.’

  • Total Reward

    This is the cumulative reward, including the block reward and any transaction fees. In this case, it appears to be 20 billion units.

  • Receipts #

    This represents the number of receipts included in the block. Receipts are records of successful transactions.

  • Transactions #

    This is the count of transactions included in this block. In the Genesis Block, this count is 0.

  • Verifiables #

    This refers to the count of verifiable elements in the block, these are special types of elements. The main rationale behind ‘Verifiables’ is to allow for verification of data, through the decentralized consensus, data which might be coming say from Cyber-Physical Systems’ elements such as data from Power Meters.

By understanding each piece of information in this output, you can gain a thorough understanding of the properties and state of the Genesis Block in the GRIDNET OS blockchain.

Exploring Further and Leveraging Man-Pages

The `chain` utility is a powerful tool in the GRIDNET OS environment, allowing you to navigate and understand the underlying blockchain that powers the system. By combining the information presented in this documentation with practical application, you should have a robust understanding of how to use this utility to interact with the blockchain on GRIDNET OS effectively. While this documentation aimed to provide a comprehensive guide to the `chain` utility, it’s worth noting that the built-in man-pages of GridScript 1.0 utilities remain a valuable resource for users as these are to be updated with each update to this user-mode utility. These manual pages provide quick, accessible, and up-to-date information about each utility, including the `chain` utility.


For instance, by invoking the `chain –help` command, you’ll be shown a man page that may provide additional, useful functionalities not covered in this guide. One such functionality is the ability to view the most recent block within a given chain-proof without knowing its specific index. All you need to do is provide ‘recent’ as the `[INDEX]` parameter. For example, executing `chain -show -block recent` would display information regarding the most recent block in the Verified Chain Proof.


Understanding and leveraging these tools will significantly enhance your user experience on the GRIDNET OS, allowing you to fully benefit from the power of blockchain technology and its application in this innovative operating system. The `chain` utility, alongside other GridScript 1.0 tools, forms a robust arsenal for interacting with the GRIDNET OS’s blockchain, offering a variety of functionalities for different user needs. We encourage all users to explore these tools and their manual pages to make the most of the GRIDNET OS experience.




Up Next

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *