Traceability of Mexican Avocado Supply Chain: A Microservice and Blockchain Technological Solution

: Currently, the Mexican avocado supply chain has some social limitations that make the traceability process a difﬁcult task and severely limits the regions that can add their harvest to the international market. We hypothesize that modernizing the traceability process and improving the trust of the ﬁnal user could help in opening the market to other regions. This paper describes the Mexican avocado supply chain characteristics, identiﬁes the actors involved in the supply chain, and emphasizes the problems that the current actors have when exporting them to the US market. On this basis, we propose a technological solution system to automate the traceability process. The system was designed to comply with the authority and consumer requirements. It proposes a combination of the beneﬁts of traditional data traceability using Microservices architecture with a new layer of Blockchain auditing that will add value to current and new actors in every step of the supply chain. We contribute by proposing a model that adds value to the avocado supply chain with the following characteristics: Integrity, auditing service, dual traceability, transparency, and a front-end application with trust user-oriented. Our proofs demonstrate that the blockchain layer does not represent a considered high extra transaction cost; it could be regarded as despicable for the economy of the consumer considering costs and beneﬁts.


Introduction
Agriculture is one of the most relevant economic activities, using millions of people, predominantly in developing countries. Particularly, the global market size of avocado has grown rapidly in the past decades, driven in part by an increase in demand from consumers seeking healthier food alternatives. The overall quality of avocado relies heavily on the management of the supply chain, from the orchards to the consumer, including factors, such as packing conditions, transportation, and storage conditions [1]. Management inefficiencies might lead to postharvest losses, particularly in developing countries [2]. Product quality is important to comply with phytosanitary standards, especially for exporting countries, such as Mexico [3], that export to other countries, mainly to the US. The authors of [3] study the Mexican avocado industry and propose an improvement only in the packer-producer relationship to assure the quality of the product and reliability of the supply.
The need to use technology for traceability in the food production sectors aims to record all the information related to the supply chain from operations with suppliers to the distribution of goods, in addition to identifying and associating important data on the environmental conditions and production techniques.
Traceability of products and activities in the agribusiness supply chain has become very important in recent years [4][5][6][7]. This need comes from the consumers' desire to be certain of the quality and safety of the consumed goods and processes that these goods

