Entangling Z-DAG Technology with SysCoin

Written by michielmulders | Published 2019/07/22
Tech Story Tags: blockchain | cryptocurrency | dag | blockchain-technology | blockchain-development | directed-acyclic-graph | latest-tech-stories | hackernoon-top-story

TLDR A directed acyclic graph (DAG) is a probabilistic transaction scheme that allows for one to separate micro/macro transactions with different security domain tradeoffs in exchange for convenience. Z-DAG allows merchants to decide whether to accept or decline a DAG transaction based on their preference. A DAG can be compared with a tree which grows in several separate branches. It has an interesting structure similar to a tree where every transaction has to verify two prior transactions. This division in branches allows for a higher TPS than regular blockchain technology.via the TL;DR App

Disclosure: This article is sponsored by Syscoin to sustain my blockchain innovation series. I'm not part of Syscoin or hold/receive any Syscoin tokens.
This article is part of my blockchain innovation series where I try to spot interesting technology that might impact the further development of blockchain. Today’s innovation talks about a directed acyclic graph (DAG) technology and how Syscoin gave a twist to this concept with their Z-DAG implementation.
  • What is DAG technology?
  • What is Z-DAG?
  • How is Z-DAG different from a regular DAG?
  • What is zero-confirmation in relation to DAG Technology?
  • Techniques Syscoin Uses for Optimizing Transaction Throughput

DAG: A Buzz or Breakthrough?

If we simplify how blockchain works, we can compare it with a staircase. Each block you add is a new level on top of your staircase. So, your staircase grows vertically in a single direction.
Staircase levels are stacked one at the time. This guarantees that the same transactions are recorded across all nodes in the network. In case a node decides to propose a malicious block or malicious transactions, your staircase would violate the “protocol” rules defined for building staircases.
On the other side, a DAG can be compared with a tree which grows in several separate branches. Transactions are processed in a network of interlocking branches that grow outwards in multiple directions. 
The validation in a DAG is also quite different from a standard blockchain. Each newly added transaction to a branch is responsible for validating two previous transactions (depends on the protocol definition). If the transaction does not follow this guideline, it is impossible to be valid itself.
It might sound like a weak requirement to only validate the two previous transactions. However, by validating the two previous transactions you are actually validating a whole branch of transactions connected to this last transaction.
Source image: A simple DAG by Vasa
Due to this division in branches, a DAG is able to confirm transactions much faster reaching very high speeds. I’m not gonna mention exact numbers as a lot of projects claim to have reached very high transaction throughput (TPS). But one thing is for sure, a DAG allows mostly for a higher TPS than regular blockchain technology.
In short, a DAG is a very promising technology that allows for a higher TPS to be reached. It has an interesting structure similar to a tree where every transaction has to verify two prior transactions.
In case you want to learn more about DAG technology, fellow writer Vasa wrote an amazing post going deeper into the DAG variations and its properties.

What is Z-DAG Technology?

Now we know what a DAG is, let’s explore what kind of beast Syscoin has built, naming it Z-DAG. 
According to Whiteblock CEO Zak Cole, “The Z-DAG protocol is extremely innovative and presents a practical solution for many of the performance issues that are currently bottlenecking the continued scalability of blockchain systems.”
Let’s find out what is true about this statement!

Diving into Z-DAG Technicals

Zero-Confirmation Directed Acyclic Graph (Z-DAG) is a probabilistic transaction scheme that allows for one to separate micro/macro transactions with different security domain tradeoffs in exchange for convenience.
Whereas Bitcoin applies PoW scheme on top of every micro or macro transaction, Z-DAG allows an interactive protocol for merchants to decide. Every merchant can accept or decline a Z-DAG transaction based on their preference.
Every Z-DAG transaction that has entered the mempool and has some type of probabilities that it will get mined in the future since balances are tracked in real-time and not upon PoW.
Upon PoW, however, the state is removed and reproduced based on the block. Because balances are updated in real-time based on transactions in mempool, it is a probabilistic model so the ultimate truth will be what the miners put into the block and what the block of transactions that has Proof of Work on it has in terms of which transactions get mined.
Once miners mine a block, the state is replayed based on the state of the previous block. Thus, the probability model around Z-DAG settlement is the likelihood that transactions in the mempool and their balances accurately reflect the truth once miners create and forward blocks to the network. The balances have a high probability of being the same as when they first entered the mempool and settled via ZDAG.
This means PoW is ultimately the partition tolerance in the system and the idea is that the view of the network and view of the miner is essentially the same after X seconds where X can be a reasonable amount of time before a transaction is propagated across the network.
For now, they have chosen for 10 seconds for the reference client but it can come down as networks are exponentially increasing in efficiency and this can organically be tending towards 0.

How is Z-DAG different from a regular DAG?

Regular DAG protocols do not rely on Proof-of-Work. These protocols include uncles or historical information to keep the graph from dissolving. There is typically no longest-chain-rule with DAGs as it is based on the probability that transactions are ordered based on the historical information provided.
However, that comes with some problems. There is little to no partition tolerance which is why there is sometimes central or authoritative models to ensure the DAG doesn’t steer off course (referring to IOTA).
With Z-DAG, the partition tolerance is around every block. For every block, the balances are set based on validating each transaction in a block. Therefore, the DAG cannot dissolve as it is only based on what happens within a block. This serves the purpose for a micro-transaction layer 0 solution on top of Proof-of-Work, ultimately settling transactions just like Bitcoin.

What is zero-confirmation in relation to DAG Technology?

