## 3 Proposed Architecture
### The Development and Deployment of Smart Contracts  
In this paper, we design, create, and deploy different smart contracts for secure stakeholders' registration, adding nodes of new transactions, efficient update ledger, and protected preservation, as shown in Table 2. Contract 1 (secureStkRegister() and addRecord()) is designed to initiate the registration of new participants. The blockchain hyperledger sawtooth engineer is the responsible person who registers stakeholders after detailed verification and validation. The purpose of this contract is to maintain a platform for the secure and smooth exchange and broadcast of agricultural information directly among participating stakeholders. The function of secureStkRegister() of the contract is implemented to aggregate and run commodity price forecasting information and management,where the engineer manages each transaction execution, logs executions and management, and records addresses accordingly, as mentioned in the defined consensus policy [26,27]. This contract also records additional information for privacy purposes, such as stkID(), stkName(), stkRole(), rRecords(), forecastInfo(), addNewNodeTran(), exchangelInfo(), timestamp, system [execution], and other activities. \begin{table}
\begin{tabular}{l l} \hline \hline
**Contract \#1: Stakeholder Registration and Exchange New Node Transactions Registration** \\
**System Initialization:** Blockchain Hyperledger Sawtooth Engineer Initiate Agriculture System \\
**Data Collection:** Day-to-Day Records Captured from Agriculture Commodity Department \\   Received Records from Production and Supply Chain Sectors \\   Captured Data from Agriculture R\&D Department \\   Partial Data Collection from Regional State \\   Add Individual Transaction Addresses \\
**Input Variables:** file.[type].txt \\   int main(): \\   stakeholder ID \\   stkID(); \\   stakeholder name \\   stkName(); \\   stakeholder role \\   stkRole(); \\   stakeholder access details \\   stkAccDetails(); \\   received records \\   rRecords(); \\   forecast information \\   forecastInfo(); \\   add new node transactions \\   addNewNodeTran(); \\   exchange information \\   exchangeInfo(); \\
**Process:** & **Blockchain Hyperledger Sawtooth** timestamp, \\   system [execution]; \\   Metaheuristic-Blockchain-Based Stakeholder Registration and Add New Transaction Contracts \\   Add overall transaction after verification and validation by Engineer and Record Addresses \\
**if** file.[type].txt \\   int main(): Metaheuristic-Blockchain Sawtooth Engineer is == true; \\   then, if & records of participating stakeholder are not in the stored data \\   then, & add new records \\   change state of distributed ledger; \\   counter + 1 after registration; \\   similarly, exchange information after adds new record details; \\   [PERSON] is the only responsible person who managed addresses of all the transactions \\   [PERSON] also manages stkID(), stkName(), stkRole(), stkAccDetails(), rRecords(), forecastInfo(), \\ addNewNodeTran(),exchangeInfo(), timestamp, system [execution]; \\  **else** & all the executed transactions verified, analysis error, update state, and trace individually \\   terminate; \\
**else** & all the executed transactions verified, analysis error, update state, and trace individually \\   terminate; \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Pseudocode of smart contracts implementation. The addRecord () function is used to provide an automated service of events for node transaction execution and management in a distributed network, as well as to directly broadcast new information to stakeholders [28; 29]. This function calculates the size of the transaction and the party who initiated the transaction; moreover, it calculates the changes in the hash after the new transaction occurs, as shown in Figure 3.