<p>Yes. It's save.
The current transaction submitting logic (<code>CommitTransaction</code>) do report the transaction ID after adding the tx to the local database and to the mempool.
On top, it holds the <code>cs_main</code> and the <code>cs_wallet</code> lock which makes sure not other thread can manipulate the relevant data-structured during the time of <code>AddToWallet</code> and <code>AcceptToMempool</code>.
<a href="https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2557" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2557</a></p>

<p>This means, when you call a <code>send*</code> RPC command, you will get response (the txid) <em>after</em> the transaction was submitted to the mempool and added to your local wallet database.</p>

<p>Immediately calling <code>gettransaction</code> is therefore save.</p>

CC BY-SA 3.0
2016-11-07T13:34:21.307Z
2016-11-07T13:34:21.307Z
Jonas Schnelli
<p>I want to use <code>sendfrom</code> bitcoind rpc method to transfer funds from my account to some address. Right after calling it, I want to get all the data about this transaction using <code>gettransaction</code> or <code>listsinceblock</code>. Does bitcoind's wallet system process a new transaction <em>before</em> or <em>after</em> responding with a "txid" to <code>sendfrom</code>? Is it safe to call <code>sendfrom</code> and <code>gettransaction</code> right after that from my python code for example?</p>

<bitcoind><json-rpc><sending>
Bitcoin Core 0.13 -- SENDFROM rpc call
Yevhen
# Bitcoin Core 0.13 -- SENDFROM rpc call

(Asked by: username_0 on 2016-11-07)

I want to use `sendfrom` bitcoind rpc method to transfer funds from my account to some address. Right after calling it, I want to get all the data about this transaction using `gettransaction` or `listsinceblock`. Does bitcoind's wallet system process a new transaction *before* or *after* responding with a "txid" to `sendfrom`? Is it safe to call `sendfrom` and `gettransaction` right after that from my python code for example?

**Tags:** bitcoind, json-rpc, sending


---

## 1 answers

### Answer by username_1 on 2016-11-07. Score: 2 | Accepted answer

Yes. It's save.
The current transaction submitting logic (`CommitTransaction`) do report the transaction ID after adding the tx to the local database and to the mempool.
On top, it holds the `cs_main` and the `cs_wallet` lock which makes sure not other thread can manipulate the relevant data-structured during the time of `AddToWallet` and `AcceptToMempool`.
<https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2557>

This means, when you call a `send*` RPC command, you will get response (the txid) *after* the transaction was submitted to the mempool and added to your local wallet database.

Immediately calling `gettransaction` is therefore save.


---