“Z-DAG (Zero-Confirmation Directed Acyclic Graph) is an instant settlement protocol that is used as a complementary system to proof-of-work (PoW) in the confirmation of Syscoin service transactions. In essence, a Z-DAG is simply a directed acyclic graph (DAG) where validating nodes verify the sequential ordering of transactions that are received in their memory pools.” — Syscoin Whitepaper p.1
So, how does this tie back to a DAG? A DAG is a natural construction of transactions with dependencies on balances for dependability. In Bitcoin this dependence is affected after a block, in Syscoin it is affected upon mempool inclusion on every node. 
It is important to note that Satoshi wrote about a snack machine example where about 3 seconds is needed to detect a double spend. In the Syscoin implementation, they increased this time slot to 10 seconds but the real-time balances are adjusted and one can spend in a chain of transactions based on their balances, creating a natural DAG that is resolved every block. 
In Syscoin v3, they enforced the order of the DAG by doing topology sort and circuit detections. However, in Syscoin v3, this is not really needed because balances are strictly enforced and clients will not allow invalid transactions to be created in a block that would overflow a balance.

Techniques Syscoin Uses for Optimizing Transaction Throughput

Let’s take a look at some technical implementations Syscoin has implemented to improve the transaction speed of the overall network.

1. Parallel Signature Verification

First of all, whenever a node receives a newly broadcasted transaction, it will relay the transaction to other nodes before validating it. This means that also potentially invalid transactions are broadcasted to the rest of the network. However, this approach allows for more transactions to be validated quicker. A couple of invalid transactions have minimal impact on the overall throughput of the network.
This multithreaded approach greatly reduces the time it takes for signatures to be verified.
How to Prevent for Double Spends?
Users choose the time they want to wait and as they wait longer and check the status of their transactions, it is more likely they will detect and not complete the transaction with the buyer in a point of sale application.
Syscoin recommends that 10 seconds is a good amount of time to wait for a transaction to arrive at your node before checking if it's valid. Of course, it's up to the merchant as it’s an interactive protocol. 
Also, balances are tracked throughout the system to detect two spends that overflow the balance. If this occurs, the sender will be flagged and the receiver will be able to see something went wrong.

2. Flagging Invalid Signatures

Syscoin has a protocol in place that will flag a signature as invalid whenever the signature validation check fails in the multithreaded verification process. This flag causes the network to switch back to a single threaded mode in order for other nodes to not waste valuable time and resources on validating an invalid transaction.

3. Sub-linearly Scaling Transaction Throughput

Syscoin’s whitepaper explains that a master node can scale to 700–1000 transactions per second (TPS) on average. This number is calculated with latency effects taken into account.
However, when 100 of these master nodes are active, the whitepaper talks about a possible TPS of 70k.
I questioned them about this statement to find out how this works. Jag Sidhu, the Lead Core Developer and co-founder, explained to me how this scaling works. “It would be a sub-linear increase in efficiency as more nodes enter and an exponential decrease in the effect of latent nodes on the overall functioning of ZDAG on the network. As more paths open up, latent nodes will trail messages where with fewer nodes, higher risk of depending on a latent node for information.

Competitors of Syscoin

Any DAG project is considered to be a competitor for Syscoin. Let's take a look at the competition.
Nano
Nano is also able to reach very high transaction speed as they leverage DAG technology. Nano has developed a new piece of technology called block-lattice that allows them to leverage DAG technology but still work like a traditional blockchain.
Nano works with nodes that all act as an individual wallet or chain. Only the node owner can make changes to these individual chains which means they can be updated asynchronously.
  • Fast transaction speed by block-lattice
  • Zero transaction fees

Byteball

Byteball is one of the older projects in the blockchain space. Unlike Nano, transactions are not free on the Byteball chain. However, Byteball offers the feature of having fully private and untraceable transactions.
  • Transaction verification in 30 seconds
  • 51% attack impossible due to validator system to avoid double spends
  • Private transactions

IOTA

IOTA is also one of the first DAG projects, or more know as Tangle. A new transaction can be added to the network if you first verify the two previous transactions (actually building the tangle). This means that they offer instant transactions which are zero fee.
The main idea for IOTA is to build a DLT infrastructure for machine to machine payments, enabling economy 4.0 where smart machines communicate with each other and create a whole economy by itself. IOTA allows for micro transactions and can handle a high throughput.
  • Zero fee transactions
  • Developed for IOT (machine to machine)
  • Enables micro transactions

Hedera Hashgraph

Hedera Hashgraph might be an odd one in the list as it is a patented technology. You can buy licenses to use the software.
Hedera also uses DAG technology and gained attention with their gossip about gossip protocol. As this is too complex to explain for this article, you can find a podcast here.

Drawbacks of Syscoin

In general, many DAG projects have proven that they can handle very high transaction amounts. Often, much higher than a traditional blockchain. However, DAG technology is still in its infancy and there are still many questions about its performance and how decentralised they actually are.
Specifically to Syscoin, whenever a node receives a newly broadcasted transaction, it will relay the transaction to other nodes before validating it. This means that also potentially invalid transactions are broadcasted to the rest of the network. It is not sure how this can impact the network if high volumes of invalid transactions are broadcasted to the network.
Also, Syscoin waits 10 seconds for a transaction to arrive before checking its validity. It would be nice if they could provide some more quantitive arguments to back up this "10 seconds rule".
In short, I feel that the Syscoin network should be stress-tested a bit more to really figure out how well their protocol works. Let's hope for the best!

Conclusion

DAG technology has shown some great potential in many projects like Nano, Byteball, and now Syscoin. It mostly allows for a higher transaction throughput than a regular blockchain project. 
In short about Syscoin, it holds some innovative technical approaches to increase their transaction throughput. The most interesting one is the parallel signature validation. Let’s see how this innovative approach entangles itself in the future.

Written by michielmulders | Technical & marketing writer | Blockchain & backend developer
Published by HackerNoon on 2019/07/22