## 3 Blockchain for Supply Chain: Fundamentals
### Block-Mining: How New Records Are Added to a Blockchain?  
In a blockchain system, every user owns a public and private key pair, which serves for digital signature and verification of the transaction (or a record). When a transaction is carried out between two participants (or a record is generated), it is digitally signed by the generating party and broadcast to the blockchain network. It remains unconfirmed until it is added to the blockchain as a part of a block. Every node in the blockchain receives all the unconfirmed transactions from blockchain users (or wallets), verifies their digital signatures, and organizes them in a chronological order. Individually and independently, all the nodes form a temporary-block by choosing multiple transactions from the unconfirmed-transactions pool. It means, a temporary-block of any node 'A' at time 't' may differ a temporary-block of any other node 'B' at the same time. Hundreds and even thousands of transactions can be added into a block. The number of transactions in a block varies based on time and size of the block. A shorter block assures faster transactions but overall more mining efforts. The block time for Ethereum is 14-15 s, and for bitcoin, it is around 10 min.  
Once a temporary-block is formed by a node, a single hash is computed against all the selected transactions in the temporary-block. Bitcoin system utilizes Merkle-Tree to generate this single hash against thousands of transactions in a block [8]. Next, the node starts block-mining, which is a very complex and time-taking process. It is a process to solve a complex mathematical puzzle in order to confirm block transactions and add a block to the blockchain. In Bitcoin system, Proof of Work (PoW) protocol is used as a mining tool, aimed at finding a hash value of the block-header, which meets a given criteria e.g., a hash value that starts with 10 zeros. The block-header consists of five basic fields including (1) the hash of the final-block of the existing blockchain (i.e., the previous-block hash), (2) the timestamp, (3) a transactions hash (Merkle-Tree root hash), (4) version, (5) a nonce. The mining process computes a hash of the block-header using changing values of the nonce until it finds a hash value meeting the given criteria (e.g., a hash with starting 10 zeros). In other words, a bitcoin mining process is to find a special nonce value on which the hash of the block-header meets the defined criteria.  
Block-mining is a race where every node in the network is busy in constructing a temporary-block by selecting unconfirmed-transactions and mining it; Who wins the race of mining a block, his block is appended to the blockchain. Remember, nodes immediately stop block-mining process when they receive a claim of a successful mining from a node. Every node verify the successful mining, add the mined-block to the blockchain, reconstruct  
Figure 3: Blockchain overview.  
their temporary-blocks by removing confirmed transactions (the ones, which are in the newly mined-block) and adding other unconfirmed transactions from the pool, and restart mining on new temporary-block. In a nutshell, once a node successfully mines a block, all the transactions in its block are confirmed and the blockchain is extended by one new block. In a bitcoin blockchain system, a node's block-mining process is depicted in Figure 4.