Research Article
Blockchain-Enhanced Fair Task Scheduling for Cloud-Fog-Edge Coordination Environments: Model and Algorithm
| TrustBlock { | (1) | String hash; | (2) | String previousHash; | (3) | String merkleRoot; | (4) | long timeStamp; | (5) | int nonce;//the proof of miners | (6) | double trust;//the integrated trust of a certain node | (7) | TrustBlock(String previousHash) {//the basic structure of a trust block | (8) | this.previousHash = previousHash; | (9) | this.timeStamp = new Date().getTime(); | (10) | this.hash = calculateHash(); } | (11) | void mineBlock() { | (12) | merkleRoot = StringUtil.getMerkleRoot(transactions); | (13) | while(!hash.substring(0, difficulty).equals(target)) { | (14) | nonce ++; | (15) | hash = calculateHash(); | (16) | } | (17) | } | | } |
|