<h2>Option 1</h2>

<p>I'm not sure on which platform you are, but if you use a Linux or Mac, you can combine the following two commands (sources <a href="https://stackoverflow.com/questions/18945669/linux-how-to-run-script-at-certain-time">here</a> and <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow noreferrer">here</a>. Check also the <code>at</code> <a href="http://manpages.ubuntu.com/manpages/hardy/man1/at.1posix.html" rel="nofollow noreferrer">manual</a>):</p>

<pre><code>echo "ls -l" | at 07:00 
</code></pre>

<p>and </p>

<pre><code> bitcoind sendtoaddress &lt;bitcoinaddress&gt; &lt;amount&gt;
</code></pre>

<p>to make something like:</p>

<pre><code>echo "bitcoind sendtoaddress    1MAtHias8yvaLcDgckkG5QnVLY7ucBZrGv 0.01" | at 07:00 
</code></pre>

<p>to send me 0.01 BTC at 07:00 o'clock in the morning. I think you're computer should stay on for this, as it cannot send a transaction with it turned off. </p>

<h2>Option 2</h2>

<p>You can also work with <code>sleep</code> (Mac and Linux only):</p>

<pre><code>sleep 120 &amp;&amp; bitcoind sendtoaddress 1MAtHias8yvaLcDgckkG5QnVLY7ucBZrGv 0.01
</code></pre>

<p>The number behind <code>sleep</code> is the amount of seconds that there is nothing executed. So now it will send 0.01 BTC to me, after 2 (=120/60) minutes. The <code>&amp;&amp;</code> will first execute the left side. If that executed succesful, the right side is executed. It is more insightful, but you'll have to calculate the amount of seconds and is as precise as your calculations.</p>

<h2>Option 3</h2>

<p>For windows:</p>

<pre><code>timeout 120 &amp;&amp; bitcoind sendtoaddress   1MAtHias8yvaLcDgckkG5QnVLY7ucBZrGv 0.01
</code></pre>

<p><code>timeout</code> is the sleep variant of windows. Probably doesn't work on Windows XP, but works here on W8 and should work on W7. The <code>&amp;&amp;</code> does the same as in <strong>Option 2</strong>.</p>

