Delegated Computation Architecture and Implementation for Numerical Simulation of Electromagnetic Comprehensive Performance Under the Framework of Blockchain

In view of the significant computational resources required for numerical simulation of electromagnetic comprehensive performance in modern electrical equipment, and the security and transaction fairness issues of existing delegated computation schemes, we propose a delegated computation scheme under the blockchain framework that is suitable for numerical simulation of electromagnetic comprehensive performance. This scheme combines the multi-level data characteristics of electromagnetic field numerical simulations with practical needs. Firstly, we propose a method for handling multi-layered data in delegated computation. Secondly, we design a delegated computation architecture that involves at least three participants and a detailed transaction mechanism, and develop three smart contracts to ensure data privacy protection and transaction fairness in delegated computation. Finally, the feasibility of the proposed scheme is proved by delegated computations for “Solving the Poisson equation of two-dimensional electrostatic field” and “Optimization of amorphous alloy transformer”. The research results have achieved a reliable and credible solution to the large-scale data computing problem in the field of numerical simulation of electromagnetic comprehensive performance, and provided a new theory and solution for data security in this field.


I. INTRODUCTION
With the development of network technology, the computing that users cannot complete locally due to the limitation of their own computing capacity or resources can be completed through cloud computing or supercomputer. Compared with supercomputer, cloud computing can link a large number of storage resources, computing resources and software resources together in the form of resource pool [1], which is more convenient to use, easier to obtain and more flexible. Users can delegate tasks to other cloud computing, The associate editor coordinating the review of this manuscript and approving it for publication was Guido Lombardi .
supercomputer or hybrid platforms that are not completely trusted but have strong computing power or sufficient resources, thus the new computing mode of delegated computation was born [2], [3]. The numerical calculation of electromagnetism is commonly done using two methods: Partial Differential Equation (PDE) and Integral Equation (IE). These methods offer high solution accuracy and are extensively used to solve practical electromagnetic problems with complex geometry and material structure. However, they require a high amount of memory. As the topology of modern electrical equipment becomes more complex and the requirements for its characteristics become higher, the electromagnetic comprehensive performance analysis also becomes more demanding. It gradually expands from low to high precision and even requires consideration of service conditions, along with optimization solution problems, making the computational resources required increasingly huge. Therefore, introducing delegated computation in the field of numerical simulation of electromagnetic comprehensive performance is crucial.
The traditional delegated computation scheme is mainly divided into three parts: delegated computation scheme based on audit and security hardware, delegated computation scheme based on computational complexity theory and delegated computation scheme based on cryptography [4], [5]. However, the above schemes cannot guarantee the fairness of transaction. In order to promote the honest trading of participants, the game theory idea was introduced and the rational delegated computation was born [6], [7], [8], [9].
The key problem of delegated computation is how to ensure data security and transaction fairness. First, there may be external attackers who maliciously tamper with or steal data, resulting in unsafe data transmission and storage. Secondly, after the computing is completed, how to realize the fair exchange of computation results and payment fees to ensure the rights and interests of all participants is also a matter of concern [10]. Finally, the participants do not trust each other, and the transaction data is usually recorded by centralized regulator, which easily leads to problems such as data security reduction and trust crisis of regulator [11].
Blockchain originated from bitcoin. In 2008, Satoshi Nakamoto published ''Bitcoin: A peer-to-peer electronic cash system'', which first proposed the concept of bitcoin. As one of its underlying support technologies, blockchain technology has been increasingly valued. So far, the application of blockchain has gone through three stages. Blockchain 1.0 refers to the application of blockchain in the era of virtual currency represented by bitcoin. Blockchain technology provides a distributed shared ledger and decentralized digital payment system. The most prominent feature of blockchain 2.0 is smart contract. Users can form rules into smart contract in the form of codes and put them into the blockchain. This makes blockchain technology applicable to financial fields other than virtual currency or applications that use simple rules. Blockchain 3.0 refers to the application of blockchain technology to various distributed scenarios of human society. Blockchain technology has data encryption, tamperproof, and decentralized that enable a delegated computation scheme to operate without additional centralized regulators. This eliminates the possibility of regulators leaking data or favoring one party over another. Additionally, it ensures the security and integrity of data during storage and transmission, and eliminates the trust barrier between participants [12]. These functions are very compatible with the needs of delegated computation, making it necessary to introduce blockchain technology into delegated computing. Scholars from Xi'an University of Electronic Science and technology have proposed a fair payment scheme for delegated computation based on blockchain, but this scheme requires a semi trusted third party [13]. American scholars proposed a distributed payment system based on blockchain and smart contract, which uses trusted execution environment and smart contract to enforce the correct behavior of users. The system is efficient and has privacy, but the cost is high [14]. Scholars of Northeast University proposed an audit scheme for remote entrusted data of industrial Internet of things based on smart contract, but the audit process and results of the scheme are public [15]. Scholars from Hainan University put forward a polynomial computing scheme based on blockchain, which completes delegated computation through blockchain smart contracts [16]. Malaysian scholars have proposed a scheme combining cloud computing and blockchain, and applied blockchain technology to solve the problem of cloud computing data leakage [17]. Scholars from Xi'an University of Posts and Telecommunications proposed an efficient and stable fair payment scheme for cloud computing entrusted services based on the blockchain, which can complete the transaction without a third party [18]. Scholars from Guizhou University put forward a decentralized fair payment entrusted computing scheme based on the blockchain to ensure the payment fairness of participants [2]. Scholars from Singapore University of management have proposed a fair payment framework for entrusted services based on blockchain in cloud computing to achieve safe and fair payment of entrusted services without relying on any third party [19]. Scholars from Wuhan University put forward an optimized fair payment system model based on the blockchain, which combines encryption technology with smart contract to ensure fairness and low cost [20]. However, these schemes cannot meet the practical requirements of the multi-level data characteristics of numerical simulation of electromagnetic comprehensive performance and the delegated computation architecture and mechanism in this field. The numerical simulation of electromagnetic comprehensive performance has different data levels and different privacy requirements. In general, a single computing party cannot meet the actual computing requirements, and it is necessary to introduce multiple computing parties or even other types of participants. It is very important to ensure the security of multi-level data and the fairness of multi-party transactions.
In this paper, the blockchain technology is introduced into the delegated computation of numerical simulation of electromagnetic comprehensive performance. Firstly, the multilevel data characteristics are analyzed, data classification is carried out, and different types of data processing methods are given. A complete decentralized delegated computation architecture with the security of multi-level data and the fairness of multi-party transaction is constructed. The key technical issues are deeply studied from four aspects: the security of data transmission, data tamper proof, interactive automation, and unified ledger of the whole network. Secondly, under the proposed architecture, the transaction mechanism between the participants is designed, and the transaction process is explained in detail. How to use smart contract to achieve automatic interaction, protect data privacy and maintain transaction fairness is introduced. Finally, the proposed architecture and mechanism are verified by two delegated computation examples of ''Solving the Poisson equation of two-dimensional electrostatic field'' and ''Optimization of amorphous alloy transformer''.

