# NeuChain+: A Sharding Permissioned Blockchain System with Ordering-Free Consensus
## 5 Cross-Shard Transaction Processing Protocol
### Transaction Conflict Detection  
NeuChain+ transactions are executed based on serializable snapshot isolation [43] (SSI), allowing multithreaded concurrent execution within each block server. To ensure the serializable isolation level, it is necessary to perform concurrency control for potential transaction conflicts. After the above processing, each block server holds a complete reserve table containing accounts involved in cross-shard transactions. NeuChain+ performs conflict detection based on the reserve table and commits or aborts transactions based on deterministic concurrency control rules. As shown in Table 2, according to the different serializable orders of transaction execution in the same epoch, the potential conflicts are categorized into three types: write-after-write (WAW) dependency, read-after-write (RAW) dependency, and write-after-read (WAR) dependency. There are two transactions \(T_{1}\) and \(T_{2}\), which are ordered by _tid_ such that \(T_{1}\) precedes \(T_{2}\) in a serializable order. As described in Table 2, WAW and RAW may cause errors, since it is necessary to abort a transaction to remove the dependency. As illustrated in Algorithm 3, based on the reserve table, NeuChain+ detects conflicts between transactions and deterministically commits or aborts transactions through concurrency control. If the write operation of transaction \(T\) involves an account that has been overwritten by a transaction with a smaller _tid_ (WAW dependency), then transaction \(T\) is aborted (Lines 3-4). If the read operation of transaction \(T\) involves an account that has been modified by a transaction with a smaller _tid_ (RAW dependency), then \(T\) also needs to be aborted (Lines 6-7). All other transactions (WAR dependency and no dependency) are committed (Line 8). However, for the transactions with RAW dependency but no simultaneous WAR dependency, it can be ensured that there are no cyclic dependencies among transactions. Therefore, such transactions can be committed by reordering [45] transactions. For example, there are three transactions \(T_{1-3}\) (the sequence number is the serializable execution order) and accounts \(A\), \(B\), and \(C\). \(T_{1}\) reads \(A\) first and then writes \(B\), \(T_{2}\) reads \(B\) first and then writes \(C\), and \(T_{3}\) reads \(B\) first and then reads \(C\). After detecting conflict (Algorithm 3), \(T_{2}\) and \(T_{3}\) have a RAW dependency on \(T_{1}\), and \(T_{3}\) also has a RAW dependency on \(T_{2}\). These three transactions are converted into WAR dependencies by reordering, and all are committed. Another situation is that \(T_{1}\) reads \(A\) first and then writes \(B\), \(T_{2}\) writes \(A\) first and then reads \(C\), and \(T_{3}\) reads \(B\) first and then writes \(C\). After detecting conflict, \(T_{3}\) has RAW dependence on \(T_{1}\) and WAR dependence on \(T_{2}\), and \(T_{2}\) has WAR dependence on \(T_{1}\). In this case, if we reorder the transactions to convert \(T_{3}\)'s RAW dependence on \(T_{1}\) into WAR \begin{table}
\begin{tabular}{l l l} \hline \hline
**Type** & **Description** & **Error Case** \\ \hline WAW & Transactions \(T_{1}\) and \(T_{2}\) simultaneously write to _account_. & Concurrent writes by \(T_{1}\) and \(T_{2}\) lead to an indeterminate final result. \\ RAW & \(T_{1}\) writes to _account_, followed by \(T_{2}\) reading from _account_. & Due to snapshot-based reading, \(T_{2}\) reads outdated data. \\ WAR & \(T_{1}\) reads from _account_, followed by \(T_{2}\) writing to _account_. & None. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Transaction conflict type analysis. dependence, there are also WAR dependencies between \(T_{3}\) on \(T_{2}\) and \(T_{2}\) on \(T_{1}\), forming a circular dependency. If executed in the order of \(T_{3}\), \(T_{2}\), and \(T_{1}\) according to reordering, there will be RAW dependencies of \(T_{2}\) on \(T_{3}\) and \(T_{1}\) on \(T_{2}\).