<p>An off-chain transaction means in simple terms that the parties involved in the transaction basically exchange their private keys. Say you want to pay your friend 1 BTC. You would just give the private key to your address holding the 1BTC. Go through <a href="https://bitcoin.stackexchange.com/questions/12530/how-do-off-chain-transactions-work">this</a> link for more details.
Now coming to your questions.</p>

<ol>
<li><p>Firstly, note that accounts and the <code>move</code> api have been deprecated an no longer used. Just for explanation sake, accounts are nothing but a set of addresses in your bitcoind wallet. Now the move command actually transfers the BTC from the addresses in one account to the other. There is no way you can convince the bitcoind client to share the private key and not move the funds(because it already has all the private keys). So the scenario you have given doesn't make sense.</p></li>
<li><p>The minconf is for the client to know to use only those transaction outputs which have as many mnimum confirmations as you have provided.</p></li>
<li><p>sendfrom is also deprecated since accounts are deprecated. What the bitcoind wallet does is that it combines the funds in all your addresses to send the money to the address specified (if the value you wish to send is not available in a single address)</p></li>
<li><p>same as point 2</p></li>
<li><p>As I said accounts are deprecated, so it will use the address which has more than the value specified and if not, combine addresses to send the money to the recipient address.</p></li>
<li><p>same as point 2</p></li>
</ol>

<p>Edit: Point 1: The move command simply decrements one accounts virtual internal virtual balance, and increments another and does not move the BTC's.
As corrected by Peter Wuille</p>

