How are off-chain transactions handled by bitcoind? I'm trying to figure out how transactions are actually handled by bitcoind.

I'm looking at the full list of RPC methods 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 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 &lt;fromaccount&gt; &lt;toaccount&gt; &lt;amount&gt; [minconf=1] [comment]

Move from one account in your wallet to another



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?
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 &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).


It requires an account to send bitcoins from.


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?
What minconf parameter is for?


sendtoaddress

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.



The account is not specified for this call. What account bitcoind will use? The default one?
Why there is no minconf parameter for this one?
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:


giving someone a computer/phone that has a wallet witg BTC on it
giving someone a private key/physical bitcoin.
giving someone access to a shared webwallet account
sending money from one account to another within the same service (which simply decrements one person's balance and increments another's balance)
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:


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.
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.
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.
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.
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.
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.