II. DELEGATED COMPUTATION ARCHITECTURE FOR NUMERICAL SIMULATION OF ELECTROMAGNETIC COMPREHENSIVE PERFORMANCE UNDER THE FRAMEWORK OF BLOCKCHAIN
In this section, we first define some notations, as shown in Tab.1. Then, the data types in the numerical simulation of electromagnetic comprehensive performance are analyzed and the corresponding processing methods are given. The design objectives are proposed and the delegated computation architecture is constructed. Finally, the related key technical issues are studied.

A. MULTI-LEVEL DATA PROCESSING
The blockchain can store transaction records, but the block capacity is limited. For example, the block capacity of the bitcoin blockchain is only 1MB. The privacy requirements of the data related to the delegated computation process are also different. Aiming at the multi-level data situation of numerical simulation of electromagnetic comprehensive performance, the data is classified according to the data level and privacy degree, and different types of data are processed with different methods.
According to the block capacity, a value is set as the distinguishing mark between lightweight and heavyweight data. Lightweight data can be directly uploaded to the blockchain or uploaded after compression, while heavyweight data needs to be uploaded to a file server firstly and then the storage address is uploaded to the blockchain. The privacy level of the data is divided into three levels: low, medium, and high, based on the viewable range requirements set by the data sender or other participants. All data cannot be tampered with. Data with low privacy level can be made public, such as delegated task information, and can be uploaded directly to the blockchain or file server. Data with medium privacy level are only visible to participants, such as calculation models, and need to be encrypted before uploading. Data with high privacy level are only visible to specify participants under specific conditions. For example, in order to verify whether other participants have the ability to complete the task before actually computing the real task, the delegator can ask them to compute a case with known result, and the result cannot be seen until they complete the computation. Such data needs to be encrypted and the viewing strategy needs to be set using smart contracts. Please refer to section III for detailed strategies. According to the above classification rules, the data is divided into six categories, as shown in Tab The design goals of this architecture are mainly to ensure the security of multi-level data and the fairness of multi-party transaction.
• The security of multi-level data. All data involved in delegated computation cannot be tampered with during transmission. The transaction is recorded by the blockchain, and the transaction record cannot be tampered with. Some private data can only be viewed by other participants after meeting the conditions.
• The fairness of multi-party transaction. Transaction is decentralized. Honest participants can get the right results or fees in their transaction. Any dishonest participant in the transaction will be punished.

