# A Blockchain-Based Protocol for Fair Delivery for Receips
## 9 Cost Assessment
### Gas Cost  
In Section 6, we specified the smart contract that can be deployed and used on any EVM-based blockchain. This smart contract was programmed in the Solidity language [27] and deployed via the Hardhat network, which is a local Ethereum network node designed for development [30]. This methodology allows for the deployment, testing, and debugging of the smart contract code in a local environment without incurring real-world expenses. On an EVM-based blockchain, the transaction execution cost is measured in gas units; for example, the basic cost for creating a smart contract is approximately 32,000 gas units, as stated in Ethereum's yellow paper [14]. However, the total cost of deploying the smart contract varies depending on the size of the deployed code, which is measured in bytes [14]. The cost for deploying or calling a function of the smart contract, measured in gas units, remains fixed regardless of the environment in which the smart contract is executed, meaning that the technical specifications of the hardware or software used to test our proposal do not impact the cost. Various utilities are available to assist in determining the gas costs associated with executing each function. For this analysis, we used the hardhat-gas-reporter plugin (Gas metrics for method calls and deployments on EVM-based blockchain networks. Available at [[https://www.npmjs.com/package/hardhat-gas-reporter](https://www.npmjs.com/package/hardhat-gas-reporter)]([https://www.npmjs.com/package/hardhat-gas-reporter](https://www.npmjs.com/package/hardhat-gas-reporter)) and accessed on 1 November 2024), which enables the straightforward generation of gas consumption reports for both contract deployment and the execution of each of the contract functions. Table 5 shows the costs (measured in gas units) of the two main functions of our solution (_accept_ and _publish_) and the cost of deploying the smart contract. The cost of deploying the contract in the blockchain network is higher than those of the other functions. However, once the smart contract is deployed, it can be used multiple times for different  
instances of delivery for receipts. The _accept_ and _publish_ functions must be called by \(B\) and \(A\), respectively, in each protocol execution, and this cost is fixed for each delivery regardless of the type or size of the document to be delivered. The _getStatus_ function does not change the state of the blockchain; thus, it does not incur an economic cost. The cost, measured in gas units, can be used to evaluate the complexity of the operations involved in each function of the smart contract. This metric is platform-agnostic, making it an ideal measure for comparing different solutions, regardless of the EVM-based blockchain on which they are executed. By using gas as a standard unit, we can objectively assess and contrast the efficiency and performance of various smart contract implementations. Next, we compared our proposed solution with the solutions analyzed in Section 3. Among the reviewed solutions, we considered those that do not require a TTP and can be deployed and used on EVM-based blockchains [16; 17; 20; 21; 23; 24]. The solutions requiring a TTP were excluded because their costs were not considered in the analyzed publications. In the comparison, the total cost of successfully executing each considered protocol was calculated. Protocol execution was considered successful if the recipient received the document (email, notification, etc.) and if the sender had proof of delivery. Two different scenarios were evaluated:  
* First delivery: In this scenario, the total cost was evaluated, including both the deployment of the smart contract and the execution of the functions necessary for delivery. * Next delivery: In this scenario, the cost was evaluated under the assumption that the smart contract had already been deployed (if the solution allows it) and that only the functions directly related to fair delivery were executed. Figure 8 summarizes the costs associated with each solution for the two defined scenarios.