Skip to main content

Z-DAG Developer Guide

Z-DAG is a patent-pending transaction technology implemented on the Syscoin blockchain that enables near-instant, low-cost transactions that are highly scalable. Z-DAGs transactional throughput has been audited by third party blockchain auditing firm Whiteblock, you can view their report here. For more technical information on Z-DAG refer to the Z-DAG Syscoin Community page or the Syscoin Z-DAG Whitepaper.

Z-DAG Basics#

Z-DAG is an interactive protocol, meaning you can continue to check the Z-DAG status all the way up to the point of blockchain confirmation. In today's network conditions a minimum Z-DAG threshold of 10 seconds or later are typically secure (99.9999%). Within certain enterprise deployments lower Z-DAG thresholds can be considered secure dependent on network conditions.

A typical transaction workflow has 2 stages:

  1. The transaction enters the mempool (unconfirmed).
  2. The transaction is mined into a block (confirmed).

When using Z-DAG, there are 3 stages:

  1. The transaction enters the mempool (unconfirmed).
  2. After a predefined Z-DAG threshold time the interactive protocol is called and returns a Z-DAG status.
  3. The transaction is mined into a block (confirmed).

When step 2 returns a Z-DAG status of 0 (after the Z-DAG threshold) that means the SPT can be re-spent without the risk of double-spends. Longer Z-DAG thresholds provide a higher level of security. When transactions are in a Z-DAG state available balance for re-spending should be determined using the Z-DAG balance.

Understanding Z-DAG Statuses#

Z-DAG status is retrieved by the command assetallocationverifyzdag. The output will reflect one of the following status levels:

StatusDescription
-1NOT FOUND (transaction is already confirmed on-chain, or is not a Z-DAG transaction)
0OK
1WARNING (there are more spending balances than the current POW sender balance in the mempool. An active stance should be taken and perhaps a deeper analysis as to potential conflicts related to the sender.)
2CRITICAL (an active double spend was detected. Any descendant asset allocations are flagged as dangerous and should wait for POW confirmation before proceeding.)

Using Z-DAG Balances#

The available balance while use Z-DAG can be determined by calling assetallocationbalance. If balance and zdag_balance are the same, then display balance. If the balances differ that is an indication that Z-DAG is active for this transaction and it has not yet been confirmed by Proof of Work. In this scenario the zdag_balance should be used to indicate to the user their available balance.