2) DELEGATED COMPUTATION ARCHITECTURE
The traditional delegated computation architecture is shown in Fig.1. It includes two participating entities: client and server. The client entrusts the task to a server that is not fully trusted for computing, and finally receives the computation result and evidence that can prove the correctness of the result.
In the delegated computation architecture, a trusted third party is required to coordinate and supervise the transaction process, and most of the transaction records are stored in a centralized manner. Once the third party leaks data or the trust collapses, the security of private data of the participants cannot be guaranteed, and the transaction is unfair. Based on this, this paper introduces the blockchain technology to realize the delegated computation process. The delegated computation studied for numerical simulation of electromagnetic comprehensive performance includes at least three participating entities: client C, Modeling party M, and computing party S. The delegated computation architecture under the blockchain framework for numerical simulation of electromagnetic comprehensive performance is shown in Fig.2.   Client C: Due to the limitation of resources or computing capacity, it is impossible to complete the numerical simulation computing task, and it is necessary to entrust the task to others. In order to protect the privacy of real data, C want to verify the capabilities of the modeling party and the computing party before computing. C hopes that other participants receiving the task can conduct honest transactions and get correct computation results after paying the fees as required. If they do not conduct honest transactions, C can be compensated.
Modeling party M: M masters the theoretical knowledge related to entrusted task and provides computation models. M views and accepts task that can be completed on the blockchain, and creates computation models, such as programs, according to entrusted task and related theories. M also undertakes the task of checking the computation results. After S completes the computation of the real data, M should check the voucher uploaded by S according to the theoretical knowledge to indicate whether S has completed the computing. M hopes to get the fees paid by C after completing the modeling and checking tasks.
Computing party S: S can be a cloud server or a personal computing device, providing powerful computing capabilities. S receives task through blockchain, and uses computation model uploaded by M to complete computing, and uploads computation voucher and complete computation results. S hopes to get the fees paid by C after correct computing.
Blockchain: The blockchain is responsible for the safe transmission and storage of data between participants. C, M and S obtain or provide appropriate models or key data from the blockchain according to actual needs and data privacy requirements. As a public ledger, blockchain records transactions of all participants. In addition, the smart contract on the blockchain can set the viewing strategy for private data, and operate according to the predetermined instructions or specific data. It also can supervise the behavior of all participants, and punish a malicious participant in case of dishonest transactions to protect the interests of all participants.
File server: It is a local file server or cloud server, which stores the heavyweight data in the delegated computation.

C. KEY TECHNICAL ISSUES
Blockchain is a new distributed infrastructure and computing paradigm t, which uses block-chain data structure to store data and uses cryptography algorithm to ensure data transmission and access security. Consensus algorithm generates data and updates data for blockchain. Smart contract composed of automated script code can program data and operate data [21]. Blockchain technology can solve the problem of ''data island'' and effectively get rid of intermediary VOLUME 11, 2023 dependence. It can create a trust environment and improve collaboration efficiency.

1) DATA TRANSMISSION SECURITY ARCHITECTURE BASED ON BLOCKCHAIN
In the asymmetric encryption algorithm, only the corresponding private key can decrypt the data encrypted by the public key, and only the corresponding public key can verify the seal of the data signed by the private key. The schematic diagram of signature and seal verification is shown in Fig. 3. A verified < data, signature > pair can guarantee the following three points. The data is sent by the owner of the public key-data source identity authentication. The data has not been tampered with by anyone-data integrity. The owner of the public key cannot deny that he has sent the data-data non repudiation. Each transaction in delegated computation should be digitally signed to confirm the identity of the sender and ensure that the data is not tampered with in the transmission process. Finally blockchain forms a transaction record for delegated computation.

2) DATA TAMPER PROOF ARCHITECTURE BASED ON BLOCKCHAIN
The blockchain is a chain formed by data blocks in chronological order. Each block is divided into two parts: block header and block body. The block structure is shown in Fig.4. The block header stores the Merkle root value of its own block body and the hash value of the previous block header. This structure ensures that the linked blocks cannot be tampered with. After verification, the linked delegated computation transaction records cannot be modified, which avoids malicious participants from tampering with the records to pursue private interests and ensures the storage security of the transaction records.