Blockchain in the Agri-Food Supply Chain
Digitization has become one of the most important ongoing transformation processes in modern agriculture worldwide [13,14]. Authors in [15] state that disruptive technologies have a wide application opportunity for sustainable management in supply chains in the food, health care, manufacturing, and infrastructure sectors.
Blockchain-based platforms offer the potential to expand the capacity and visibility of business operations, including how products are sourced, shipped, processed, and distributed to the customer. In particular, the growing importance of the sustainability of the supply chain and its management through technologies has been studied under different approaches. Authors in [16] show a proposal that discusses the initial impact of technologies toward sustainability in the supply chain through the development of a green supply chain management model for biodegradable products, which includes a strategy of subcontracting and selection of different modes of transport, with the aim of reducing carbon emissions. Considering the waste collection, reverse, and remanufacturing stages, the authors of [17] propose a green supply chain model that incorporates the cost of carbon emissions during a re-manufacturing cycle that includes manufacturers and suppliers. Other proposals around sustainability, such as those presented by [18,19] study the management of the supply chain through the development of optimal supply policies to increase efficiency, improve production systems, and process traceability.
Specifically, disruptive technologies, such as Blockchain, applied to unconventional sectors, such as agriculture, are showing great potential for solving numerous sustainability and traceability problems related to food supply chains [20].
Studies and practical applications of blockchain technology are few, especially in the agri-food supply chain [20][21][22]; however, the impact that can achieve this technology is very high, mainly for transparency in food-related issues [11]. Other studies carried out by [23], on technologies in the agri-food sector, confirm that Blockchain represents the main key factor that can contribute to potentiating the digitization of the food sector.
In particular, according to [24], the problems and negative effects produced by the mixture of products of different qualities from different suppliers represent an opportunity to implement blockchain to regulate the conditions of the food that is delivered to consumers.
To circumvent these problems, a blockchain approach has been proposed by some authors in different contexts: The Chinese food supply chain [25,26]; the Cocoa exports in Peru [27]; the meat supply chain [28].
Blockchain technology can be seen as a ledger where the information is contained in a distributed system in the form of data blocks. Every block on the chain contains information about one or more transactions in the system. The following block will be labeled with the hash of the previous block to make a verifiable link in the chain. As part of the block creation process, automatically triggered actions can be presented through programmable conditions that allow for the introduction of complex logic and additional process execution [29,30].
Among the proposals based on technological applications (Table 1), the authors of [31] propose the so-called "Banana Agro System". Other works, such as the one developed by [14], explore the contribution of technologies toward sustainability throughout the supply chain, emphasizing traceability and food safety. Incorporating blockchain with the Internet of Things (IoT), the authors of [25] propose the development of intelligent applications in precision agriculture. The research in [32] presents the results of a project in which different organizations that have used blockchain technology to encourage social impact in the agriculture sector were surveyed. In the proposal of [33], smart contracts with Ethereum are used to achieve full traceability in the proposed system. With a focus on a theoretical auction flow model, the authors of [11] propose direct access to providers as an alternative for transparent information delivery for transactions among entities. The research in [34] presents a study on the challenges of the agri-food sector, emphasizing food security, delayed transactions and data verification, climate change, contamination incidents, food fraud, and lack of trust and transparency. Authors in [35,36]  Internet of Things in agriculture, recent advances, and future challenges [14] 2017 Technological applications with RFID E. Internet-of-things Paradigm in Food Supply Chains Control and Management [31] Blockchain application in food supply information security [25] RFID and IoT Food traceability in recent times is a growing concern for commercial and academic industries. In this regard, the authors of [38,39] address different reference frameworks for the improvement of technologies in the agri-food supply chain with commercial applications of Blockchain. Moreover, the research in [41] identifies functionalities that can be applied in the environment of the agri-food sector. Under a transparent and traceable system, the authors of [40] conceptually describe an application for the food products market in Malaysia that covers all aspects of the supply chain.
Proposals, such as the tracking and traceability of food products through the use of RFID tags and the use of Internet of Things (IoT) sensors, are some of the applications based on blockchain which are being developed in Italy, the United States, Brazil, and South Africa [23,37].
To demonstrate the feasibility of using blockchain in the agri-food supply chain, the authors of [42] incorporate a technological solution using the Ethereum blockchain and smart contracts, to track and carry out commercial transactions. Authors in [23] present another instance of the effective implementation of technology in the lumber industry, in which blockchain has been employed to deliver traceability.
Using a social and economic approach, the authors of [43] show a real case of a business network for Brazilian agricultural exports. With an approach on technology for traceability, the authors of [44] present a proposal for the integration of an information system for traceability based on blockchain, radio frequency identification (RFID), barcode technology, and QR codes applied in a fruit supply chain. Furthermore, authors in [21] present an implementation of blockchain in a coffee supply chain through a reference framework for traceability and transparency.

Avocado Global Market
The global market size of avocado has grown rapidly in the past decades, driven in part by an increase in demand from consumers seeking healthier food alternatives [33]. As an illustration of this trend, avocado consumption in the US increased about five-fold from 2000 to 2018. The consumption in the US was estimated at 1 million metric tons (MMt).
Mexico leads the total consumption of avocados in the world. Mexico's avocado consumption is all domestically produced. The US is the second place, followed by the European market [45].
Avocados are also used to produce cooking oil; however, avocado oil is a relatively new product with a low production volume compared to other cooking oils. It is estimated that avocado oil production is about 2000 MMt per year worldwide. The main producing countries of avocado oil are New Zealand, Mexico, Chile, the US, and South Africa [46]. Unfortunately, there is not enough public information about the consumption and production of avocado oil [47].
Avocado production in 2017 is estimated at about 6 MMt globally, representing an increase of 65% from 2010 [48]. Mexico is the main avocado producer in the world [49]. About half of Mexico's avocado production is exported, mostly to the US and to a lower degree to Japan, Canada, and Europe. More than 80% of the US, Japan, and Canada's avocado imports come from Mexico [45].
The US is the largest avocado importing country in the world [50]. Imports from Central and South American countries are very low, due to their domestic production.
The Mexican government estimates that by 2030 Mexico's avocado production will exceed 3 million metric tons, out of which more than 2 million metric tons are estimated to be exported [51]. This constitutes an estimated annual growth in domestic production and exports of 3.5% and 5%, respectively.

