<p>Most services run their own services which track the UTXOs that they need. They use Bitcoin Core as an edge node which forwards all of the valid blocks and transactions to their internal software that adds them all to a database. This could be a software based on insight or Abe or something homegrown. In this way, they don't need to implement consensus and validation logic, just deserialization and database storage.</p>

<blockquote>
  <p>Is there any way to get UTXO from bitcoin core without importing the address into the wallet?</p>
</blockquote>

<p>Bitcoin Core has a <code>scantxoutset</code> command that you can use to get the UTXOs for a particular scriptPubKey (from an address, descriptor, raw script, etc.).</p>

CC BY-SA 4.0
2019-11-14T21:50:22.287Z
2019-11-14T21:50:22.287Z
Ava Chow
<p>My major concern was having privatekey in the Bitcoin Core wallet, So I did generate the address outside the Bitcoin core from third party library or HSM and used <code>importaddress</code> RPC method to import the address as watch-only address and then Bitcoin core handled all UTXO monitoring, Then use <code>listunspent</code> to get the UTXO of the imported address. By this approach privatekey is cold from the core.</p>
<p>Thanks @yyforyongyu for suggesting this.</p>

CC BY-SA 4.0
2021-12-28T14:29:31.887Z
This is a valid approach for using Bitcoin Core as a cold wallet. In the future I suspect many Bitcoin will be lost as the result of inheritance where the priv-key must be passed from one generation to another, but usually, the priv-key will be in the offline wallet to sign transactions and only the password will be necessary. The transactions can be hand loaded into mempool of the online wallet to gossip.
Willtech
CC BY-SA 4.0
2020-10-20T20:48:30.087Z
2020-10-20T20:48:30.087Z
Tharun Prabakaran
<p>Most services operating large scale wallets only use Bitcoin Core for networking information, and maintain a separate utxo set for wallet purposes.</p>

<p>There are many existing options to build a full utxo set that can be queried for arbitrary addresses, such as the insight project.</p>

<p>Moreover, recent versions of Bitcoin Core come with the <code>scantxoutset</code> RPC call, which allows you to locate unspent outputs for a given address or locking script.</p>

CC BY-SA 4.0
2019-11-14T09:33:01.633Z
2019-11-14T09:33:01.633Z
Raghav Sood
<p>Speaking as a formal wallet engineer, what we did back then,</p>

<ol>
<li>Once in a while, we would batch generate lots of bitcoin addresses and import them into bitcoind.</li>
<li>Can't speak for ALL applications, for us, we let bitcoind manage all its UTXO set.</li>
<li>Depending on the situation,

<ul>
<li>if the address is newly generated by you, then no, you have to import it first because, well, it's new, you have to tell bitcoind to use it.</li>
<li>if it's a used address, I believe you can parse its UTXOs from all the block data, though we never did that.</li>
</ul></li>
</ol>

CC BY-SA 4.0
2019-11-14T07:38:12.997Z
Thanks, Does having address imported in the wallet suggested for production ?, What are the safety measure that has to be taken?
Tharun Prabakaran
CC BY-SA 4.0
2019-11-14T09:31:47.610Z
Yes. You probably need to periodically import a batch of addresses into the wallet, as a production site, however that's more of a topic of software engeering. As for safety measure, if you are generating those addresses, it's recommended to use HD wallet so your private keys won't get exposed.
yyforyongyu
CC BY-SA 4.0
2019-11-14T09:33:56.443Z
Using an HD wallet does not prevent exposure of your private keys, especially if you are importing them into Bitcoin Core
Raghav Sood
CC BY-SA 4.0
2019-11-14T09:38:55.480Z
1) Import addresses as watch-only; 2) Use an HD wallet, and save the master private key offline; 3) Construct raw transaction online, send it to offline signing. How's my private key exposed?
yyforyongyu
CC BY-SA 4.0
2019-11-14T07:12:40.130Z
2019-11-14T07:12:40.130Z
yyforyongyu
<p>AFIK, UTXO of an address cannot be retrieved using bitcoin-core, without importing the address in the wallet. </p>