3) AUTOMATIC INTERACTION MECHANISM BASED ON SMART CONTRACT
The concept of smart contract was introduced by computer scientist and cryptographer Nick Szabo in 1995. It is a computer protocol that is deployed in advance and satisfies conditions to execute all or part of the contract content autonomously, allowing automation of interactions [22]. Smart contract is one of the core technologies of blockchain and broadens the use scenarios of blockchain. It has three main features. One of them is decentralization. Smart contract does not require third-party trust institutions. Secondly, it is transparent and fair. Smart contract can be viewed by anyone after successful deployment. Thirdly, it cannot be tampered with. Once a smart contract is deployed, all the contents cannot be modified and no party can interfere with the execution of the contract.
Using the operation of smart contract in Ethernet as an example, we introduce the smart contract operation mechanism. The operation process can be divided into four stages: generation, deployment, invocation and execution. The schematic diagram is shown in Fig.5, and the relevant data of smart contract is shown in Tab.3.
Contract generation: After the participants of the contract negotiate the contents, one party uses solidity to encode the contract and compile it through Solc compiler to generate binary code of Ethereum Virtual Machine(EVM). Then add 0X prefix to form the contract code. The compilation also generates the ABI contract interface.
Contract deployment: The process of deploying a smart contract is the publishing process, which is similar to the transaction publishing process. This process essentially is that the deployer sends a transaction with a contract code to the blockchain. The transaction is packaged into blocks and is broadcast to the whole network through the P2P network. After the signature verification and consensus is reached, the transaction is written into the blockchain and the smart contract is successfully deployed. At the same time, the blockchain feedbacks the contract address to the deployer. The deployer informs others of the contract address. The contract can be invoked by the person who has the call authority.
Contract call: The smart contract call process is actually the callers sending a transaction with execution parameters to the called smart contract address. The authorized caller can pass the execution parameters to the smart contract.
Contract execution: When execution parameters into the smart contract, they triggers the state machine to judgment. If the preset trigger conditions of contract are met, the instruction after the conditions will be a quick read and execution, which is similar to the general trade. The behavior will be also packaged into blocks, which will be signed and verified. After reaching consensus, this block is written into the blockchain.  Smart contract build the blockchain into a programmable data sharing platform [23]. In this paper, three smart contracts are designed in the delegated computation mechanism of electromagnetic comprehensive performance simulation to maintain data security and transaction fairness. The Public Commitment smart contract store deposits of all participants to motivate them to trade honestly and safeguard the rights and interests of honest participants. If the participants are honest in trading, they will take back their deposit at the end of the trading. If there are dishonest trading participants, their deposit will be deducted. In this contract, C stores the remuneration in advance, which eliminates the repudiation by C. The Case Verification smart contract is used to realize the calculation result of the verification case is only visible to C and the real calculation data is only exposed to the participant who is capable of completing the delegated task, so as to protect the privacy data security.

4) UNIFIED LEDGER OF THE WHOLE NETWORK BASED ON CONSENSUS ALGORITHM
The decentralized blockchain can build a distributed database. The authenticity of the database is jointly maintained by many nodes in the network, and each node has the right to decide on each record. If the transactions between users are recorded, the database is a ledger, which can be used instead of the central organization to record the transactions between the delegated computation participants. Not only does it not need to set up a third-party mechanism, but the blockchain is stored separately at each node, so the failure of a single node does not affect the operation of the whole blockchain. Consensus algorithm is a method to determine the ownership of the bookkeeping right of the ledger according to a certain rule among distributed nodes, so that all nodes can reach a consensus on the transaction data [24] and the distributed ledger is consistent throughout the network. Give bookkeeping income to bookkeepers to mobilize the bookkeeping enthusiasm of participants.

III. DELEGATED COMPUTATION MECHANISM DESIGN UNDER THE FRAMEWORK OF BLOCKCHAIN
In this section, it is proposed to design the delegated computation mechanism considering the actual situation of numerical simulation of electromagnetic comprehensive performance from the seven phases of initialization, public commitment, case verification, real data computing and result delivery, payment and claim, digital signature, and consensus. The flow chart is shown in Fig.6.

