4️⃣Algorithm 4

The tree update function, parameterized by q, D and hash functions H(Β·), G(Β·). The inputs are a block tree T and an array of blocks.

  1. function update(T,B)

  2. foreach hs, x, ctri in T

  3. foreach hs 0 , x0 , ctr0 i in B

  4. if ((s 0 = H(ctr, G(s, x))) (H(ctr0 , G(x 0 , ctr0 )) < D)) then

  5. childrenT (hs, x, ctri) = childrenT (hs, x, ctri) U hs 0 , x0 , ctr0 i . Add to the tree.

  6. end if

  7. return T

  8. end function

Algorithm 4 Explained:

To make the concepts of persistence and liveness relevant to the manner in which parties confirm transactions, we slightly modify them. A transaction is β€˜stable' in Bitcoin, for instance, if it is at least k blocks deep in the chain and has the parameter k. On the other hand, for a transaction to be deemed "stable" in GHOST, the subtree rooted at the block containing the transaction must be at least k in size. From this point on, whenever we discuss the longevity or persistence of Bitcoin or GHOST, we'll be referring to the parameterized versions with the corresponding definitions of stability that we just discussed.

Last updated