Mexican Environment
Mexican avocado sowing is carried out by transplantation. The most recommended soils for planting are those of light deep texture, and neutral or slightly acidic pH (5.5 to 7) [52]. There are 400 varieties of avocado, but due to the ease of packing, durability, and nutritional properties, the Hass-type has higher commercialization and demand. The plant is sensitive to cold and environmental humidity, thus its establishment is advised in regions free of frost and hot and dry winds. Temperature and precipitation are the two factors with the highest incidence in crop development. Its cultivation is recommended at altitudes between 800 and 2500 m, in clayey or clay-loam soils, with good drainage conditions. Due to these cultivation characteristics, avocado production in Mexico is concentrated in the state of Michoacán, which contributes to 80% of national production. The two largest producing states after Michoacán are Jalisco and Mexico State.
Until the year 2021, only producers in certain municipalities of the state of Michoacán were allowed to export avocados to the US, this year the ban was lifted also for the state of Jalisco. The rest of the main producing states export to Canada, Japan, Europe, and China, mainly. The municipalities in Michoacán certified to export the fruit are Acuitzio, Apatzingan, Ario, Cotija de la Paz Erongarícuaro, Hidalgo, Irombo, Los Reyes, Madero, Nuevo Parangaricutiro, Parácuaro, Periban de Ramos, Salvador Escalante, Tacambaro, Tingúindín, Turicato, Tuxpan, Uruapan, and Zitacuaretiro [53,54].
In order for the municipalities to be certified, they must be sampled two times per year and be free of the large borer of the avocado bone and the avocado pests. All packers that export avocados to the US must be registered with the PSV and certified by the DGSV and APHIS two times per year, before 15 December and 15 June of each year, and must be listed in this Plan of work. The PSV must verify that they comply with all specifications before granting certification approval [55].

Analysis of the Information Flow over the Avocado Supply Chain
Information technologies (ITs) are substantial for shaping the supply chain value since they transform the way in which the chain activities are carried out and the links between them. Moreover, they directly impact the scope of the companies involved by allowing access to a greater number of clients in different value sectors. Furthermore, they allow close contact with the end customer's needs and trust over the entire value process. This is the reason why today, ITs acquire a strategic value.
Given the above, this section analyzes the entire avocado supply chain process. In subsequent sections, we will provide a technological solution.

Entities
In the whole avocado supply chain, we have identified the following involved entities as those who have contact in some way with our proposed solution: Transportation vehicles, harvesters, packing facilities, distributors, customs services, and sell points. They will interact with each other by means of the passing of merchandise or information. The merchandise consists of the avocados packed in different ways to suit the needs of the current link on the chain. Through the process, the avocados will be collected as individual pieces in the orchard. They will be placed together in a harvest batch and sent to a packing facility, where every avocado will be classified according to its weight and physical appearance. The avocados will be packed as batches of different qualities and sent through a distribution process that can consist of one or more distributors. The distributors can, at their convenience, repack the avocados into smaller batches to suit their needs. Once they arrive at the US border, they will pass customs, and will be received by another distributor, where eventually, they will be packed individually and sold to the final consumer.
Currently in Mexico, the avocado supply chain uses information technology as support for a classical agronomy supply chain [56]. An orchard owner sells the right to a distributor (farmer) to pick fruits from his property. The distributor deals with the agronomical practices needed for trees and fruit care. They have a digital and written log with records of plant nutrition, soil handling, facilities, tools, employee training, climate and environment, crop protection, pollination medium, seeds, substrate sterilization, etc. The objective of these practices is finally to protect the health of the final consumers.
Next, the distributor in charge of packing the crop (packers) will create a series of documents to handle them. The list of documents includes a request order, request supply, periodic crop handling reviews, quality filter report, phytosanitary filter reports, and crop ripening reports. These reports will be handled along the supply route to different authorities and area managers.
Along the handling, carriers will also need permissions and reports to transport the product to its final destination, starting with exit checks, international export permits, and national carrying permits.
Finally, intermediaries and retailers (merchants) will also have to document the purchases they make and validate their information with the distributors. The documentation handling and verification in the whole chain is currently not stored in a single databank, given the different actors and authorities involved. Our proposal will directly make an impact in the process as a verifiable source of information along every step.