A. INITIALIZATION PHASE
As the initialization phase of the transaction, it mainly includes broadcasting of delegated task and distributed network connection of all participants.
C uses a specific public key and private key to generate time-stamped delegated computing task information and broadcast it to the whole network. Task information includes modeling and computing requirements, completion times, remuneration, and trading rules. The rules are as follows. M needs to establish the computing model and undertake the task of verifying the computing result of real computing data. S needs to complete a verification case computing firstly. If it is correct, S can compute the real data. In order to promote the fairness of the transaction, the three participants pay the deposit. If all participants are honest and they complete the transaction within the specified time, C pays the fee. Every participant gets their deposit back. If one participant is malicious, wrong or over time, his deposit will be deducted and distributed to the other participants as compensation. The relevant completion time includes modeling completion time of M, computing time for verification case by S, computing time for real data by S, verification time of computing voucher by M. M and S consult the delegated task information through the blockchain and send receiving task transactions to C respectively. After the completion of the distributed network connection between C, M and S, the rights and obligations of each participant are clarified and detailed transaction rules are negotiated.

B. PUBLIC COMMITMENT PHASE
The three participants agreed to sign the open source Public Commitment smart contract, which develops rules for payment and claims. C, M and S pay the deposit respectively before computation. C stores the remuneration of modeling and computing. The distribution of deposits and rewards is governed by the smart contract agreement on Public Commitment. Its algorithm is shown in the Alg.1.
The implementation methods of Public Commitment smart contract and other subsequent smart contract are described in section II-C.3). After C successfully deploys this contract, the blockchain will feedback the contract address to C, and C will inform M and S of the address.

C. CASE VERIFICATION PHASE
After the successful deployment of the Public Commitment smart contract, C preprocesses the delegated data. In order to verify whether M and S are capable of completing tasks to reduce the scope of real calculation data propagation, M and S need to complete a computational example firstly, and the result of this example is already known by C. The delegated data is divided into three parts: data1 that is verification case, data2 that is the result of verification case, and data3 that is, real computation data. Data1 can be seen by the whole network and data2 can only be seen by C. Data3 can only be seen by M and S after correctly computing the verification case. According to the requirements of data privacy degree, data2 is uploaded after encrypted by hash function and data3 is uploaded after encrypted by public keys of M and S respectively.
C deploys Case Verification smart contract to realize the viewing strategy for data2 and data3. Data1 is directly stored into Case Verification smart contract. To monitor transaction behavior for participants, this contract is open source. The ciphertexts of data2 and data3 are stored in another data smart contract that is non-open source. The call permission of data smart contract is set only to the Case Verification smart contract. The implementation algorithm of Case Verification Algorithm 1 Public Commitment Smart Contract Input: content //C, M , S negotiates content Parameter //Execution parameter of contract Output: address False // Contract generation and deploy 1: C uses solidity to write content source code 2: Generate code and ABI by compiling 3: C sends a transaction with a contract code to the blockchain 4: if contract is deployed successfully then 5: Blockchain feedbacks address 6: else 7: False 8: end if // Contract call and execution 9: Caller sends a transaction with parameter to address 10: while Parameter into smart contract do 11: if caller have call authority then 12: if Parameter ← ''S correctly computes within the agreed time'' then 13: M gets remuneration 14: S gets remuneration 15: C,M,S get deposit 16: else if Parameter ← ''S is timeout or the computation result is wrong'' then 17: M gets remuneration 18: C gets remuneration of S S uses the computing model to compute data1 to obtain data2'. Then S uploads it and calls the Case Verification smart contract. The execution parameter is '' data2' ciphertext ''.

D. REAL DATA COMPUTING AND RESULT DELIVERY PHASE
After S obtains data3, it uses the computing model to obtain data4 which is the computation result of data3 and data5 which is computation voucher. Data4 is visible only to C. Data5 is visible to all participants. S uploads data4 ciphertext encrypted by public key of C and data5 ciphertext respectively encrypted by public key of M and C. Data5 is waiting to be verified by M.
S deploys the open-source Result Delivery smart contract, and the successful deployment time of the contract represents the time it takes for S to complete the real calculation data. Once the contract is successfully deployed, the deployment time is automatically compared with the time it takes for S to complete the real calculation data specified during the initialization stage.
M obtains data5 and verifies it based on theoretical knowledge, then calls the Result Delivery smart contract and uploads the verification result. Subsequent transactions are executed according to the contract agreement. The algorithm for the Result Delivery smart contract is shown in Alg.3. If S calculates correctly, C can obtain the calculation model and complete calculation results by decrypting it using his private key.

E. PAYMENT AND CLAIM PHASE
When the delegated transaction enters the payment or claim stage, a participant or a smart contract calls the Public Commitment smart contract with the corresponding execution parameters to distribute the remuneration and deposit fairly as required.

