*3.1. Blockchain at the Core*

The decentralized architecture could bring more advantages to the existing centralized product anti-counterfeiting system, and an example could be decentralizing NAS utilizing blockchain technology. As described in the first Blockchain use case [18], Blockchain is a distributed ledger technology recording and sharing all the transactions that occur within a dedicated peer-to-peer network. It is essentially a decentralized timestamp service with a virtual machine to execute signed scripts that operates on signed data. It utilizes a distributed ledger to store scripts and data with mutual consensus reached among participating nodes running on the same blockchain network.

The blockchain network consists of multiple nodes that maintain a set of shared states and perform transactions updating the states which could be divided into ledger state, block state, and transaction state as depicted in Figure 1. Blockchain transactions, as described in [19], need to go through the mining process. The transactions must be validated by the majority or agreed fraction among the participating network nodes, depending on which consensus protocol is adopted, before being ordered and packaged into a timestamped block which is also known as *block signing*.

**Figure 1.** Block state with transactions flow.

The blockchain network can be generally categorized either as permissionless (public network) or permissioned network. The former is an open distributed ledger network, such as in [18,20], where any node can join the network and where any two peers can conduct transactions without any authentication performed by any central authority. The latter is a controlled distributed ledger (like in [21]) where the decision-making and validation process are kept to one organization or few organizations forming a consortium with or without the staking concept. In permissioned networks, the consortium administrator or certificate authority determines who can join the network as a validator node or listener node, if there is no logic of on-chain governance available. All nodes are authenticated in advance, and their identities are known to other nodes running on the same network and in the same consortium, at least to the administrator.

The general blockchain data structure is demonstrated in Figure 2. The first block is always referred as the *genesis block*, and a block consists of a header and a body. The block body contains the list of transactions. The number of transactions that can fit into a block is dependent on the block size (block gas limit) and the transaction size (gas spent per transaction). The block header, as discussed in [22], contains a wide variety of fields,

including timestamp, Merkle root hash representing the hash value of every transaction in the block, and the hash pointer of the previous block header for which different blocks are "*chained*" to each other by putting this field of hash for every next block. There are more fields, such as the nonce which is the 32-bit field incremented until the equation is solved and difficulty which is needed for the *Proof-of-Work (PoW)* protocol. PoW is heavily linked with computation process known as *mining*, for which miners are the nodes to calculate the block header hash termed as "*solving the puzzle*". The differences between blockchains and databases are also explained in [23].

**Figure 2.** General blockchain data structure.

Based on the Proof-of-Work consensus protocol, the block is said to be mined if a miner finds its nonce such that the hash of block header is less than the difficulty target, based on the work in [18]. Modern blockchain is also characterized into four main aspects, apart from being utilized merely as the distributed ledger: the self-executing smart contract, immutability, cryptography, and consensus.

### *3.2. Starting from the Original Blockchain 1.0—The Bitcoin Network*

Blockchain is often regarded as the underlying technology of Bitcoin [18]—peer-topeer version of electronic cash, namely, the decentralized virtual currency, which does not require any existing currency institutions to circulate and is of fixed currency circulation. The Bitcoin network is indeed the first use case adopting blockchain technology. Bitcoin aimed at offering a purely peer-to-peer version of electronic cash which would allow online payments to be sent directly from one party to another without involving a financial institution. The main benefits of such a decentralized virtual currency system are the prevention of double spending, single point of control, and potential failure due to the reliance of trusted third parties and intermediaries. The Bitcoin network relies heavily on decentralized consensus and its cryptographic properties with use of digital signature instead, offering new transparency to finance industry, which have normally been of grea<sup>t</sup> security concerns on virtual currencies.

