I'm using https://github.com/PoSToken/PoSToken/blob/master/contracts/PoSToken.sol as my example of Proof of Stake implementation (feel free to point out others that are worth looking at) however, it seems like, any of the token holders must call the transfer function to themselves in order to to receive the reward, but is there a way to make that minting and transfer happen automatically at a certain time, say 1st of every month, without any user intervention?

  • 1
    The only issue I see with this is that, if you do the function to send the tokens to them yourself, you are taking on the responsible for the gas cost...which might be a quite a bit considering you are queueing, looping through and updating storage for each individual for a full month.
    – ReyHaynes
    Feb 12, 2018 at 1:51

1 Answer 1


You could have a cronjob or a scheduled service that runs once a month which processes staking rewards. However there is no way for a contract to automatically do anything as they all require being "poked" with a transaction.

  • I couldn't build some kind of an infinite loop that pauses for a day, then once a day checks to see if it's time, and if so, mint the coins? Relying on a third party to do something in a Turing complete language feels wrong to me.
    – Serj Sagan
    Feb 12, 2018 at 1:13
  • @SerjSagan I think rejecting a response based off "feeling" isn't very conducive. Setting up a cronjob via. web3 or integrating a scheduled service like Ethereum Alarm Clock are pretty solid answers.
    – ReyHaynes
    Feb 12, 2018 at 1:35
  • @ReyHaynes Unless that feeling comes from many years of dev experience and is a valid consideration when making these kinds of decisions... and I am not rejecting it just considering whether this is really the best way, for example Oraclize, ethereum.stackexchange.com/a/252/2217 , feels like a much better way
    – Serj Sagan
    Feb 12, 2018 at 1:43
  • @SerjSagan Ethereum Alarm Clock and Oraclize are great options if you want to keep it within the Ethereum ecosystem...but at the end of the day, they are all there to send out a single command so even using a private server is relatively fine.
    – ReyHaynes
    Feb 12, 2018 at 1:48
  • Oraclize: 1+ year of trustworthiness, using a trusted provider for integrating off chain data into your code is extremely important IMO. Also oraclizes uses a great deal of security features, and authenticity proofs which if you want to ensure validity of your data is hard to do. You would in all honesty significantly increase your dev time to properly roll your own solution
    – hextet
    Feb 12, 2018 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.