F. DIGITAL SIGNATURE PHASE
In the designed mechanism, the identity of the participants is always verified and the transmitted data is not tampered with. The public-private key pair realizes encryption, decryption, signature and verification for data. Each action request of all participants will be recorded in the blockchain in the form of transaction. New transactions are packaged after signature verification to generate corresponding blocks to be linked. Digital signature algorithm is described as shown in Alg.4.

G. CONSENSUS PHASE
Each participant has the right to be the bookkeeper of new transactions. However, the bookkeeper of a transaction may be unique. The method to determine the bookkeeper is selected as Power of Work. The bookkeeper connects the new Algorithm 2 Case Verification Smart Contract Input: content //C, M , S negotiates content Parameter //Execution parameter of contract Output: address False // Contract generation and deploy 1: Same as Public Commitment smart contract // Contract call and execution 2: Caller sends a transaction with parameter to address 3: while Parameter into smart contract do 4: if caller have call authority then 5: if Parameter ← ''M completes the computing model'' then 6: if completion time is within the limit then 7: Nothing done 8: Call PC, parameter is ''M is timeout and S is not computed'' 10: end if 11: else if Parameter ← ''data2' ciphertext'' then 12: Judge whether data2' ciphertext is consistent with data2 ciphertext 13: if consistent then 14: if time is within the range then 15: Call the data smart contract. 16: Ciphertexts data3 are upload and public 17: else 18: Call PC, parameter is ''S is timeout or the computation result is wrong'' 19: end if 20: else 21: Call PC, parameter is ''S is timeout or the computation result is wrong'' 22: end if 23

IV. EXAMPLE IMPLEMENTATION
In order to verify the feasibility of the delegated computation architecture and mechanism proposed in this paper, this section takes ''Solving the Poisson equation of twodimensional electrostatic field'' with only lightweight data as an example to carry out simulation verification. Furthermore, the performance of the architecture and mechanism is verified by a complex example of ''Optimization of amorphous alloy transformer''.
The client C, the modeling party M, and the computing party S are respectively executed on a windows Algorithm 3 Result Delivery Smart Contract Input: content //C, M , S negotiates content Parameter //Execution parameter of contract Output: address False // Contract generation and deploy 1: S uses solidity to write content source code 2: Generate code and ABI by compiling 3: S sends a transaction with a contract code to the blockchain 4: if contract is deployed successfully then 5: Blockchain feedbacks address 6: if computation completion time is within the prescribed range then 7: Nothing 8: else 9: Call PC and parameter is ''S is timeout or the computation result is wrong'' 10: end if 11: else 12: False 13: end if // Contract call and execution 14: Caller sends a transaction with parameter to address 15: while Parameter into smart contract do 16: if caller have call authority then 17: if Parameter ← ''computation result is correct'' then 18: if M verify the time in prescribed range then 19: Call PC, parameter is ''S correctly computes within the agreed time'' 20: else 21: Call PC, parameter is ''M is timeout and S has been computed'' 22: end if 23: else if Parameter ← ''computation result is error'' then 24: if verification time of M in prescribed range then  contracts in Remix. The specific configurations are compiler (0.8.7+commit. e28d00a7), language (Solidity), EVM version (compiler default).

A. DELEGATED COMPUTATION FOR SOLVING THE POISSON EQUATION OF TWO-DIMENSIONAL ELECTROSTATIC FIELD
The details of this example are described below. The requirement of the client C is to calculate the two-dimensional electrostatic field potential values under a specific function using the finite element method. The discrete method is chosen as the Galerkin method. The Galerkin method is a special weighted residual method, i.e., the interpolation function and the weight function are the same. The modeling party M can provide a python program to calculate the Poisson equation for the two-dimensional electrostatic field using the finite element method. The computational party S has powerful computational capabilities and can support program operation under fine mesh dissection.

1) INITIALIZATION PHASE
The accounts of C, M, and S are shown in the Tab.4.  The details of the delegated task can be divided into 4 articles.
• Problem to be solved: solving the electrostatic field under a specific known function nodal potential values. Boundary conditions: The first type of boundary conditions is set to 1 V. The edge value problem is shown in Eq.(1).
Among them,ϕ is the potential value. f is shown in Eq. (2).
where ρ is the charge density, ε is the dielectric constant. The finite element equations are obtained using the Galerkin method, as shown in Eq.(3). • Solution domain: the length is 2 meters, the width is 1 meter, the schematic diagram is shown in the Fig.7.
• Verification case: The function f is known to be a constant.
• Real computational data: the function f is known to be the value of the horizontal coordinate of the node specified by the delegate.
According to the Tab. 2, the type of important transaction data in the delegated computation of solving the Poisson equation of two-dimensional electrostatic field can be set, as shown in Tab.5. C broadcasts the delegated task, M and S receive the task through the blockchain, and the three participants form a distributed network connection. All participants agree on the specific transaction process and the content of each smart contract of the Poisson equation delegated computation.

