...by Daniel Szego
quote
"On a long enough timeline we will all become Satoshi Nakamoto.."
Daniel Szego

Wednesday, August 1, 2018

Solidity Tips and Tricks - decentralized maintenance


In a blockchain system, you might sometimes have the problem, that there should some kind of a maintenance job that should be running regularly. For such a problems, you usually implement something as a maintenance or timer job in centralized systems. However considering a fully decentralized system it is pretty much unpractical. What might be a good direction is to create a special decentralized role for maintenance in a way that this role will be rewarded somehow for doing the maintenance. The idea is similar to the idea of the miners. A miner maintain the state of the blockchain and for that activity they are rewarded by the transaction fees and the newly generated coins. The idea can be repeated however, there might be further roles doing kind of a system maintenance jobs for a certain  monetary reward. A very simple solidity code for that can be seen in the followings:

contract DecentralizedOperation {
    mapping(address => uint) balanceOpReward;
    
    function Maintainance() {
        // do maintainance
        balanceOpReward[msg.sender]++;
    }
}