Blocks of the Bitcoin network are mined through a computationally-intensive process also known as the Proof-of-Work consensus protocol. The detailed process of PoW is depicted in [24], requiring significant computational resources to solve a cryptographic hash-based puzzle, and the solution could be worked out by trial-and-error based on the targeted difficulty set per block. The consensus must be reached before a new block could be created with respective transactions packed in the new block. As there are many miner nodes available on the open Bitcoin network, every miner on the network competes to generate a valid Proof-of-Work consensus for the block. It will take approximately 10 min on average with the current setting of the Bitcoin network for a miner to create a block successfully and receive the mining reward which has been halved on predefined milestone blocks (also known as the "*halving*" as explained in [25]) of the Bitcoin network. The Proof-of-Work adopted in the Bitcoin network would prevent the Sybil attackers from promoting a dishonest blockchain supporting their malicious agendas, offering a way for honest nodes to overcome Byzantine failures as well as accepting the next block on the canonical chain. This process is arguably the most difficult part of implementing a consensus protocol where many attack vectors would be focused on, for which a Byzantine failure (or fault) is a condition of a distributed network, where participating nodes may fail, and there is imperfect information on whether a specific node has failed.

There are also conditions for which a transaction in the Bitcoin network would be validated and so a successful state transition would then attain. For instance, (1) digital assets involved in the transaction of transfer operations should exist, (2) by enforcing asymmetric cryptography to produce signatures every node should only spend the coins they own and not those of others, and (3) every transaction should be supplied with enough values to the inputs field of every transaction by summing up all the Unspent Transaction Outputs (*UTXOs*) the sending blockchain nodes owned. The concept of *UTXO* is demonstrated in Figure 3.

**Figure 3.** Concept of Unspent Transaction Outputs (UTXOs).

With the scripting ability of the Bitcoin network alongside its Proof-of-Work consensus algorithm requiring validation performed by participating nodes when the statetransitioned function is validated, the faulty transactions, such as the one sending the same fund twice, will receive an error and therefore be aborted. However, some malicious nodes could try to fork the chain and place a second transaction before the first requiring the calculation of upcoming blocks with the updated block headers, which would require the creation of a separate chain longer than the original chain to be the canonical one as nodes are programmed to settle on the chain with largest investment value which is the *canonical chain*. The authors of [26] suggested that the Bitcoin network could not actually solve the Byzantine Generals problem in general, as attackers could theoretically be computationally unlimited and dominate more than 51% share of the computation power. The overall mining hash rate of the network to perform double-spend operation faster than that on the canonical chain, also known as the 51% attack under which the analysis on the probability

of solving *n* number of blocks consecutively faster than the canonical chain is demonstrated in Figure 4.

**Figure 4.** Analysis of hash rate-based Double-Spending.

There are research and development efforts performed based on the Bitcoin model in the field of decentralized electronic payment, such as Litecoin in [27]. These counterparts, being anything other than the original Bitcoin, were grouped as "*altcoins*", in which some basically are hard-forked versions of Bitcoin, while others have their own underlying native blockchain network with their own consensus protocols, such as Ethereum. With the advent of increasingly more native blockchain networks with their own consensus protocols and proposed data structures to be supported, blockchain provides a way for untrusting parties on a peer-to-peer network to agree on contents of a vastly replicated database.The blockchain industry has been focused on exploring more use cases other than merely the decentralized electronic paymen<sup>t</sup> using blockchain technology. The development of Blockchain 1.0 has undoubtedly set the premise for new ideas around decentralized autonomous organization and provided a solid basis for the development of Blockchain 2.0 protocols.

### *3.3. Overview of Blockchain 2.0—The Programmable Blockchain*

Given the fact that the Bitcoin network only offers basic scripting functionality, with the advent of the open-source Ethereum, which was published as in [28] back in 2014, Ethereum is no longer limited to transaction records, and is more effective and robust than its counterpart Bitcoin. The Ethereum blockchain network is a programmable blockchain that can perform any arbitrarily complex computation unlike those predefined operations performed in transactions of Bitcoin. Ethereum allows developers to create their own operations of any complexity in smart contracts, utilizing the Turing-completeness programming language and the flexibility brought by the smart contract enabling more possibilities to the blockchain. Ethereum has therefore often been dubbed as Web 3.0 due to the fact that the architecture of Ethereum opens up more ideas of general applications with transactions related to data processing and transfer of digital assets, not only the typical use cases, such as decentralized cryptocurrencies.