CC BY-SA 3.0
2016-12-22T05:50:51.550Z
Thank you for your answer. It clears this for me a bit. Also, how do I know what features or API calls are deprecated or not? It looks like documentation is poor and severely outdated.
Robert Wood
CC BY-SA 3.0
2016-12-22T06:08:01.953Z
Through the terminal try typing the api without the parameters it requires, for example, just type move and read the output, you would see there it is written that it is deprecated, but can still be used.
Shabahat M. Ayubi
CC BY-SA 3.0
2016-12-23T12:57:35.110Z
The move command does not move funds from one address to another. It simply decrements one internal virtual balance, and increments another. Accounts are not addresses. They are indeed scheduled to be removed in a future version (partially because they're very hard to understand).
Pieter Wuille
CC BY-SA 3.0
2016-12-21T13:31:30.933Z
2016-12-23T13:04:08.877Z
2017-04-13T12:47:34.187Z
Shabahat M. Ayubi
<p>First of all, there are many types of off-chain transactions. Any movement of value in BTC that does not directly correspond to a blockchain transaction can be classified as one. This includes:</p>

<ol>
<li>giving someone a computer/phone that has a wallet witg BTC on it</li>
<li>giving someone a private key/physical bitcoin.</li>
<li>giving someone access to a shared webwallet account</li>
<li>sending money from one account to another within the same service (which simply decrements one person's balance and increments another's balance)</li>
<li>payment channels, including Lightning, which negotiate a small number of transactions that correspond to the net effect of many more value transfers.</li>
</ol>

<p>The <code>move</code> command in bitcoind does not result in an off-chain transaction; it simply increments one internal counter and decrements another. It is off-chain for sure, but it's hard to call it a transaction. All you've done is changed how you're counting the money you already have control over.</p>

<p>A service (like #4 above) could potentially use bitcoind's move command to implement a (simple) off-chain transaction system. But it at least requires having a setup where multiple people have accounts on your system, and them treating you as a custodial for their money.</p>

<p>As for the questions you're asking:</p>

<ol>
<li><p>Accounts are a completely independent concept from addresses. From bitcoind's perspective, there is no such thing as an address balance. There is the wallet balance (how many coins the wallet has control over in total), and account balances (which are simply internal bean counters, with no relation to anything on the blockchain). When a new transaction sends M money to address A, and address A is associated with account C, the wallet balance goes up M, and the account balance for C goes up. When you send money with sendfrom, the named account is debited. But the actual on-chain transaction created always uses <em>any</em> coins the wallet has control over. Again: there is no relation between on-chain coins (transaction outputs) and account balances.</p></li>
<li><p>The move command used to do a balance check on the to-be-debited account, and fail if it did not have enough counting only transactions with at least <code>minconf</code> confirmations. This functionality was removed a long time ago, and the minconf parameter is ignored now.</p></li>
<li><p>Bitcoind treats the whole wallet as owning the coins, and it will use any coins available for any transaction it creates. There is no relation between coins and accounts. <code>sendfrom</code> simply allows you to specify which account balance to decrease.</p></li>
<li><p><code>sendfrom</code> does a balance check on the debited account, and will fail if it would make the account balance negative, counting only crediting transactions with at least <code>minconf</code> confirmations. This feature is not very reliable, as fees can make the account go negative despite the balance check before.</p></li>
<li><p><code>sendtoaddress</code> always debits the "" account, and does not do a balance check on it, so the "" account balance can go negative (as long as the wallet balance - the sum of the account balances - is positive). Again: it does in no way restrict which coins are used to construct the transaction.</p></li>
<li><p>Because <code>sendtoaddress</code> does not do a balance check, there is no way in which a <code>minconf</code> parameter would have an effect. Normally, all coins with 1 confirmation (if they come from other wallets) or 0 confirmation (if they come from yourself) are spendable, though for example the <code>spendzeroconfchange</code> setting modifies this).</p></li>
</ol>

<p>As already pointed out, the account balance system and the move command are deprecated because they are very hard to understand and use correctly. If you need accounting, implement it yourself on top.</p>

CC BY-SA 3.0
2016-12-23T16:46:10.303Z
Thank you Pieter for an elaborate answer. This really cleared things for me now. Also, we've decided to implement our own accounting system and to treat Bitcoin wallet as a single shared account for all customers, as you suggested in the last sentence.
Robert Wood
CC BY-SA 3.0
2016-12-23T15:36:09.533Z
2016-12-23T15:36:09.533Z
Pieter Wuille
<p>I'm trying to figure out how transactions are actually handled by bitcoind.</p>

<p>I'm looking at the <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow noreferrer">full list of RPC methods</a> and there are missing documentation for some most interesting methods.</p>

<h1>move</h1>

<p>I know there are two methods of moving bitcoins between addresses either via direct p2p transaction or via the so-called <a href="https://en.bitcoin.it/wiki/Off-Chain_Transactions" rel="nofollow noreferrer">off-chain</a> transaction. If I believe correctly, the built-in wallet of bitcoind allows us to send off-chain transactions via the <strong>move</strong> method. Sadly, it's not very well documented, but I want to know exactly how it works.</p>

<p>Here's the documentation for it:</p>

<pre><code>move &lt;fromaccount&gt; &lt;toaccount&gt; &lt;amount&gt; [minconf=1] [comment]

Move from one account in your wallet to another
</code></pre>

<ol>
<li><p>So, if account A has one BTC and account B has zero. What will happen if I first <em>move</em> one BTC from A to B using off-chain transaction and then issue a direct transaction of 1 BTC from B to C?</p></li>
<li><p>Also, what <code>minconf</code> parameter is for? As far as I understand, off-chain transactions doesn't require confirmations.</p></li>
</ol>

<h1>sendfrom</h1>

<p>Here's the documentation for the <strong>sendfrom</strong> method:</p>

<pre><code>sendfrom &lt;fromaccount&gt; &lt;tobitcoinaddress&gt; &lt;amount&gt; [minconf=1] [comment] [comment-to]

&lt;amount&gt; is a real and is rounded to 8 decimal places. Will send the given amount to the given address, ensuring the account has a valid balance using [minconf] confirmations. Returns the transaction ID if successful (not in JSON object).
</code></pre>

<p>It requires an account to send bitcoins from.</p>

<ol start="3">
<li><p>What if I have multiple addresses/transactions for the specified account? What strategy bitcoind uses to determine from which addresses to make a transaction and how much bitcoins to use from each?</p></li>
<li><p>What <code>minconf</code> parameter is for?</p></li>
</ol>

<h1>sendtoaddress</h1>

<pre><code>sendtoaddress &lt;bitcoinaddress&gt; &lt;amount&gt; [comment] [comment-to]

&lt;amount&gt; is a real and is rounded to 8 decimal places. Returns the transaction ID &lt;txid&gt; if successful.
</code></pre>

<ol start="5">
<li><p>The account is not specified for this call. What account bitcoind will use? The default one?</p></li>
<li><p>Why there is no <code>minconf</code> parameter for this one?</p></li>
</ol>

CC BY-SA 3.0
2016-12-23T09:36:34.113Z
Many pages in the wiki are outdated, you might want to also check out the [Bitcoin Developer Reference](https://bitcoin.org/en/developer-reference#sendtoaddress). This wiki page is deprecated, but explains Bitcoin Core's [accounts functionality](https://en.bitcoin.it/wiki/Help:Accounts_explained). As Shabahat M. Ayubi explained below, the accounts feature in Bitcoin Core is deprecated.
Murch
<transactions><bitcoind><bitcoin-core><bitcoin-core-accounts><off-chain>
How are off-chain transactions handled by bitcoind?
Robert Wood
# How are off-chain transactions handled by bitcoind?

(Asked by: username_0 on 2016-12-21)

I'm trying to figure out how transactions are actually handled by bitcoind.

I'm looking at the [full list of RPC methods](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list) and there are missing documentation for some most interesting methods.

# move

I know there are two methods of moving bitcoins between addresses either via direct p2p transaction or via the so-called [off-chain](https://en.bitcoin.it/wiki/Off-Chain_Transactions) transaction. If I believe correctly, the built-in wallet of bitcoind allows us to send off-chain transactions via the **move** method. Sadly, it's not very well documented, but I want to know exactly how it works.

Here's the documentation for it:

```
move <fromaccount> <toaccount> <amount> [minconf=1] [comment]

Move from one account in your wallet to another

```

1. So, if account A has one BTC and account B has zero. What will happen if I first *move* one BTC from A to B using off-chain transaction and then issue a direct transaction of 1 BTC from B to C?
2. Also, what `minconf` parameter is for? As far as I understand, off-chain transactions doesn't require confirmations.

# sendfrom

Here's the documentation for the **sendfrom** method:

```
sendfrom <fromaccount> <tobitcoinaddress> <amount> [minconf=1] [comment] [comment-to]

<amount> is a real and is rounded to 8 decimal places. Will send the given amount to the given address, ensuring the account has a valid balance using [minconf] confirmations. Returns the transaction ID if successful (not in JSON object).

```

It requires an account to send bitcoins from.

3. What if I have multiple addresses/transactions for the specified account? What strategy bitcoind uses to determine from which addresses to make a transaction and how much bitcoins to use from each?
4. What `minconf` parameter is for?

# sendtoaddress

```
sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to]

<amount> is a real and is rounded to 8 decimal places. Returns the transaction ID <txid> if successful.

```

5. The account is not specified for this call. What account bitcoind will use? The default one?
6. Why there is no `minconf` parameter for this one?

**Tags:** transactions, bitcoind, bitcoin-core, bitcoin-core-accounts, off-chain

> **Comments:**
> **username_1**: Many pages in the wiki are outdated, you might want to also check out the [Bitcoin Developer Reference](https://bitcoin.org/en/developer-reference#sendtoaddress). This wiki page is deprecated, but explains Bitcoin Core's [accounts functionality](https://en.bitcoin.it/wiki/Help:Accounts_explained). As username_2 M. username_2 explained below, the accounts feature in Bitcoin Core is deprecated.  

---

## 2 answers

### Answer by username_3 on 2016-12-23. Score: 3 | Accepted answer

First of all, there are many types of off-chain transactions. Any movement of value in BTC that does not directly correspond to a blockchain transaction can be classified as one. This includes:

1. giving someone a computer/phone that has a wallet witg BTC on it
2. giving someone a private key/physical bitcoin.
3. giving someone access to a shared webwallet account
4. sending money from one account to another within the same service (which simply decrements one person's balance and increments another's balance)
5. payment channels, including Lightning, which negotiate a small number of transactions that correspond to the net effect of many more value transfers.

The `move` command in bitcoind does not result in an off-chain transaction; it simply increments one internal counter and decrements another. It is off-chain for sure, but it's hard to call it a transaction. All you've done is changed how you're counting the money you already have control over.

A service (like #4 above) could potentially use bitcoind's move command to implement a (simple) off-chain transaction system. But it at least requires having a setup where multiple people have accounts on your system, and them treating you as a custodial for their money.

As for the questions you're asking:

1. Accounts are a completely independent concept from addresses. From bitcoind's perspective, there is no such thing as an address balance. There is the wallet balance (how many coins the wallet has control over in total), and account balances (which are simply internal bean counters, with no relation to anything on the blockchain). When a new transaction sends M money to address A, and address A is associated with account C, the wallet balance goes up M, and the account balance for C goes up. When you send money with sendfrom, the named account is debited. But the actual on-chain transaction created always uses *any* coins the wallet has control over. Again: there is no relation between on-chain coins (transaction outputs) and account balances.
2. The move command used to do a balance check on the to-be-debited account, and fail if it did not have enough counting only transactions with at least `minconf` confirmations. This functionality was removed a long time ago, and the minconf parameter is ignored now.
3. Bitcoind treats the whole wallet as owning the coins, and it will use any coins available for any transaction it creates. There is no relation between coins and accounts. `sendfrom` simply allows you to specify which account balance to decrease.
4. `sendfrom` does a balance check on the debited account, and will fail if it would make the account balance negative, counting only crediting transactions with at least `minconf` confirmations. This feature is not very reliable, as fees can make the account go negative despite the balance check before.
5. `sendtoaddress` always debits the "" account, and does not do a balance check on it, so the "" account balance can go negative (as long as the wallet balance - the sum of the account balances - is positive). Again: it does in no way restrict which coins are used to construct the transaction.
6. Because `sendtoaddress` does not do a balance check, there is no way in which a `minconf` parameter would have an effect. Normally, all coins with 1 confirmation (if they come from other wallets) or 0 confirmation (if they come from yourself) are spendable, though for example the `spendzeroconfchange` setting modifies this).

As already pointed out, the account balance system and the move command are deprecated because they are very hard to understand and use correctly. If you need accounting, implement it yourself on top.

> **Comments:**
> **username_0**: Thank you username_3 for an elaborate answer. This really cleared things for me now. Also, we've decided to implement our own accounting system and to treat Bitcoin wallet as a single shared account for all customers, as you suggested in the last sentence.  

---

### Answer by username_2 on 2016-12-21. Score: 1

An off-chain transaction means in simple terms that the parties involved in the transaction basically exchange their private keys. Say you want to pay your friend 1 BTC. You would just give the private key to your address holding the 1BTC. Go through [this](https://bitcoin.stackexchange.com/questions/12530/how-do-off-chain-transactions-work) link for more details.
Now coming to your questions.

1. Firstly, note that accounts and the `move` api have been deprecated an no longer used. Just for explanation sake, accounts are nothing but a set of addresses in your bitcoind wallet. Now the move command actually transfers the BTC from the addresses in one account to the other. There is no way you can convince the bitcoind client to share the private key and not move the funds(because it already has all the private keys). So the scenario you have given doesn't make sense.
2. The minconf is for the client to know to use only those transaction outputs which have as many mnimum confirmations as you have provided.
3. sendfrom is also deprecated since accounts are deprecated. What the bitcoind wallet does is that it combines the funds in all your addresses to send the money to the address specified (if the value you wish to send is not available in a single address)
4. same as point 2
5. As I said accounts are deprecated, so it will use the address which has more than the value specified and if not, combine addresses to send the money to the recipient address.
6. same as point 2

Edit: Point 1: The move command simply decrements one accounts virtual internal virtual balance, and increments another and does not move the BTC's.
As corrected by Peter username_3

> **Comments:**
> **username_0**: Thank you for your answer. It clears this for me a bit. Also, how do I know what features or API calls are deprecated or not? It looks like documentation is poor and severely outdated.  
> **username_2**: Through the terminal try typing the api without the parameters it requires, for example, just type move and read the output, you would see there it is written that it is deprecated, but can still be used.  
> **username_3**: The move command does not move funds from one address to another. It simply decrements one internal virtual balance, and increments another. Accounts are not addresses. They are indeed scheduled to be removed in a future version (partially because they're very hard to understand).  

---