<ol>
<li>How are application in production able to get UTXO ?</li>
<li>Does all the application use Indexed database like Insight or Abe to get UTXO ?</li>
<li>Is there any way to get UTXO from bitcoin core without importing the address into the wallet?</li>
</ol>

<bitcoin-core><bitcoind><utxo><utxo-set><blockchain-explorer>
How bitcoin application in production retrive UTXO's
Tharun Prabakaran
# How bitcoin application in production retrive UTXO's

(Asked by: username_0 on 2019-11-13)

AFIK, UTXO of an address cannot be retrieved using bitcoin-core, without importing the address in the wallet.

1. How are application in production able to get UTXO ?
2. Does all the application use Indexed database like Insight or Abe to get UTXO ?
3. Is there any way to get UTXO from bitcoin core without importing the address into the wallet?

**Tags:** bitcoin-core, bitcoind, utxo, utxo-set, blockchain-explorer


---

## 4 answers

### Answer by username_1 on 2019-11-14. Score: 2

Most services run their own services which track the UTXOs that they need. They use Bitcoin Core as an edge node which forwards all of the valid blocks and transactions to their internal software that adds them all to a database. This could be a software based on insight or Abe or something homegrown. In this way, they don't need to implement consensus and validation logic, just deserialization and database storage.

> Is there any way to get UTXO from bitcoin core without importing the address into the wallet?

Bitcoin Core has a `scantxoutset` command that you can use to get the UTXOs for a particular scriptPubKey (from an address, descriptor, raw script, etc.).


---

### Answer by username_0 on 2020-10-20. Score: 2

My major concern was having privatekey in the Bitcoin Core wallet, So I did generate the address outside the Bitcoin core from third party library or HSM and used `importaddress` RPC method to import the address as watch-only address and then Bitcoin core handled all UTXO monitoring, Then use `listunspent` to get the UTXO of the imported address. By this approach privatekey is cold from the core.

Thanks @username_4 for suggesting this.

> **Comments:**
> **username_2**: This is a valid approach for using Bitcoin Core as a cold wallet. In the future I suspect many Bitcoin will be lost as the result of inheritance where the priv-key must be passed from one generation to another, but usually, the priv-key will be in the offline wallet to sign transactions and only the password will be necessary. The transactions can be hand loaded into mempool of the online wallet to gossip.  

---

### Answer by username_3 on 2019-11-14. Score: 1

Most services operating large scale wallets only use Bitcoin Core for networking information, and maintain a separate utxo set for wallet purposes.

There are many existing options to build a full utxo set that can be queried for arbitrary addresses, such as the insight project.

Moreover, recent versions of Bitcoin Core come with the `scantxoutset` RPC call, which allows you to locate unspent outputs for a given address or locking script.


---

### Answer by username_4 on 2019-11-14. Score: 0

Speaking as a formal wallet engineer, what we did back then,

1. Once in a while, we would batch generate lots of bitcoin addresses and import them into bitcoind.
2. Can't speak for ALL applications, for us, we let bitcoind manage all its UTXO set.
3. Depending on the situation,
   * if the address is newly generated by you, then no, you have to import it first because, well, it's new, you have to tell bitcoind to use it.
   * if it's a used address, I believe you can parse its UTXOs from all the block data, though we never did that.

> **Comments:**
> **username_0**: Thanks, Does having address imported in the wallet suggested for production ?, What are the safety measure that has to be taken?  
> **username_4**: Yes. You probably need to periodically import a batch of addresses into the wallet, as a production site, however that's more of a topic of software engeering. As for safety measure, if you are generating those addresses, it's recommended to use HD wallet so your private keys won't get exposed.  
> **username_3**: Using an HD wallet does not prevent exposure of your private keys, especially if you are importing them into Bitcoin Core  
> **username_4**: 1) Import addresses as watch-only; 2) Use an HD wallet, and save the master private key offline; 3) Construct raw transaction online, send it to offline signing. How's my private key exposed?  

---