Participants
The Mexican avocado supply chain involves some actors from the starting point of harvesting to the end stage of the consumers. The actors are as follows:

1.
Farmer is in charge of the harvest of the avocado orchard and will pick the order.

2.
Carrier ensures the technological means required to transport the harvest. It transports the avocados from one point to another in the supply chain.

3.
Packers receive an avocado lot from the orchard through a carrier. They are located in a packing facility and are the first to introduce the avocado fruit as a product on the supply chain.

4.
Merchant receives an avocado lot from the packers and will have the task of introducing the avocado product to the final consumer or other merchants.

5.
Consumers are considered the last participant in the supply chain. In this step of the chain, the avocado is finally a consumer good. Even if it can be used as raw material for a series of secondary products (avocado beauty products, avocado oil, avocado sauce), the bulk of the consumption of avocado is as a food item [57].

Information Flow
We propose a model that will monitor the avocados at every mentioned step. The actors will interact at different stages with the avocado fruits and every interaction will be recorded to provide the promised traceability. Based on the study of the case, the following interactions will be recorded, the interactions are presented as user stories: • The farmer will notify the packaging facilities about a harvest day. In this way, they will be informed of the imminent arrival of a truck full of avocados.

•
The carrier monitor will create a new harvest batch with the information reported by the farmer. In this way, the new harvest batch can be updated with more information every time there is an update. The carrier monitor will also verify that the truck assigned to the harvest is in the orchard and add the information to the batch. In this way, the system can survey the weather and soil conditions of the harvest using the collected information. Finally, the carrier monitor will timestamp the beginning and end of the journey when the harvest truck leaves the orchard and arrives at the packing facility.

•
The packer will create different batches adding to them the information of the harvest batch that arrives at the packing facility. Avocados can be classified according to their quality without losing the previously collected information. The packer will also mark every batch packed with its corresponding label (or QR). Any user with direct access to the label will be able to identify the batch. Finally, a packer can generate new labels (QRs) in a distribution center to re-pack a batch in individual units or smaller packages. In this way, they can be distributed according to their specifications, without losing the traceability information. • Merchant is responsible for marketing the product in the market to wholesalers. The wholesalers buy the product to sell it to different buyers, a buyer can be directly a consumer or a retailer. Retailers purchase the product that was purchased in bulk and sell the product to different consumers. • Any consumer can scan the label (QR) of a batch to obtain information about traceability to verify the origin of their avocado.

Technical Proposal: Microservices and Blockchain
Most of the works analysed in Sections 2 and 3 include Blockchain as the primary mechanism of providing traceability and transparency. However, Blockchain technology has been commonly criticized by its energy consumption when mining transactions. On the other hand, one of the more specific strengths is providing trust. To balance both aspects, we propose a combination of Off-chain storage and Blockchain verification similar to [57]. This combination allows for light mining of low energy consumption that does not limit taking advantage of all the safety and transparency features offered by Blockchain. We propose the use of a microservice architecture connected to a Blockchain and coordinated by an Intelligent API-Gateway Server, similar to those proposed in [57,58], which receives data from user interfaces from an avocado supply chain. Figure 1 outlines our model, which consists of three general parts: Left part the supply chain, right part Audit Architecture, and Blockchain. has been commonly criticized by its energy consumption when mining transactions. On the other hand, one of the more specific strengths is providing trust. To balance both aspects, we propose a combination of Off-chain storage and Blockchain verification similar to [57]. This combination allows for light mining of low energy consumption that does not limit taking advantage of all the safety and transparency features offered by Blockchain.
We propose the use of a microservice architecture connected to a Blockchain and coordinated by an Intelligent API-Gateway Server, similar to those proposed in [57] and [58], which receives data from user interfaces from an avocado supply chain. Figure 1 outlines our model, which consists of three general parts: Left part the supply chain, right part Audit Architecture, and Blockchain.