CC BY-SA 3.0
2014-07-18T18:08:21.400Z
I use windows and use blockchain. Is there any other option?
rahulgarg12342
CC BY-SA 3.0
2014-07-18T18:16:03.290Z
I don't have a answer in that case. I will leave my answer however, as it can be a solution to someone else who visits this page later on.
Mathias711
CC BY-SA 3.0
2014-07-18T18:16:43.353Z
Even if I download the client, do you know the command for windows?
rahulgarg12342
CC BY-SA 3.0
2014-07-18T18:19:57.523Z
There are the same commands as the other clients. See the second link from my answer for the commands. A [screenshot](https://i.sstatic.net/VkREl.png) shows how you can use it, I suppose
Mathias711
CC BY-SA 3.0
2014-07-18T18:22:51.260Z
Since you are a little experienced, please can you just take a look at blockchain API and help me make a command so I can use it to send. I think the blockchain API should enable that.
rahulgarg12342
CC BY-SA 3.0
2014-07-18T18:30:51.083Z
I am not into PHP at all. I think you can do the same approach as I did in option 2 (and 3). Otherwise you can do something with [time](http://php.net/manual/en/function.time.php) and check if it is 04:00 pm on a specific day. If that is true, execute the send command `https://blockchain.info/nl/merchant/$guid/payment?password=$main_password&second_password=$second_password&to=$address&amount=$amount` (from [here](https://blockchain.info/nl/api/blockchain_wallet_api)). I believe there is no built-in option to postpone a transaction.
Mathias711
CC BY-SA 3.0
2014-07-18T20:56:56.363Z
To follow up on Mathias's answer/comments. For accessing the PHP API he linked, you can use wget (http://gnuwin32.sourceforge.net/packages/wget.htm). And to have it run once (or repeatedly) at a certain time, you can use the Task Scheduler built in to Windows, which you can find if you open Computer Management->System Tools->Task Scheduler->Task Scheduler Library
Matt
CC BY-SA 3.0
2014-07-19T00:19:10.663Z
The third command you give in Option 1 is missing an `echo`; as written it will send the coins immediately, and then at 07:00 it will try to execute the transaction ID.
Nate Eldredge
CC BY-SA 3.0
2014-07-19T05:12:09.537Z
@mattburnett that is really helpful. But why do I need wget when I can just open the php file using the scheduler?
rahulgarg12342
CC BY-SA 3.0
2014-07-19T06:55:30.383Z
I wasn't aware that you could open a URL with the scheduler; i dont use it much. If you can then skip using wget.
Matt
CC BY-SA 3.0
2014-07-18T18:04:37.390Z
2014-07-19T06:40:06.803Z
2017-05-23T12:34:59.703Z
Mathias711
<p>you can have a php or python script and keep it running till the time comes, something like:</p>

<pre><code>&lt;?php
$hour = date('G'); // 0 .. 23
// YOUR VARIABLES FOR THE JSON REQUEST SHOULD GO HERE
//if time = 16 
if ($hour == 16) { 
    $json_url = "https://blockchain.info/merchant/$guid/payment?password=$firstpassword&amp;to=$addressa&amp;amount=$amounta";  
$json_data = file_get_contents($json_url);

 } ?&gt;
</code></pre>

<p>this is more of a pseudo-code for what I meant and might not work without modification.</p>

CC BY-SA 3.0
2014-07-19T07:51:12.510Z
2014-07-19T07:51:12.510Z
Shayan
<p>I just wanted to know if you could schedule a bitcoin transaction. For example I want to send some BTC to someone exactly at 4:00 pm but it is 1:00 pm at my current place. Is that possible so that my wallet somehow automatically sends the BTC after a certain time?</p>

CC BY-SA 3.0
2014-07-18T20:47:05.663Z
This can actually be done on the blockchain itself, if you set the [nLockTime](https://en.bitcoin.it/wiki/Protocol_specification#tx) value. But this would probably mean making a raw transaction.
Tim S.
<transactions><automation>
How to schedule a bitcoin transaction?
rahulgarg12342
# How to schedule a bitcoin transaction?

(Asked by: username_0 on 2014-07-18)

I just wanted to know if you could schedule a bitcoin transaction. For example I want to send some BTC to someone exactly at 4:00 pm but it is 1:00 pm at my current place. Is that possible so that my wallet somehow automatically sends the BTC after a certain time?

**Tags:** transactions, automation

> **Comments:**
> **username_1**: This can actually be done on the blockchain itself, if you set the [nLockTime](https://en.bitcoin.it/wiki/Protocol_specification#tx) value. But this would probably mean making a raw transaction.  

---

## 2 answers

### Answer by username_2 on 2014-07-18. Score: 3

## Option 1

I'm not sure on which platform you are, but if you use a Linux or Mac, you can combine the following two commands (sources [here](https://stackoverflow.com/questions/18945669/linux-how-to-run-script-at-certain-time) and [here](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list). Check also the `at` [manual](http://manpages.ubuntu.com/manpages/hardy/man1/at.1posix.html)):

```
echo "ls -l" | at 07:00 

```

and

```
 bitcoind sendtoaddress <bitcoinaddress> <amount>

```

to make something like:

```
echo "bitcoind sendtoaddress    1MAtHias8yvaLcDgckkG5QnVLY7ucBZrGv 0.01" | at 07:00 

```

to send me 0.01 BTC at 07:00 o'clock in the morning. I think you're computer should stay on for this, as it cannot send a transaction with it turned off.

## Option 2

You can also work with `sleep` (Mac and Linux only):

```
sleep 120 && bitcoind sendtoaddress 1MAtHias8yvaLcDgckkG5QnVLY7ucBZrGv 0.01

```

The number behind `sleep` is the amount of seconds that there is nothing executed. So now it will send 0.01 BTC to me, after 2 (=120/60) minutes. The `&&` will first execute the left side. If that executed succesful, the right side is executed. It is more insightful, but you'll have to calculate the amount of seconds and is as precise as your calculations.

## Option 3

For windows:

```
timeout 120 && bitcoind sendtoaddress   1MAtHias8yvaLcDgckkG5QnVLY7ucBZrGv 0.01

```

`timeout` is the sleep variant of windows. Probably doesn't work on Windows XP, but works here on W8 and should work on W7. The `&&` does the same as in **Option 2**.

> **Comments:**
> **username_0**: I use windows and use blockchain. Is there any other option?  
> **username_2**: I don't have a answer in that case. I will leave my answer however, as it can be a solution to someone else who visits this page later on.  
> **username_0**: Even if I download the client, do you know the command for windows?  
> **username_2**: There are the same commands as the other clients. See the second link from my answer for the commands. A [screenshot](https://i.sstatic.net/VkREl.png) shows how you can use it, I suppose  
> **username_0**: Since you are a little experienced, please can you just take a look at blockchain API and help me make a command so I can use it to send. I think the blockchain API should enable that.  
> **username_2**: I am not into PHP at all. I think you can do the same approach as I did in option 2 (and 3). Otherwise you can do something with [time](http://php.net/manual/en/function.time.php) and check if it is 04:00 pm on a specific day. If that is true, execute the send command `https://blockchain.info/nl/merchant/$guid/payment?password=$main_password&second_password=$second_password&to=$address&amount=$amount` (from [here](https://blockchain.info/nl/api/blockchain_wallet_api)). I believe there is no built-in option to postpone a transaction.  
> **username_3**: To follow up on Mathias's answer/comments. For accessing the PHP API he linked, you can use wget (http://gnuwin32.sourceforge.net/packages/wget.htm). And to have it run once (or repeatedly) at a certain time, you can use the Task Scheduler built in to Windows, which you can find if you open Computer Management->System Tools->Task Scheduler->Task Scheduler Library  
> **username_4**: The third command you give in Option 1 is missing an `echo`; as written it will send the coins immediately, and then at 07:00 it will try to execute the transaction ID.  
> **username_0**: @mattburnett that is really helpful. But why do I need wget when I can just open the php file using the scheduler?  
> **username_3**: I wasn't aware that you could open a URL with the scheduler; i dont use it much. If you can then skip using wget.  

---

### Answer by username_5 on 2014-07-19. Score: 0

you can have a php or python script and keep it running till the time comes, something like:

```
<?php
$hour = date('G'); // 0 .. 23
// YOUR VARIABLES FOR THE JSON REQUEST SHOULD GO HERE
//if time = 16 
if ($hour == 16) { 
    $json_url = "https://blockchain.info/merchant/$guid/payment?password=$firstpassword&to=$addressa&amount=$amounta";  
$json_data = file_get_contents($json_url);

 } ?>

```

this is more of a pseudo-code for what I meant and might not work without modification.


---