2) PUBLIC COMMITMENT PHASE
The addresses of each smart contract during this example are shown in Tab.6.
C deploys Public Commitment smart contract. C informs M, S of this address. The contract has seven user operation ports: accountC_Deposit, accountC_ModelReward, accountC_CalculateReward, accountM_Deposit, accountS_ Deposit,, setAdmin, and verifyAndRefund. The first five are for storing the deposit paid by the three parties and the remuneration paid by C to M and S, the specific amounts are set to 10 GoerliETH. The setAdmin is for setting the contract invocation authority interface, the invocation authority of this contract is for the Public Commitment smart contract and the Result Delivery smart contract. The verifyAndRefund is for uploading the transaction results.

3) CASE VALIDATION PHASE
C uses the hash function to cryptographically verify the case result, i.e., the Poisson equation calculation result when the known function is set to a constant, and stores the delegated data in the data contract. C deploys the Case Verification smart contract. The two contracts are used in conjunction with each other to achieve the ''Poisson equation results when the known function is set to constant'' and the ''specific function f ''.
M writes a python program for Poisson equation calculation using Galyagin's method according to the delegated task, including defining variables, setting boundary conditions, cell dissection, node numbering, solving local and global stiffness matrices, solving right end terms, and output. A triangular section with a section size of 0.2 and with cell and node numbers is shown schematically in Fig.8.
M encrypts the computation program with S public key and C public key respectively, and then uploads the corresponding  Fig.9. The specific value is used as the calculation result, and the output image is used as the calculation voucher.
S encrypts the computation result and voucher and deploys the Result Delivery smart contract. The contract automatically determines the real data computation time of S within the agreed range after successful deployment, and M checks the output image based on theoretical knowledge and concludes that S's computation results are correct. M invokes the Result Delivery smart contract with the parameter ''computation result is correct''. The contract invokes the Public Commitment smart contract, returns the three-party deposit, and pays the modeling and calculation rewards to M and S.
If other transaction states occur during the transaction, such as timeout or calculation errors, the Public Commitment smart contract is invoked and enters the payment and claim phase. By passing in the corresponding transaction result parameters, the deposit and payout are distributed as agreed.
Since the solution of the Poisson equation for the two-dimensional electrostatic field is simpler and the final calculation results contain only lightweight numerical solutions, C decrypts the ciphertext of the calculation procedure uploaded by M and the ciphertext of the calculation results uploaded by S with a private key to obtain the calculation procedure of the two-dimensional Poisson equation, the voltage values of the nodes in the solution domain under a specific function f, and the resulting output images.

B. DELEGATED COMPUTATION FOR OPTIMIZATION OF AMORPHOUS ALLOY TRANSFORMER
The details of this example are described as follows. C selects core height, core iteration thickness, winding turns, window thickness, and wire cross-sectional area as design parameters, and volume and vibration acceleration as performance indicators, and applies the third generation Non-dominated Sorting Genetic Algorithms to optimize the design parameters of the transformer. In order to further reduce the time and computational resource consumption, C provides an intelligent distribution proxy model construction method for transformer performance value solving. The computational results of the proxy model are very close to those of the high-precision model, but the solving computation is smaller. The sample data required to construct the proxy model is calculated from the finite element model. M constructs the finite element model and the intelligent distribution proxy model for amorphous alloy transformers. S can calculate the performance values of transformers using the finite element model and the intelligent distribution proxy model.

1) INITIALIZATION PHASE
The accounts of C, M, and S are shown in the Tab.7.
The details of the delegated task can be divided into 5 articles.
• Problem to be solved: optimization of small amorphous alloy transformer volume and vibration problems using the third generation Non-dominated Sorting Genetic Algorithms. A finite element model and an intelligent distribution proxy model are constructed to calculate the performance values.
• The optimized parameters are core height, core iteration thickness, winding turns, window thickness, and wire crosssectional area.
• The performance indicators are volume and vibration acceleration.
• Verification case: calculation of amorphous alloy transformer performance values before optimization using finite element simulation model.
• Real calculation case: calculation of the performance values for amorphous alloy transformer before and after optimization using intelligent distribution proxy model. According to the Tab. 2, the type of important transaction data in the  delegated computation of optimization of amorphous alloy transformer can be set, as shown in Tab.8. C broadcasts the delegated task, M and S receive the task through the blockchain, and the three participants form a distributed network connection. All participants agree on the transaction process and the content of each smart contract of amorphous alloy transformer optimization delegated computation.

