Open / Closed Blocks in the UniDAG dagchain

Yevhenii Doshyn
UniDAG project
Published in
4 min readJul 7, 2018

An open block is a block with the possibility of additional entry into its header, closed — without this possibility. This feature is a significant advantage compared to the technology of blocking, as it provides a huge number of options for using dagchain where the use of blockchain is meaningless due to practical limitations. The essence of this process is that in the header of the block, “places” are reserved for recording the hashes of subsequent blocks. The number of these “places” directly depends on the initially established number of edges (interconnections).

For clear understanding, please, read documents about dagchain technology in this publication

On the example of the dagchain, where the number of edges is 2 (which is taken as a basis in the UniDAG project), let consider a step-by-step construction of the chain of blocks.

1Automatically creates the first 2 “genesis” blocks of the chain. Their headers don’t have the option of additional recording, hence they are closed blocks.

creating “genesis” 2 blocks

2When adding the next block (# 3):

  1. It checks the correctness of the recorded hashes in the headers of the two previous blocks, and they are written in their own header.
  2. The hash sum of the data of the own block is calculated and written to the header.
  3. The hash sum of all records in the header of the block is calculated and written to the header as the hash of the entire block.
  4. In the header of the block, a certain amount of data is reserved for hashes of the next two blocks. This value depends directly on the initially selected parameters of the dagchin. In this way, block # 3 is being opened.
adding block №3

3When adding the next block (# 4):

  1. The correctness of the recorded hashes in the headers of the two previous blocks is checked and written in their own header.
  2. The hash sum of the data of the own block is calculated and written to the header.
  3. The hash sum of all records in the header of the block is calculated and written to the header as the hash of the entire block.
  4. In the header of the block, a certain amount of data is reserved for hashes of the next two blocks. There is the opening of the block # 4.
  5. The header of block # 3 records the hash sum of block # 4. Block # 3 remains open.
adding block №4

4When adding the next block (# 5):

  1. It checks the correctness of the recorded hashes in the headers of the two previous blocks, and they are written in their own header.
  2. The hash sum of the data of the own block is calculated and written to the header.
  3. The hash sum of all records in the header of the block is calculated and written to the header as a hash of the entire block.
  4. In the header of the block, a certain amount of data is reserved for hashes of the next two blocks. Opening of the unit block # 5.
  5. The header of block # 4 records the hash sum of block # 5. Block # 4 remains open.
  6. The header of block # 3 records the hash sum of block # 5. Thus, block # 3 is closed.
adding block №5

5When adding the next block (# 6):

  1. The correctness of the recorded hashes in the headers of the two previous blocks is checked and written in their own header.
  2. The hash sum of the data of the own block is calculated and written to the header.
  3. The hash sum of all records in the header of the block is calculated and written to the header as a hash of the entire block.
  4. In the header of the block, a certain amount of data is reserved for the hashes of the next two blocks. Opening of the unit block # 6.
  5. The header of block # 5 records the hash sum of block # 6. Block # 5 remains open.
  6. The header of block # 4 records the hash sum of block # 6. Thus, block # 4 is closed.
adding block №6

7Items 3, 4, 5 are cyclically repeated for all subsequent blocks.

This construction scheme is an example and can be supplemented, or modified in individual cases. In addition, it should be noted that this functionality can be used for dagchain with any number of relationships, but requires a thorough understanding of its essence.

To know more about dagchain technology and project UniDAG, please, read this publication or visit unidag.com

--

--