Professional Documents
Culture Documents
Blcok Chain
Blcok Chain
https://doi.org/10.1007/s13369-018-3537-z
Abstract
Conventional food trading platforms face several issues, such as quickly to find trading objects and protect the reliability of
transaction information. With e-commerce developing rapidly, food trading has also recently shifted to the online domain.
Blockchain has changed many industries owing to its robustness, decentralization and end-to-end credibility. This paper
proposes a novel Food Trading System with COnsortium blockchaiN (FTSCON) to improve trust and security issues in trans-
actions. It uses consortium blockchain technology to set permission and authentication for different roles in food transaction,
which meet the challenge of the privacy protection of multi-stakeholders. The algorithm of optimized transaction combination
is designed for the purpose of helping users find suitable transaction objects. It can choose the optimized trading portfolio
for buyers. The online double auction mechanism is used to eliminate competition. And the improved PBFT (iPBFT) is
used to enhance efficiency of system. Moreover, a smart-contract life- cycle management method is introduced, and security
analysis shows that FTSCON improves transaction security and privacy protection. Experiment results based on a series of
data indicate that the proposed algorithm can achieve profit improvement of merchants.
Keywords Secure food transaction · Consortium blockchain · Consensus process · Smart contracts · Online double auction ·
Combination strategy
123
Arabian Journal for Science and Engineering
Unlike financial markets, this provision is unreasonable ferent from the public blockchains, fully private blockchains
for small- and medium-sized food and farming enterprises are the most restrictive. It is the blockchain where write
in the food market because the perishable nature of the food permissions are kept centralized to one organization. Read
causes the value of the food to change with the quality of the permissions may be public or restricted to an arbitrary extent.
food. In addition, due to the centralized storage of informa- This type of blockchains could be deployed in the private net-
tion in the traditional transaction process, the risk of leakage work of a single company; thus, it is mainly used for database
is high. For example, the largest information leakage acci- management, auditing and so on within a single company.
dent in Korean history occurred in 2013 and shocked society Consortium blockchains are often described as more inter-
when it was reported that personal information of around esting than the two other types of blockchains. It is the
104 million individuals was leaked [3]. Besides, the trust cri- blockchain where the consensus process is controlled by a
sis caused by information asymmetry will also damage the preselected set of nodes. The right to read the blockchain
enthusiasm of the business, and it is not conducive to market may be public, or restricted to the participants, and there
stability and economic development. are also hybrid routes such as the root hashes of the blocks
Blockchain technology could be put to use safeguarding being public together with an API that allows members of
automated trading mechanism. It has attracted the interest of the public to make a limited number of queries and get
stakeholders across a wide span of industries: from finance back cryptographic proofs of some parts of the blockchain
[4] and health care [5,6], to utilities [7], real estate [8] and the state. A good example for this kind of blockchain would
government sector [9]. Recently, it has been introduced for be a consortium of financial institutions, who may com-
food trading [10]. The reason for this explosion of interest: pete with one another. To serve such purpose, consortium
with a blockchain in place, applications that could previously blockchains are usually deployed in environments that con-
run only through a trusted intermediary, can now operate sist of multiple organization networks often interconnected
in a decentralized fashion, without the need for a central by the Internet. These blockchains may be considered “par-
authority, and achieve the same functionality with the same tially decentralized.” The detailed comparison of the three
amount of certainty. This was simply not possible before. blockchains is shown in Table 1. According to Table 1, the
The blockchain is a P2P distributed ledger technology, which authors find that the consortium blockchain is better than
enables food trading to be executed in decentralized, trans- the public blockchain and private blockchain in terms of
parent and secure market environments. transaction speed and security and so on. In addition, the
Blockchains are typically deployed in one of three com- consortium blockchain has infinite possibility and a bright
monly known environments depending on their access future in the business field. There are many famous organi-
permissions: public, consortium, and private environments. zations used consortium blockchains to grow their business,
Public blockchains are the most permissive among all three. for instance R3CEV LLC (R3), the largest consortium of
It is the blockchain that anyone in the world can read, send global financial institutions working on developing commer-
transactions to and anyone and participate in the consensus cial applications for the distributed ledger technology. They
process—the process for determining what blocks get added have built their own consortium blockchain, called Corda.
to the chain and what the current state is. These blockchains Since those days, R3 has rapidly grown from the original nine
are generally considered to be “totally decentralized.” Dif- banks to now over 200 banks, financial institutions, regula-
123
Arabian Journal for Science and Engineering
tions and trade associations. The goal of R3 is to cut across helps regulators gather and manage information to a certain
asset classes, geographies and market participants. It also extent, but they mostly target at food traceability, food stan-
presents an opportunity to work together in a collaborative dard, risk assessment and the food inspection. There is also
way in order to build new financial technology platforms a existing gap. To remedy this issue, a concept using radio
based on cryptocurrencies and distributed ledger techniques. frequency identification (RFID) has been proposed [13,14].
It may to shape the new rails upon which many industries This solution uses RFID tags to track products along the dis-
will operate in the future. tribution chain. This extends the traceability of the product
Motivated by these developments, in this paper, we exploit to the entire supply chain instead of being confined to the
the consortium blockchain technology to develop a secure production stage. It also digitizes the recording of data and
automatic food trading system. The consortium blockchain changes the method of identification to individual products
is a specific blockchain with multiple authorized nodes to instead of batches. IoT has a promising future in improving
establish the distributed shared ledger with moderate cost. A existing systems and tools [15]. Li et al. [16] formulated a
consortium blockchain is established on authorized nodes to tracking method for prepackaged food based on the internet
publicly audit and share transaction records without relying of things (IoT), and it tracks prepackaged food products to
on a trusted third party. Food transaction records among user monitor the entire supply chain. Besides, Pang et al. [17]
nodes are uploaded to the authorized nodes after encryption. used the internet of things designing the solution for food
The authorized nodes will audit the transactions and record supply. These technologies suffer from some obvious draw-
them into the shared ledger. This ledger is publicly accessed backs: centralization of data storage increases susceptibility
by nodes connected to the consortium blockchain. Moreover, to leaks and tampering, and the opaqueness of the transaction
since the trading portfolios of merchants need to be opti- introduces doubt. However, blockchain technology not only
mized, an iterative optimization of the transaction matches can be a key enabler to solve many IoT security problems
algorithm which is designed to maximize demand of buyers [18], but also perfectly overcome these defects.
in the system. The contribution of this paper is summarized Blockchain technology has proven to be a highly rev-
as follows. olutionary technology with applications in many fields. It
has seen wide use in financial applications since the begin-
– For the purpose of helping users find suitable transac- ning. Omran et al. [19] devised a supply chain finance
tions. We have designed an algorithm that can choose the framework based on blockchain technology, and Benos et
optimized transaction combination for buyers, and we al. [20] researched securities settlement using distributed
have used online double auction mechanism to eliminate ledger technology. The conclusion was that blockchain tech-
competition. nology can lower cost and enhance efficiency. Blockchain
– A smart-contract life-cycle management method is intro- is used not only in financial fields but also in other fields
duced in the system to reduce the risk of system attack as well, like the multimedia blockchain use for media trans-
possibility and improve the security of the system. action [21], and Sikorski et al. made an implementation of
– The authors have improved PBFT (iPbFT) and made blockchain technology facilitating a M2M electricity market
i- PBFT to be more efficient than traditional consensus [22]. Hasan et al. presented a blockchain-based proof-of-
algorithm. delivery (POD) solution which facilitates the trading and
tracking of sold items between two parties in a decentralized
The rest of this paper is organized as follows. Section 2 way [23]. Using blockchain technology in the food indus-
details related work. Core system components are illustrated try is a new area of research. For instance, a system based on
in Sect. 3. Implementation details are discussed in Sect. 4. hazard analysis and critical control points (HACCP) for food
Section 5 presents experiment platform, security analysis and supply chain traceability uses blockchain and the IoT [24].
numerical results, and the paper is concluded in Sect. 6. Smart contracts are supposed to herald the era of
blockchain 2.0. Karajovic et al. [25] applied smart contracts
to automate taxation and optimize accounting processes .
2 Related Work Smart contracts can also be used as automatic custodians of
digital assets or executing contractual obligations in a safe,
Reductions in transport and transaction costs are expected to verifiable, and deterministic manner [26]. An effective mech-
have a major effect on the functioning of food transaction. For anism of using smart contracts to automate transactions does
many developing countries, this is a relevant issue as it may not exist yet and is the subject of this paper. This research
have important consequences for the food markets in urban topic has in fact gained a lot of attention recently.
and rural deficit areas [11]. At present, most of the solutions Several existing applications combine blockchain and
to food trade problems are from the perspective of the food food technology. The primary idea is to solve food safety
supply chain such as electron spin resonance (ESR) [12]. It issues using blockchain. Major corporations have supported
123
Arabian Journal for Science and Engineering
this issue. Wal-Mart, Nestlé and IBM have formed a global in turn require large amounts of computing power. Fur-
food safety blockchain alliance. The main responsibilities thermore, the restriction on the number of transactions the
are monitoring the supply chain, which involves storing sup- network could process was small; thus, they were piling up
ply chain data in the blockchain [27] and leveraging RFID which created congestion and prompted users who were in
technology to manage the supply chain using blockchain a hurry to pay hefty charges so that nodes pick up their
[28]. The technologies will authenticate, verify, record and transactions and include them in a block. In addition, the
provide an open report on the transfer of ownership and pro- problems like scalability, security flaws, governance, legal-
vision of products and goods. For food producers, the use ity, human error, transaction costs, imperfect competition
of blockchain could assist in stopping the use of fake ingre- between blockchains seem to be piling up. All of these prob-
dients by detecting it much faster. The platform is based on lems increasing cost and ruining efficiency. The system is
the consortium blockchain. Extensively tested and piloted, it designed and can solve these problems. The architectures for
addresses a wide range of business pain points, including both FTSCON includes the following entities as shown in Fig. 1.
business and technical requirements around privacy, collab-
oration, performance and security that no other blockchain (1) User Node User nodes can play two roles in the system:
platform delivers today. The integrated platform allows mul- buyer node or seller node. The role is chosen according
tiple parties to jointly govern, develop, secure and operate its current state and planning. In this paper, the buying
blockchain networks to help companies accelerate consor- node is denoted by u 1 and the selling node is u 2 ,
tium blockchain adoption. (2) Scheduling Node The scheduling node has the authority
Preparatory research and analysis make it clear that it is to verify transaction data and calculate optimal trading
necessary and feasible to incorporate blockchain technology objects for the users of the system, and the scheduling
to automated food trading systems. The initial approach of nodes are represented as si (i = 1, 2, …, n).
this study was introducing a public blockchain since it is
readable by any party: Any user can initiate a transaction The consortium blockchain is made up of three parts:
and it can be verified, and any user can participate in this
consensus process. Such an automated trading system takes (1) Block containing the transaction data The scheduling
advantage of all the benefits provided by public blockchains. nodes contain the bulk of the raw data. Computational
Further research, however, shows that for an excessive num- and storage limits make it necessary for the user nodes to
ber of nodes, the processing speed of the background system store an index of the metadata containing the metadata
will diminish when all nodes are required to run a consensus location to bring down system cost. The scheduling node
algorithm, possibly causing harm to the underlying system. manages local transaction records, which are encrypted
Furthermore, for transactions with a high volume of data, and assembled after the scheduling nodes have reached a
efficiency is reduced since each node stores the same data. consensus. A cryptographic hash in each block points to
From a thorough analysis of the benefits and drawbacks the previous block, enabling validation and traceability.
of several blockchain mechanisms, the authors decided to Blocks are added to the chain chronologically. Because
utilize consortium blockchain technology for the study’s of this, both scheduling and user nodes can access the
automatic trading system. data freely.
(2) Consensus mechanism This is a mechanism that enables
consensus to be achieved among blockchain nodes
3 The Core Components of the Food Trading across the entire network, based on block information.
System It can be used to ensure that the newest block has been
added to the chain properly, and the chain data stored in
3.1 Consortium Blockchain for FTSCON the nodes have not been maliciously forked or altered.
(3) Smart contract Within the blockchain context, smart
Blockchain technology is a modern P2P technology with contracts are scripts stored on the blockchain. (They can
applications in distributed computing and decentralized data be thought of as roughly analogous to stored procedures
sharing and storage. Prior to recording a transaction in a in relational database management systems.) Since they
blockchain, a process called consensus processing is applied reside on the chain, they have a unique address. We trig-
to verify the data. This process is traditionally carried out ger a smart contract by addressing a transaction to it. It
by all nodes of the system, and traditional transaction pro- then executes independently and automatically in a pre-
cess contains multi-stakeholders. This essentially means that, scribed manner on every node in the network, according
in order to prove that a node has permission to write to to the data that were included in the triggering transac-
the blockchain, complicated algorithms must be run, which tion.
123
Arabian Journal for Science and Engineering
The portion of Fig. 1 containing set s denotes a group of 3.2 Operation Details of FTSCON
scheduling nodes, while the portion containing u 1 , u 2 and
si is a schematic of the transaction process. The bottom left In essence, the consortium blockchain is a P2P model. The
contains the block with transaction information, while on the rights and obligations of all peers in the P2P network are the
right is the transaction data module. same. In this paper, the authors consider that each buyer and
seller as a node of a P2P network, and their trading rights are
equal.
123
Arabian Journal for Science and Engineering
To ensure the integrity and consistency of the supply and is the unit freight shipped to each place, xi j is the quantity
demand data across all nodes, a specific area in the system of food transported to various places and i, j represent the
is separated and designated as the trading pit. Before the origin label and the place of sale label, respectively. Here,λ is
transaction data are uploaded to the trading pit, it is grouped the loss value of the unit shipping volume, and ω represents
by scheduling node after taking into account demand, supply the total shipping volume [29].
and food type. The proposed algorithm is derived from dynamic pro-
Demand or supply data are send directly by u 1 and u 2 to the gramming. Dynamic programming (DP) is a very useful
nearest scheduling node si , which records this information tool in solving optimal control problems. It is an algorithm
in the cache table. The transaction data are then uploaded to attributed largely to Bellman, which is developed for opti-
the transaction pit. The scheduling nodes will mutually agree mizing a multistage (the term stage represents time step
upon a time t, at which they will download all information throughout the paper) decision process. If the return or cost at
in transaction pit and run an algorithm to analyze the data each stage is independent and satisfies the monotonicity and
to select the optimal trading portfolio for u 1 . The algorithm separability conditions, the original multistage problem can
will be detailed in Sect. 4. The uniformity of the supply and be decomposed into stages with decisions required at each
demand data across all nodes means that the result of the stage. The decomposed problem then can be solved recur-
algorithm will be identical for time t. The algorithm com- sively, two stages at a time, using the recursive equation of
putes, in this case, that the most optimal transaction object DP. DP is particularly suited for optimizing reservoir man-
for u 1 is u 2 , which is relayed to u 1 by si . u 1 then finds u 2 with agement and operation as the structure of the optimization
its public address, and a smart contract is automatically gen- problem conforms to a multistage decision process. Over the
erated by the system. Both parties sign the contract and agree past half decade, DP had been used extensively in the opti-
to the automatic execution of the transaction. If u 1 is unsat- mization of reservoir management [30] and operation [31].
isfied the transaction objects calculated by si , it can send the For some buyers’ part, the general understanding is that a
demand information to si again, and the calculation process single supplier cannot meet the entire demand. To calculate
is repeated until u 1 is satisfied. the correct number of suppliers to meet the demand, core
issues need to be addressed. That is, the transaction combi-
nation with the smallest loss of food value is selected under
4 Details of the Food Trading System the condition that the demand of the buyer is greatly satisfied.
In the course of the research, the author found that the idea
4.1 The Method of Optimal Transaction Combination of solving the 0–1 knapsack problem can solve this problem
perfectly. Here, the value loss of each buyer is v and supply
The section explains a scheduling node how to reach a volume of each seller is n, and under the condition of the total
consensus; it needs to find the usera˛ŕs optimal transaction demand of the buyer is N , the equation is defined as follows:
combination, automatically conducts the transaction through ⎧
⎪
⎨0
the FTSCON and verifies the transaction information.
f [i][n] = f [i − 1, n]
⎪
⎩
i) Transaction Objects Selection max{ f [i − 1][n], f [i − 1][n − n[i]] + v[i]}
(2)
To ensure market fairness and stability, we prescribe that
The 2D array f [i][n] represents the minimal value loss
the right and obligation both of buyers and sellers are the
of food i to the buyer. The current demand of buyer is n.,
same. Let v be a measure of buyer’s loss in transit; multiple
which is the addition of these batches of food supplies and
factors can change this value in the real world, but there are
can greatly satisfy current buyer demand. It is assumed that
two factors having a higher bearing on the final v value. Under
the previous i − 1 pieces of food have all been selected, and
the premise that freight and other expenses are born by the
the current value loss is f [i − 1, n].
buyer, the value loss of buyer will be calculated according to
The previous formula makes it clear that the selection
the formula shown below (Eq. (1)). The algorithm is based
results in the user being matched with the best possible
on the formula.
merchant. To arrive at this formula, Algorithm 1 has been
⎛ ⎞
m n designed.
ν = −⎝ ci j xi j + λ ∗ ω⎠ (1)
i=1 j=1 ii) Bargaining Process
The two terms of the formula are the transport cost and the After the scheduling nodes selects the transaction combina-
loss value of the food caused by the transport time, where ci j tion for the buyer, the buyer and the seller objects need to
123
Arabian Journal for Science and Engineering
Algorithm 1 The Algorithm For Choose Optimal Objects after refusal. Otherwise, both parties will be bargaining for
Input: The array of values loss v[m], the demand array n[m]; countless times to obtain the lowest price.
Output: The minimal value loss of the buyer receives and the corre-
sponding merchant number i;
1: for n ← 1 to N do iii) Online Double Auction Mechanism
2: if n i n then
3: if vi + f [i − 1, n − n i ] > f [i − 1, n] then
4: f [i, n] ← vi + f [i − 1, n − n i ]; In the actual transaction process, there are transaction
5: return i; objects combination results that may satisfy the requirements
6: else of multiple buyers. There will be competition among differ-
7: f [i, n] ← f [i − 1, n]; ent buyers. At this time, the online double auction mechanism
8: end if
9: else is used. The double auction mechanism can solve problems
10: f [i, n] ← f [i − 1, n]; like how to effectively use network resources and lighten the
11: end if network load. Different from unilateral auction, double auc-
12: end for tion is a˛śmany-to-manya˛ś market structure. That means, there
13: return f [m, N ];
is more than one buyer and seller. It is an inter-networking
information exchange model where auctioneers and bidders
are equal.
negotiated price. The sellers quotation directly affects their
The process is as follows: The scheduling node opens the
own profits and whether it can be accepted by the buyer. Sell-
market, buyer nodes and proxies (here, proxy is chosen by
ers must weigh the bidding strategy to maximize its profit.
seller nodes in transaction combination) will have the highest
The seller only knows exactly its own cost function, pay-
willing price in each round of auction according to their own
ment function, the buyers decision-making type space, etc.,
conditions, and the scheduling node collects quoted price
and vice versa. Obviously, the game between the seller and
and picks the current highest price of buyer and lowest of
the buyer is a dynamic game process. In the actual price
proxy. As soon as the highest quoted price of buyer is higher
negotiation, the bid price of the negotiating parties is not
than or equal to the lowest proxy quote, the trade executes
simultaneous, usually one party gives a price, and the other
immediately and proceeds in sequence until all transactions
party chooses to accept or reject. If it is refused, he can give
were completed and the market was closed. In this paper, we
his own price, and they continue to negotiate this price until
found that loopholes such as serious asymmetry in informa-
the conclusion of the negotiations. For the bargaining game
tion between buyers and sellers in the auction process [32]
between the seller and the buyer, it is clear that the seller first
are perfectly fixed. And based on the work of Fu [33], the
quotes, and the buyer starts from his own profit maximiza-
formula for the maximum auction efficiency is as follows:
tion goal based on this price to decide whether to accept the
quotation. If the buyer accepts the price, they will use the 2 1 1
smart contract to execute the transaction, otherwise it enters ai = vi + Vmin + Vmax ,
3 4 12
the next round of bargaining game, so this is a dynamic pro- 2 1 1
cess of rotating bidding. The profit function of buyers and bi = m j + Vmin + Vmax . (5)
3 12 4
sellers is as follows:
Assuming that the number of bargaining round is N , in the The ai denotes the quotation of the i buyer, vi denotes
N round, the buyer’s bid price is Wn/2 b , and seller’s accept the estimate price of the i buyer, Vmin denotes the lowest bid
price is Wn/2 s . We use Ws and Wb to indicate the seller’s and announced by the market, Vmax denotes the highest quotation,
buyer’s expectations for the price of the food. The transaction b j denotes the quotation of the j seller, and m j denotes the
may executed when Ws Wb . Here, when N is odd: j seller cost.
After the auction is finished, the transaction price is deter-
r1 = δ n−1 (W(n+1)/2 s − Ws ) mined and smart contracts are generate by system.
r2 = δ n−1 (Wb − W(n+1)/2 s ) (3)
4.2 Smart Contract
and when N is an even number:
Smart contracts can be considered as a set of digital promises.
For a user, a smart contract is effectively an automatic guar-
r1 = δ n−1 (Wn/2 b − Ws ) antee by which, for instance, information is shared when
r2 = δ n−1 (Wb − Wn/2 b ) (4) specific conditions are satisfied. It is a programmable con-
tract between two parties that is stored in the blockchain
r1 and r2 are profit of seller and buyer, respectively, and δ n−1 and tagged with a bespoke blockchain address. The contract
is a coefficient of convergence, that is, the coefficient of return is executed when its conditions are met. This mechanism
123
Arabian Journal for Science and Engineering
improves trust between users due to the credibility of the to carry on attacks. Therefore, in order to improve the secu-
blockchain. rity of the system, we adopted life-cycle management for
Using the above information, a smart contract will be smart contract [35].
defined to satisfy the aforementioned process. The contract Figure 2 shows a smart-contract life cycle of agri-
shows u 1 and u 2 engaging in a trade, with both parties food transaction. It requires cross-organizational information
depositing the same amount of money initially. The parties logistics automation. FTSCON can act as a collaboration
are meant to execute the contract before the deadline, failing hub that serves as a preparation platform for the inception
which the respective funds are returned. We assume that the of smart contracts, and a designer creates a template for
price is Wn/2 . Additionally, the contract defines functions a FTSCON into which service types are inserted together
that calculate the outcome and which either party can call with roles. Since the transaction process involves other roles
upon. These functions are detailed in Algorithm 2. besides buyer and seller, these service roles are called service
roles here. These roles are considered to be potential part-
ners which match the service offer into the service type roles
Algorithm 2 Smart Contracts. are affiliated with organizations that cooperate in the smart
1: address public u 1 , u 2 ;
2: State public state ;
contract. Users as service consumers can decide whether
3: data deadline, threshold a service offer is acceptable. As all nodes are in position
4: // extract the public key and status information of u 1 , u 2 , and define and service types match with acceptable service offers, the
deadline and conditions of the swap contract smart-contract negotiation starts. The process of negotia-
5: def determine.outcome();
6: if state != .state then
tion is essentially the process of bargaining for agri-food.
7: if block.timestamp < deadline then The general consultation in this process has two results:
8: price = Wn/2 ; agreement or disagreement. If the negotiation results in dis-
9: if price > =threshold then agreement, then the transaction is terminated. The bargain
10: send(u 2 , self.balance);
11: purchaseConfirmed();
is accepted by all nodes and the consensus occurs, which
12: else is the prerequisite for a contract establishment. Smart con-
13: send(u 1 , self.balance); tracts enable distributed management. Therefore, each nodes
14: purchaseConfirmed(); of the running case receive a local contract copy from which
15: end if
16: else
a set of respective obligations are deduced. Next, all col-
17: The transaction failed and the funds return to both sides. laborating nodes could do their own job, and this process
18: end if is called the private processes. For enabling information
19: else exchanges among nodes, the communication endpoints must
20: Both sides are offline, the transaction cannot be carried out for
now.
be established. That way, the management of transaction is
21: end if automated. If there is a quality change caused by violation,
an assigned agent will escalate the event and the buyer will
check the breach severity. Assuming the agri-food is seri-
The research shows that the smart contract has many ous deterioration and can not be sold, the buyer triggers
security problems [34]. Smart contracts present a new tar- a disruptive rollback that collapses the transaction. How-
get to attackers beyond the sophisticated attacks required ever, if the agricultural product is only of reduced quality,
to attack blockchain. The security problems surrounding it can still be successfully sold at a lower price that the
smart contracts have challenged its development, destroy- buyer tolerates. At this point, the goods are reassigned for
ing many promising projects and lowering the public trust transportation.
in smart contracts. Unlike Web applications, smart contracts The life-cycle management is important for vetting col-
are directly linked with money and exploit typically result- laborating parties to reduce security breaches such as those
ing in immediate financial loss. In reality, there are many Ethereum recently experienced. But there are many prob-
instances of attackers exploiting the logic of smart contracts lems with system efficiency. Therefore, we propose a new
to perform attacks with effects such as draining of funds, consensus process based on FTSCON to improve efficiency.
gaining an advantage over other users of the smart contract,
and rendering the smart contract unusable. These attacks
are often truculency because of the huge amounts of value 4.3 Consensus Process
placed in these smart contracts by their users. In this sec-
tion, the security vulnerabilities of Ethereum smart contracts It is well known that a challenge for blockchain as the
were systematized. The vulnerabilities were grouped in three blockchain network is distributed. In blockchain, there is no
classes, according to the level where they are introduced (as central node that ensures ledgers on distributed nodes are all
shown in Table 2). All these vulnerabilities can be exploited the same. Some protocols needed to ensure ledgers in dif-
123
Arabian Journal for Science and Engineering
123
Arabian Journal for Science and Engineering
ferent nodes are consistent. We next present three common Algorithm 3 iPBFT
approaches to reach a consensus in blockchain. Input: Both parties’ transaction information. It contains the identity
Proof of work (POW) is a consensus strategy used in the information of the two parties are key1 , key2 , the type of transaction
commodity denote c, the number of signed nodes is n, the number
Bitcoin network. In PoW, each node of the network is cal- of transactions abbreviated as num, and the transaction time is t;
culating a hash value of the block header. The block header Output: Approval of transaction information or not;
containing a nonce and miners would change the nonce fre- 1: n ← 0
quently to get different hash values. The consensus requires 2: if key1 =key1bu f f er then
3: if key2 =key2bu f f er then
that the calculated value must be equal to or smaller than a 4: if c = cbu f f er && num = num bu f f er && t = tbu f f er then
certain given value. When one node reaches the target value, 5: The transaction information is signed and time stamped by
it would broadcast the block to other nodes and all other the scheduling node.
nodes must mutually confirm the correctness of the hash 6: n ←n+1
7: else
value. If the block is validated, other nodes would append 8: The trading information is not approved and send the trans-
this new block to their own blockchains. This process needs action information and n to the next scheduling nodes.
all nodes involved in; therefore, these works waste too much 9: end if
resources. Proof of stake (POS) is an energy-saving alterna- 10: else
11: The trading information is not approved and send the trans-
tive to PoW. Nodes in PoS have to prove the ownership of action information and n to the next scheduling nodes.
the amount of currency. PoS saves more energy and is more 12: end if
effective compared to PoW. Unfortunately, as the mining cost 13: else
is nearly zero, attacks might come as a consequence. Practical 14: The trading information is not approved either and send the trans-
action information and n to the next scheduling nodes.
byzantine fault tolerance (PBFT) is a replication algorithm 15: end if
to tolerate byzantine faults. A new block is determined in a 16: if n is bigger than or equal to fifty-one percent of the total number
round. In each round, a primary would be selected according of scheduled nodes. then
to some rules. And it is responsible for ordering the transac- 17: The transaction information is recorded into the block and put
the block into blockchain.
tion. The whole process could be divided into three phase: 18: else
pre-prepared, prepared and commit. In each phase, a node 19: The transaction information is considered false.
would enter next phase if it has received votes from over 2/3 20: end if
of all nodes. So PBFT requires that every node is known to
the network. Influenced by the work of Zheng et al. [36], the
comparison of the three consensus algorithms is shown in total nodes (such as 51%), consensus is said to be reached,
Table 3. after which the transaction is recorded in the block and the
It is clear that PBFT is better than POW and POS on block is appended to the blockchain. iPBFT is detailed in
resource-saved and security. However, the number of blocks Algorithm 3, which starts with the submission of the trans-
generated by running the current consensus algorithm cannot action data to scheduling node si .
meet the transaction volume in reality. Therefore, we choose
PBFT for improvement to enhance efficiency.
This paper proposes an improved PBFT (iPBFT) algo- 5 Experiment Platform, Security Analysis
rithm whose underlying principle is using the automatic and Numerical Results
transaction mechanism of the system to verify transaction
information. It can be seen from Fig. 1 that the transaction 5.1 Experiment Platform
is verified by u 1 and u 2 after completion, after which both
of them encrypt and upload the transaction data to the near- The FTSCON, including consortium blockchain, Web server
est scheduling node si , which verifies the information based and client browser, is built by Ethereum architecture. The
on its cache table, signs and timestamps it if the verification Web server is developed by PHP; the client browser page is
is successful, and then sends these data to other scheduling written using HTML/CSS/JavaScript. Consortium blockchain
nodes. If the number of signed nodes is more than half of the is designed to record transaction information, nodes data,
transportation process and time. The optimization of trans-
123
Arabian Journal for Science and Engineering
Fig. 3 Screenshots of FTSCON interface. a Transaction objects. b Block information. c Market page. d Post information
123
Arabian Journal for Science and Engineering
123
Arabian Journal for Science and Engineering
123
Arabian Journal for Science and Engineering
1) Efficiency of Algorithm
123
Arabian Journal for Science and Engineering
After the development of the system, a small case study was Fig. 11 Quarter-wise profits with and without FTSCON
performed on data that were obtained from one of the partners
that collaborated within the project FTSCON. Our case study
was performed on profits data, collected by Web servers. results that were able to provide reliable data from the Web
FTSCON functionalities illustrate the systems use and pro- server.
vide examples of the obtained results, thus, to serve as a It can be seen that January losses were higher using the
proof of concept. The data include profits on 300 enterprises existing trading model, and the February profit was lower
in Shandong province between January 2014 and Decem- as well. March onwards, the profit curve using the proposed
ber 2017. Each data include a description of the location system rose, with a higher monthly profit than the traditional
(region, spatial coordinates and location type), a description system. Even in months with a declining trend, such as July,
of the device (model and device id), the timestamp of the September, October and December, the proposed method
transaction, the count of transaction products and the type of provided better profits than the existing one. Thus, we draw
transaction products species. Additionally, the project ana- a conclusion that site selection is one of the most impor-
lysts also calculated the profit outcomes due to the use of tant decisions for the establishment of a enterprise operation.
FTSCON functionalities. Within the analyses, the data from The production location influences the competitiveness of
the first years of the FTSCON use (2017) were compared the farm and enterprise by conditioning environmental and
to the average data of 3 years with preceding the integration economic factors. The influence of environmental factors on
FTSCON (2014–2016). Figure 11 displays the comparison crop growth has implications for the time required to reach
123
Arabian Journal for Science and Engineering
the desired commercial size and therefore for the costs asso- 4. Treleaven, P.; Brown, R.G.; Yang, D.: Blockchain technology in
ciated with the cultivation process. The most investigated finance. Computer 50, 14–17 (2017)
5. Zhang, J.; Xue, N.; Huang, X.: A secure system for pervasive social
factor is transaction strategies, which is the characteristics network-based healthcare. IEEE Access 4, 9239–9250 (2016)
that have the greatest influence on food trade rate. In addition 6. Zhang P.; Schmidt D.C.; White J.; Lenz G. : Blockchain Technol-
to these factors, food transactions are also affected by sea- ogy Use Cases in Healthcare (2018). https://www.dre.vanderbilt.
sonal factors. Moreover, FTSCON can also help merchants edu/~schmidt/PDF/blockchain-bookchapter-2018.pdf
7. Basden, J.; Cottrell, M.: How utilities are using blockchain to mod-
to destock and eliminate deficits. ernize the grid. Harv. Bus. Rev. 3, 1–3 (2017)
Based on these experiments, FTSCON outperforms tradi- 8. Spielman, A.: Blockchain: digitally rebuilding the real estate indus-
tional ones in terms of runtime, value selection and merchant try. Mass. Inst. Technol. (2016). https://dspace.mit.edu/bitstream/
profits. handle/1721.1/106753/969450770-MIT.pdf?sequence=1
9. Ølnes, S.: Beyond bitcoin enabling smart government using
blockchain technology. In: International Conference on Electronic
Government and the Information Systems Perspective, pp. 253–
264. Springer, Cham (2016)
6 Conclusion 10. Lai, K.: DEAL: first agricultural commodity blockchain transac-
tion. Int. Financ. Law Rev. (2018)
This paper proposed an automatic merchant transaction 11. Ruijs, A.; Schweigman, C.; Lutz, C.: The impact of transport-and
mechanism. The consortium blockchain model was lever- transaction-cost reductions on food markets in developing coun-
tries: evidence for tempered expectations for Burkina Faso. Agric.
aged to design an automated transaction system, where food Econ. 31(2–3), 219–228 (2004)
can be traded independent of a trusted third party. FTSCON 12. Yu, L.L.; Cheng, Z.: Application of electron spin resonance (ESR)
maximizes merchant profits. A security analysis revealed that spectrometry in nutraceutical and food research. Mol. Nutr. Food
the proposed method improves the security and privacy of Res. 52(1), 62–78 (2008)
13. Bibi, F.; Guillaume, C.; Gontard, N.; Sorli, B.: A review: RFID
the transaction. A numerical analysis confirmed the efficacy technology having sensing aptitudes for food industry and their
of the system in maximizing merchant profit quickly and at contribution to tracking and monitoring of food products. Trends
low computational cost. Of note is that the underlying con- Food Sci. Technol. 62, 91–103 (2017)
cept of blockchain technology still presents problems with 14. Kumari, L.; Narsaiah, K.; Grewal, M.K.; Anurag, R.K.: Application
of RFID in agri-food sector. Trends Food Sci. Technol. 43, 144–161
respect to computational resources, transaction cost, block (2015)
speed and scalability. Furthermore, different merchants with 15. Da Xu, L.; He, W.; Li, S.: Internet of things in industries: a survey.
the same type of supply may be in competition, and we use IEEE Trans. Ind. Inform. 10, 2233–2243 (2014)
the online double auction mechanism to eliminate it. The 16. Li, Z.; Liu, G.; Liu, L.; Lai, X.; Xu, G.: IoT-based tracking and
tracing platform for prepackaged food supply chain. Ind. Manag.
technological evaluation of the blockchain still needs to be Data Syst. 117, 1906–1916 (2017)
conducted in terms of computational resources, transaction 17. Pang, Z.; Chen, Q.; Han, W.; Zheng, L.: Value-centric design of the
costs, block speeds and scalability. This will be the next internet-of-things solution for food supply chain: value creation,
step of our work. Additionally, as computational costs of sensor portfolio and information fusion. Inf. Syst. Front. 17, 289–
319 (2015)
the on-chain matching algorithm depend on the number of 18. Khan, M.; Salah, K.: IoT security: review. blockchain solutions,
supply and demand information and cannot be determined and open challenges. J. Future Gener. Comput. Syst. Elsevier 82,
in advance, a fair mechanism for the allocation of these cost 395–411 (2018)
has to be determined. 19. Omran, Y.; Henke, M.; Heines, R.; Hofmann, E.: Blockchain-
driven supply chain finance: towards a conceptual framework
from a buyer perspective (2017). https://www.alexandria.unisg.
Acknowledgements We warmly thank for the support and funding by
ch/251095/1/WP29-Blockchain-driven%20supply%20chain
the research projects of The Social Science and Humanity on Young
%20finance%20Towards%20a%20conceptual%20framework
Fund of the ministry of Education (17YJCZH127) and the Fund of the
%20from%20a%20buyer%20perspective.pdf
social science and Nature Science of Beijing Technology and Business
20. Benos, E.; Garratt, R.; Gurrola-Perez, P.: The economics of dis-
University (LKJJ2017-13).
tributed ledger technology for securities settlement (2017). https://
doi.org/10.2139/ssrn.3023272
21. Bhowmik, D.; Feng, T.: The multimedia blockchain: a distributed
and tamper-proof media transaction framework. In: 2017 22nd
References International Conference on Digital Signal Processing (DSP), pp.
1–5. IEEE (2017)
1. Falkowski, J.; Menard, C.; Sexton, R.J.; Swinnen, J.; Vandevelde, 22. Sikorski, J.J.; Haughton, J.; Kraft, M.: Blockchain technology in the
S.: Unfair Trading Practices in the Food Supply Chain: A Literature chemical industry: machine-to-machine electricity market. Appl.
Review on Methodologies, Impacts and Regulatory Aspects (No. Energy 195, 234–246 (2017)
JRC108394). Joint Research Centre, Seville (2017) 23. Hasan, H.R.; Salah, K.: Blockchain-based solution for proof
2. Rommerskirchen, C.: Fiscal rules, fiscal outcomes and financial of delivery of physical assets. In: International Conference on
market behaviour. Eur. J. Polit. Res. 54, 836–847 (2015) Blockchain, pp. 139–152. Springer, Cham (2018)
3. Song, D.H.; Son, C.Y.: Mismanagement of personally identifiable 24. Tian, F.: A supply chain traceability system for food safety based
information and the reaction of interested parties to safeguarding on HACCP, blockchain & internet of things. In: 2017 Interna-
privacy in South Korea. Inf. Res. 22, 1–16 (2017)
123
Arabian Journal for Science and Engineering
tional Conference on Service Systems and Service Management 33. Jing, F.; Peiji, S.; Xiaoping, Y.: Incomplete information game simu-
(ICSSSM), pp. 1–6. IEEE (2017) lation research in online dual auction. J. Manag. 3, 673–676 (2006)
25. Karajovic, M.; Kim, H.M.; Laskowski, M.: Thinking Outside the 34. Atzei, N.; Bartoletti, M.; Cimoli, T.: A survey of attacks on
Block: Projected Phases of Blockchain Integration in the Account- ethereum smart contracts (sok). In: Maffei, M., Ryan, M. (eds.)
ing Industry (2017). https://doi.org/10.2139/ssrn.2984126 Principles of Security and Trust, pp. 164–186. Springer, Berlin
26. Ibáñez, L.D.; Simperl, E.; Gandon, F.; Story, H.: Redecentraliz- (2017)
ing the web with distributed ledgers. IEEE Intell. Syst. 32, 92–95 35. Dai, P.; Mahi, N.; Earls, J.; Norta, A.: Smart-contract
(2017) value-transfer protocols on a distributed mobile applica-
27. Tse, D.; Zhang, B.; Yang, Y.; Cheng, C.; Mu, H.: Blockchain tion platform. https://cryptorating.eu/whitepapers/Qtum/
application in food supply information security. In: 2017 IEEE a2772efe4dc8ed1100319c6480195fb1.pdf (2017)
International Conference on Industrial Engineering and Engineer- 36. Zheng, Z.; Xie, S.; Dai, H.; Chen, X.; Wang, H.: An overview of
ing Management (IEEM), pp. 1357–1361. IEEE (2017) blockchain technology: architecture, consensus, and future trends.
28. Tian, F.: An agri-food supply chain traceability system for China In: 2017 IEEE International Congress on Big Data (BigData
based on RFID & blockchain technology. In: 2016 13th Interna- Congress), pp. 557–564. IEEE (2017)
tional Conference on Service Systems and Service Management 37. Consortium chain development. https://github.com/ethereum/
(ICSSSM), pp. 1–6. IEEE (2016) wiki/wiki/Consortium-Chain-Development. Accessed 19 Jul 2016
29. Xiaokun, W.: Study on the method of calculating the time value of 38. Data for the 01 Knapsack Problem. https://people.sc.fsu.edu/
freight transport. Traffic Stand. 11, 138–141 (2008) ~jburkardt/datasets/knapsack_01/knapsack_01 (2014)
30. Delipetrev, B.; Jonoski, A.; Solomatine, D.P.: A novel nested 39. The test data of 0-1 knapsack problem. https://wenku.baidu.com/
dynamic programming (nDP) algorithm for multipurpose reservoir view/7042b877a8956bec0975e3f4.html?from=search (2013)
optimization. J. Hydroinformatics 17, 570–583 (2015) 40. Kulkarni, A.J.; Shabir, H.: Solving 0C1 knapsack problem using
31. Facci, A.L.; Andreassi, L.; Ubertini, S.: Optimization of CHCP cohort intelligence algorithm. Int. J. Mach. Learn. Cybern. 7, 427–
(combined heat power and cooling) systems operation strategy 441 (2016)
using dynamic programming. Energy 66, 387–400 (2014)
32. Shen, C.C.; Chiou, J.S.; Kuo, B.S.: Remedies for information asym-
metry in online transaction: an investigation into the impact of web
page signals on auction outcome. Internet Res. 21, 154–170 (2011)
123