2) PUBLIC COMMITMENT PHASE
The addresses of each smart contract during this example are shown in Tab.9.
C deploys the Public Commitment smart contract. C informs M and S of the address. The user operation port is the same as the previous example. The exact amount of the deposit and payoff is 20 GoerliETH.

3) CASE VALIDATION PHASE
C use hash function encrypt performance value of amorphous alloy transformer before optimization, and deploy Case Verification smart contract.
Data contract address called by this contract. These two contracts realize the viewing strategy of amorphous alloy transformer performance values before optimized, the intelligent distribution proxy model building process and the accuracy requirement. Among them, the intelligent distribution proxy model construction process and accuracy requirement are encrypted by M public key and S public key and stored to the file server respectively. The storage address is stored in the contract. S obtains the design parameters of amorphous alloy transformer before optimization from the contract and the finite element simulation model of the transformer by decrypting. S uses the model to obtain the core vibration nephogram, determines the test points in X, Y and Z directions, and calculates the volume and vibration acceleration of the amorphous alloy transformer before optimization. Then S uploads the results to the Case Verification smart contract.
The contract automatically judges whether the volume and vibration acceleration of amorphous alloy transformer calculated before optimizition by S using the finite element model are correct. We assume that it is correct. The contract retrieves the storage address from the data contract for the intelligent distribution proxy model building process and accuracy requirement.

4) REAL DATA CALCULATION AND RESULT DELIVERY PHASE
M obtains the intelligent distribution proxy model construction process and accuracy requirement. The construction process is shown in Fig.10. According to the need of proxy model construction, S uses the finite element simulation model to obtain the sample points and test points data. M constructs the intelligent distribution proxy model that meets the accuracy requirement. Then M stores them to the file server after encrypting with S public key and C public key respectively, and upload the storage address to the blockchain.
S optimizes the amorphous alloy transformer design parameters by the third generation Non-dominated Sorting Genetic Algorithms. S obtains the intelligent distribution proxy model by decryption using the private key, and calculates the volume and vibration acceleration data before and after optimization, while deriving the computational credential.
S encrypts the results and credential. Then stores the computation result ciphertext to the file server and deploys the Result Delivery smart contract. The contract automatically determines the real data computation time of S within the agreed range after successful deployment. M checks the credential based on theoretical knowledge and concludes that S's computation results are correct. M invokes the Result Delivery smart contract with the parameter ''computation result is correct''. The contract invokes the Public Commitment smart contract, returns the three-party deposit, and pays the modeling and calculation rewards to M and S.
The data of amorphous alloy transformer optimization delegated computation example contains light-weight data such as amorphous alloy transformer design parameters and performance values before and after optimization and heavyweight data such as finite element model containing numerical calculation solutions and intelligent distribution proxy model, etc.
The heavy-weight data need to store the ciphertext to the file server and upload only the storage address to the blockchain, and the transaction process is tedious.
C can decrypt the ciphertext of each model and calculation result through the private key to obtain the finite element simulation model, intelligent distribution proxy model and complete calculation results, in which the design parameters and performance comparison data of amorphous alloy transformer before and after optimization are shown in Tab. 10.
The above two examples show that the delegated computation architecture and mechanism under the blockchain framework proposed in this paper can solve simple and complex computing problems in the numerical simulation of electromagnetic comprehensive performance. The architecture and mechanism can achieve privacy data protection and maintain transaction fairness and have good application performance.

V. CONCLUSION
The article proposes a delegated computing scheme under a blockchain framework for the numerical simulation of electromagnetic comprehensive performance. The research achieves the following: (1) A multi-level data classification and processing method for delegated computation has been proposed in this field, which removes the block capacity limitation and meets the different privacy requirements of data.
(2) We have bulit a delegated computation architecture and a detailed transaction mechanism based on blockchain technology, which have multi-level data security and multiparty transaction fairness.
(3) We have designed three smart contracts that meet logical requirements in the delegation scheme, achieving automated operation of privacy data viewing strategies and participant interactions.
(4) The feasibility and performance of the proposed delegated computation scheme have been validated by applying two examples: ''solving the two-dimensional electrostatic Poisson equation'' and ''optimizing amorphous alloy transformers''.
The research results solve the problem of secure and fair computation for large-scale numerical simulations of electromagnetic comprehensive performance. The application of blockchain technology injects emerging technology into this field, promoting the intelligent transformation of performance analysis and optimization, and has important significance for the research, design, and manufacturing of electrical equipment.