# Next-Generation Payment System for Device-to-Device Content and Processing Sharing
## 3 System Model
In [49], the energy required to transmit an \(L\)-bit packet over a distance of \(d\) is given by the following:  
\[E(d,L)=E_{te}\,L+E_{ta}\,L\,d^{2}, \tag{1}\]  
where \(E_{te}\) is the energy spent in the transmitter electronics per bit, whereas \(E_{ta}\) is the energy spent in the transmit amplifier per bit per squared distance. Typical values for \(E_{te}\) and \(E_{ta}\) are given in [49] as 50 nJ/bit and 100 pJ/bit/m\({}^{2}\), respectively. This shows that for transmission over short distances, the energy spent in the transmitter electronics is dominant, whereas the energy spent in the transmit amplifier becomes the significant component as distance grows. Based on this observation, we model the cost of data provision over a distance of \(d\) as follows:  
\[C_{1}=\max\{c_{p}\,d^{k},c_{\min}\}, \tag{2}\]  
where \(c_{p}\) is the coefficient that determines the cut-off for \(d\) where the energy spent in the transmit amplifier becomes dominant, and \(c_{\min}\) represents the minimum cost representing the case where the energy spent in the transmitter electronics is dominant. Furthermore, consider the scenario where the mobile user selected as the source has the requested GOP only in the best-quality available, whereas the distance between the requesting user and the source user does not allow best-quality data rate but the second-best-quality. In this case, the source user transcodes GOP into the second-best quality and transmits the output. There is a further cost associated with this video processing that the requesting user has to pay in addition to the cost of merely providing the content. We model the transcoding cost from the quality level of the source, \(q_{s}\), to that of the destination, \(q_{d}\) (where smaller value indicates better quality), as follows:  
\[C_{2}=c_{t}\,(q_{d}-q_{s}), \tag{3}\]  
where \(c_{t}\) represents a factor relating data provision to transcoding cost. In this case, the total cost the requester needs to pay the provider is as follows. \[C=C_{1}+C_{2}. \tag{4}\]  
Note that, in this scenario, the second-best quality GOP will now be present and available to be downloaded from the source user's cache should there be requests for it later. In this manner, it is possible that mobile users host multiple copies of the same GOP in different quality levels. The cost of data provision as well as the cost of video processing, when applicable, is paid to the source user by the requester via TelCash. The requesting mobile user picks the source based on the quality first, then cost, and then the distance. As soon as it learns the source candidates from the base station, the requester computes the quality level that it can obtain from each source as well as the base station, based on the cache maps of each device along with the distance information. Then, among the mobile users that can provide the highest possible quality, the one that demands the least cost is determined. If there are multiple such users (including the base station cache), the closest one is preferred. Finally, the quality level that can be offered by the base station and the associated cost is compared against the source candidate mobile user. We model the cost of downloading from the base station (either from the cloud or the cache at the base station) as follows:  
\[C_{\text{BS}}=c_{b}\,\max\{c_{p}\,d^{k},c_{\text{min}}\}, \tag{5}\]  
where \(d\) here is the distance between the requester and the base station. Equation (5) differs from (2) only in the coefficient \(c_{b}\), which is a parameter related to the willingness of the mobile operator providing content that has already been brought down from the cloud. Note that although \(c_{b}=0\) represents the current commercial practice, this could change soon with the deployment of 5G and the ever-growing trend in the content delivery use-cases. After this comparison, if the base station beats the best candidate user in terms of quality, cost, or distance in that order, GOP is downloaded from the base station.