Is there any way to send an amount of eth to a smart contract address setting a delay time before the sender address could redeem?

  • Add a modifier to the payment function that requires the blocknumber to be greater than a certain number in the future? – Samuel Dare Jul 29 '19 at 21:31

OpenZeppelin has a TokenTimelock contract and you could use a similar idea for Ether. https://docs.openzeppelin.com/contracts/2.x/api/token/erc20#TokenTimelock


The code below allows several users to lock ether in a smart contract. Each subject can withdraw the ether that he/she deposited after a certain amount of time (in this example 1 day).

pragma solidity ^0.5.1;

contract timeLock {

    uint256 lockTime = 1 days;

    struct locked{
        uint256 expire;
        uint256 amount;

    mapping(address => locked) users;

    function lockEther() public payable {
        locked storage userInfo = users[msg.sender];
        userInfo.expire = block.timestamp + lockTime;
        userInfo.amount = msg.value;

    function withdraw() public {
        locked storage userInfo = users[msg.sender];
        uint256 value = userInfo.amount;
        userInfo.expire = 0;
        userInfo.amount = 0;


Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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