Research Article
Blockchain-Enhanced Fair Task Scheduling for Cloud-Fog-Edge Coordination Environments: Model and Algorithm
| class Transaction { | (1) | String transactionId; | (2) | PublicKey trustor;//the public key of trustor | (3) | PublicKey trustee;//the public key of trustee | (4) | double trust;//trust value from trustor to trustee | (5) | byte[] signature; | (6) | ArrayList < Transaction > transactions; | (7) | boolean processTransaction() { | (8) | verifySignature(); | (9) | transactionId = calulateHash(); | (10) | generateTrust();//generate trust according to transaction details | (11) | TransactionOutput(this.recipient, trust, transactionId)); | (12) | return true; | (13) | } //add transactions into transactionChain TBB | (14) | boolean addTransaction(Transaction transaction) { | (15) | verifyTransaction(); | (16) | processTransaction(); | (17) | transactions.add(transaction); | (18) | return true; | (19) | } | | } |
|