The Supply Chain
In the supply chain in Figure 1a, different microservices that send or receive data to the API-Gateway microservice are observed, which are composed of Farmer, Carrier, Packers, Merchant, and Consumer.
1. Farmer: A harvest crew will arrive to an orchard at a specific time. The crew leader will then add to the system a pick-up harvest time to start the traceability. He will include the GPS information and photographs in situ. With this information, the server will obtain satellite imagery of the site and estimate the conditions of the orchard. To identify the harvest, a label (through a QR code) will be generated. 2. Carrier: The avocado batches will be carried around to one or more distribution centers. The travel will be registered by a carrier monitor that will register the transportation vehicle's GPS to have a real-time information on the complete route. It might also help that the product arrives toward its destiny at an optimal time. The distribution center can generate smaller batches from the ones received. These new batches will be marked with a new label (QR) that will register the original batch and the date of repacking. This process will repeat until the avocados are tagged individually, or in their final package, ready to be sold to a consumer or retail point. 3. Packers: A packer will get the harvest batch and process the avocados according to their size and visual examination. The avocados are then packed in boxes sorted by quality, and request from the system the printing of a physical label with QR that will mark the created batch. This will allow for the traceability of the avocado fruits as a group package.

The Supply Chain
In the supply chain in Figure 1a, different microservices that send or receive data to the API-Gateway microservice are observed, which are composed of Farmer, Carrier, Packers, Merchant, and Consumer.

1.
Farmer: A harvest crew will arrive to an orchard at a specific time. The crew leader will then add to the system a pick-up harvest time to start the traceability. He will include the GPS information and photographs in situ. With this information, the server will obtain satellite imagery of the site and estimate the conditions of the orchard. To identify the harvest, a label (through a QR code) will be generated.

2.
Carrier: The avocado batches will be carried around to one or more distribution centers. The travel will be registered by a carrier monitor that will register the transportation vehicle's GPS to have a real-time information on the complete route. It might also help that the product arrives toward its destiny at an optimal time. The distribution center can generate smaller batches from the ones received. These new batches will be marked with a new label (QR) that will register the original batch and the date of repacking. This process will repeat until the avocados are tagged individually, or in their final package, ready to be sold to a consumer or retail point.

3.
Packers: A packer will get the harvest batch and process the avocados according to their size and visual examination. The avocados are then packed in boxes sorted by quality, and request from the system the printing of a physical label with QR that will mark the created batch. This will allow for the traceability of the avocado fruits as a group package.

4.
Merchant: The QR attached to each avocado individually will be available for final customers to query specific useful information to the consumers. With this, retailers might also receive assurance about the quality, origin, and organic features, amongst others.

5.
Consumer: The final consumer will interact with a front-end (mobile) with some useful and interesting information about the fruit: Origin, orchard conditions, distribution channels, and on-side photos, amongst others.

