Research Article

A Secure and Efficient Energy Trading Model Using Blockchain for a 5G-Deployed Smart Community

Algorithm 2

EBEV function.
Output: send distance;
1: function EBEV()
2:  notmatched = True;
3:  whilenotmatcheddo
4:   System broadcast the need for matching;
5:   if only one supplier responds then
6:    
7:   else
8:     = select the ESEV user with the highest-reputation points;
9:   Sendmessage(propose, D, S);
10:   msg = getMessage();
11:   if msg = accepted then
12:    add EBEV’s loc(x, y) and calculate encrypted squared distance;
13:    Sendmessage(encrypted(distance));
14:    notmatched = False;