Audit Architecture
Blockchain is a tendency technology to be used in auditing applications; however, it has been widely hammered for requiring storage expenses and high computation in its transactions. Considering that many organizations have been born with off-chain systems, we provide a solution considering both parts: The supply chain via off-chain; and a hashing data of all transactions via blockchain.
The Audit Architecture will work in a similar way as proposed in [58,59]. This is an interface storing all data in the blockchain. As you can see in Figure 1c, it is composed of three microservices: API-Gateway, Audit, and Users: • API-Gateway is the controller of our model and communicates internally with Audit and Users microservices. It is focused on attending requests from the supply chain and emitting answers. • Audit microservice interacts with the Blockchain, in particular, to execute two operations: Storing and consulting information for audit issues. Let D be a set of data to be stored within the supply chain and composed of d 1 , d 2 , and d n , which are individual data registered previously in the avocado supply chain; T be a timestamp, containing current date information; and Id is an identifier of the transaction. D, T, and Id are stored within the Off-chain, while only the result of the hash function (x = Hash(D, T, Id) and Id is stored within the Blockchain. To validate the information, the consulting service will be used. After requesting the validity of information I, it consists in getting x, the hashed information previously stored within the Blockchain, through the blockchain. Comparing Hash(I) with x should be equal. If it is held, transaction data t, which are obtained through a read operation with the blockchain, must be shown to the user, otherwise, an error must be shown.

•
User microservice permits the knowledge of whether the requests received from Audit or API-Gateway might be executed; this service acts as an access control service management. User microservice provides the following services: Administration to create, update, and delete users; authentication to validate the control access of the users using tokens; and authorization to provide the permissions of the user.

Blockchain
As you can see in Figure 1b, our model includes the blockchain part. Although the users in the whole system are: Farmer, Carrier, Packer, Merchant, and Consumer; we have established a general type of user within the Blockchain called TUser. This role is delimited by the operations shown in Table 2. The columns of the table pinpoint if the operation requires Reading or Writing in the blockchain, the data are marked with uppercase letter X.

Operation
Read Write Let K + p state a public key address, D be data information, and id be an identifier where D is stored; [D] be a set of data; and l be a log data information. The smart contract operations work as follows: • TUser (K + p , typeU) denotes the constructor of the smart contract. Key K + p is required to initialize the contract and the type of user typeU. • id = setData(D) adds data D, returning id, which indicates an identifier of the transaction; • D = getData(id) returns data D in the contract, id is used to find the data. • typeU = getTypeUser() returns the type of user of the contract.
• [D] = getLogs() gets all logs stored in the contract. • l = getLog(id) gets a specific log stored in the contract and identified with id.

Prototype
To give a general idea about our technological solution, we provide a prototype. This section is divided into three: (a) First, we explain the ingredients required to feed the supply chain of the avocado together with some technical explanations; (b) we include some technical details in the back-end including details in both the off-chain and the blockchain part, then we explain how integrity and traceability are carried out; (c) we explain the mobile interface that a final user will use to see the traceability process of the avocado supply chain. Figure 2 shows an example of how a user is created. In particular, the image shows a root creation example, but it is similar to another type of user. The explanation is as follows:

Feeding the Supply Chain
1. The Root is created through a web form with information input by some user. 2. The system generates a series of credentials that can be visualized in part two of the image.
• Token is generated with the purpose of showing to the user the identifier generated via the off-chain of this creation. • Contract address is the address that identifies the contract in the blockchain. • Transaction address is generated together with the contract, and identifies the specific transaction within the blockchain.

•
Hash is the hashed data of the user, which is composed of the email, username, password, surnames, etc.  Figure 3 illustrates the traceability services developed for the avocado supply chain. The images were obtained from the Postman application, which was used to consume the Restful API services. Part one of the figure shows all collections that were used to build the supply chain. These collections are grouped services and contain all services, as shown in Figure 1. Parts two and three show specific fields of Productor and Merchant stages, respectively. The fields of these stages are very similar, but they differ in very few fields.   Figure 1. Parts two and three show specific fields of Productor and Merchant stages, respectively. The fields of these stages are very similar, but they differ in very few fields.  Figure 3 illustrates the traceability services developed for the avocado supply chain. The images were obtained from the Postman application, which was used to consume the Restful API services. Part one of the figure shows all collections that were used to build the supply chain. These collections are grouped services and contain all services, as shown in Figure 1. Parts two and three show specific fields of Productor and Merchant stages, respectively. The fields of these stages are very similar, but they differ in very few fields.   Figure 4 shows an example of the steps to add data to the avocado supply chain. It is exemplified in the merchant stage (for the other stages involved, the views and steps were quite similar), as follows:

1.
Part one of the figure shows a form, which is filled out with the data that the user wants to register.

2.
Part two of the figure shows the location of the stage, such as orchards, packing houses, shops, etc.

3.
In Part three of the figure, once the form is sent, a QR is generated, which can be scanned using the mobile application (explained in detail in Section 6.3).
Sustainability 2022, 14, x FOR PEER REVIEW 12 of 19 Figure 4 shows an example of the steps to add data to the avocado supply chain. It is exemplified in the merchant stage (for the other stages involved, the views and steps were quite similar), as follows: 1. Part one of the figure shows a form, which is filled out with the data that the user wants to register. 2. Part two of the figure shows the location of the stage, such as orchards, packing houses, shops, etc. 3. In Part three of the figure, once the form is sent, a QR is generated, which can be scanned using the mobile application (explained in detail in Section 6.3).   Figure 5 shows independent microservices' tables, such as Farmer, Packer, Carrier, Merchant, Consumer, and a master distributor table called Traceability. Each of the tables includes registers information linked via column THash (transaction hash) with the blockchain. In the tables, column Id denotes an identification of the register; column Data denotes the general information of the stage; for example, it could be those input data fields shown in Figure 4; column Hash denotes the hash function applied to Data, with h = H(x) indicating that h contains the calculated hash function H with data x information; and column THash contains the transaction Hash obtained from the blockchain where the hash value is also registered. Table Traceability  Each register data stored via off-chain, as shown in Figure 5, is also stored in the blockchain in a hashed way. Figure 6 illustrates a dummy example of how it is stored. For example, data f1 and H(f1) are stored in table Farmer via off-chain; in the blockchain only H(f1) is stored, see block number 0, Figure 6; tf1 is the linked data between the off-chain and the blockchain part. The integrity consists in checking that both tf1 from block number 0 in the blockchain must be equal to the register in the Farmer table via off-chain. The tree shown in the upper right part of the figure illustrates the traceability process via off-chain. For example, in the right part of the tree shown below, you can see a consumer with id 11, and you can check it in the respective register of the Consumer table; which is linked with the id T11 of the Traceability table. The tree is formed or linked in the Traceability table with FId the father id T10; but T10 is at the same time Id in the upper register; you can follow these two columns to form the traceability.

Traceability and Integrity via Off-Chain Database and Blockchain
Each register data stored via off-chain, as shown in Figure 5, is also stored in the blockchain in a hashed way. Figure 6 illustrates a dummy example of how it is stored. For example, data f 1 and H(f 1) are stored in table Farmer via off-chain; in the blockchain only H(f 1) is stored, see block number 0, Figure 6; tf1 is the linked data between the off-chain and the blockchain part. The integrity consists in checking that both tf1 from block number 0 in the blockchain must be equal to the register in the Farmer table via off-chain.
Each register data stored via off-chain, as shown in Figure 5, is also stored in the blockchain in a hashed way. Figure 6 illustrates a dummy example of how it is stored. For example, data f1 and H(f1) are stored in table Farmer via off-chain; in the blockchain only H(f1) is stored, see block number 0, Figure 6; tf1 is the linked data between the off-chain and the blockchain part. The integrity consists in checking that both tf1 from block number 0 in the blockchain must be equal to the register in the Farmer table via off-chain.  Figure 7 shows the outstanding interfaces from the mobile application: (1) Login interface where the user might sign in by a previous register or by social networks (Facebook in this case); (2) login process with a social network; and (3) a menu option with the possibility to scan QR codes to see the traceability of the avocado that the user wants to buy.     2. Blockchain Address: This part of the figure is a button with the blockchain icon, where the final user can see the different blockchain Addresses, such as the Address contract, Address transaction, and the hash. 3. The log in the blockchain: Part three of the figure illustrates the interface that the final user can see for each stage, this interface shows the details that are stored in the blockchain. This information shows evidence that the traceability process is being stored in a blockchain network.

Discussion
The research questions presented in the Introduction are answered as follows: We have created a technological solution which is capable of providing bigger trust to consumers containing the following characteristics: Integrity, auditing service, traceability, and providing a front-end application oriented for consumers to trust the traceability of the avocado supply chain, as described in Table 3. Table 3. Characteristics provided by our model.

No.
Characteristic Description

Integrity
The reliability and trustworthiness of data are commonly referred to as data integrity. By design, blockchain is inherently resistant to data modification; it indicates that each block in a blockchain links to the previous one, and each block contains a cryptographic hash algorithm of the contained data, as supported and described in Section 5.2.

2
Auditing service As supported in Section 5 (and illustrated in Figure 1), one of the microservices has the auditing task, which could be used in an auditing procedure since all events generated in the supply chain are stored in a hashed way. These events could also be audited since this is one of the characteristics provided by blockchain technology.

Dual traceability
As shown in Figure 5 (Section 6.2), it includes a traceability mechanism using off-chain storage technology. Additionally, it includes the traceability characteristic included implicitly in blockchain; however, in our case, it only stores hashed event messages, as demonstrated in Figure 8 (Section 6.3).

Transparency
Our model, by including the public blockchain, users (using the suited interface) can publicly track the data with full transparency, as shown in Figure 8 (interfaces 2 and 3). With respect to providing a technological solution that considers cost-efficient aspects, as stated in our research question, we issue the next explanation. With Blockchain added to our proposal, it might be impacted in an extra transactional cost. For example, in our proof, the average of each transaction cost was Wei 43,300. Wei refers to the smallest denomination of ether (ETH), it is the currency used on the Ethereum network; 1 ether (ETH) is equivalent to 1 × 10 18 Wei. However, a read consult process in the blockchain does not represent an extra transaction cost. Therefore, considering that an avocado before being acquired by a final consumer must previously have crossed the four stages pinpointed in Section 5.1 (Farmer, Carrier, Packers, and Merchant), the minimal total cost would be Wei 216,500, which is a minimal amount if it is included in the fruit cost. For example, at the time of writing this article 1 Ether is USD 1466.63; it indicates that Wei 216,500 is equivalent to USD 0.00000000031753. Our proofs were executed in a local environment using Ganache technology to simulate the blockchain network. These estimates do not include those costs generated by the software development nor the maintenance costs required to operate a supply chain system (for instance, cloud computing or updates).
We close this section with some assumptions derived from this research. We believe that our model could help in minimizing (or eliminating) the untrustworthy perception of the Mexican avocado supply chain market. Although we consider that our solution might have an important impact in the supply chain area, it is still a prototype solution with a very acceptable local opinion and several technical proofs, as demonstrated in [59]. Therefore, the technology transfer is still an exploration step and thus the business practice will be included for future research. We believe that our solution could open another market outside of Michoacán (currently the main avocado harvester state in Mexico); inclusively, it could potentiate the Michoacán market. However, this study will be part of future research. Finally, although our solution is focused on the avocado market, it could be adapted to other similar products.

Conclusions
The Mexican avocado supply chain has a series of features that make it a unique case study. One third of the global production is carried out in Mexico, from which 90% is exported to the US. Eighty percent of Mexican avocados are produced in the state of Michoacán. This concentration is not only due to climatic, soil, and altitude considerations, but also due to the fact that it is easier for the big actors of the market (associations and unions) to solidify their efforts to comply with the phytosanitary restrictions made by the USDA-APHIS and DGSV in smaller, well-delimited specific municipalities. The full set of requirements, including continuous tests, registers, and checks that have to be implemented, are currently the main obstacle for new actors to appear on the market. On the other hand, these requirements are unknown by the consumers who could appreciate these steps while buying quality fruit.
The solution presented in this paper not only simplifies the process of collecting information about the traceability of the avocado from harvest to final sale, but also adds value to the avocado supply chain with the following characteristics: Integrity, auditing service, dual traceability, transparency, and a front-end application with user-oriented trust. In this context, we have used a combination of Off-chain data management with Blockchain verification to allow a distribution company to maintain their data while taking advantage of the security and auditing that is added by Blockchain. The Off-chain model contains the information required by the named agencies to comply with quality controls while proofing against tampering using Blockchain. The information contained will also allow users to consult the information that can be useful to decide whether the product is good for them, by having quality assurances and information about the orchard and harvesting.
Currently, a typical concern when involving applications including blockchain is related to transactional costs. However, our proofs demonstrate a minimal extra cost that could be added to each avocado fruit; for instance, less than a penny (USD 0.00000000031753). Our proofs were carried out with ETH (the Ethereum coin) in a local environment.
It is noteworthy to mention that although our solution has been subjected to several tests, it is still a prototype solution with a very acceptable local opinion.
Furthermore, we herein consider that our solution might open the market to new Mexican geographical locations that suppliers can expand, causing benefits to more communities.