<p>Bitcoin nodes have no idea of what a &quot;balance&quot; is, that's a concept that wallets have. The Bitcoin peer to peer network allows for the communication of transactions or blocks (neither of which contain &quot;balance&quot; information), and nothing else. There is also no portion of the private RPC API which will tell you the &quot;balance&quot; of an arbitrary address either (it can tell you detail about a locally running wallet with <code>getbalance</code> however), and these interfaces are never made public because they allow almost complete control of the nodes wallet and operation.</p>
<blockquote>
<p>Does my Trezor depend on Trezor.com running a node?</p>
</blockquote>
<p>With their software as supplied, absolutely. If you use it with another piece of software locally it is usually the case that you're trusting a remote party, but there's the possibility of setting it up in such a way that it does not. For example, Electrum, but only when connected to <a href="https://github.com/chris-belcher/electrum-personal-server" rel="nofollow noreferrer">Personal Electrum Server</a>, which runs locally as a middle man between a Bitcoin node you operate and Electrum.</p>

CC BY-SA 4.0
2020-12-11T02:14:14.517Z
https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/getbalance/
Clayton Rabenda
CC BY-SA 4.0
2020-12-11T02:14:27.410Z
You're wrong, but fair enough. In that case how do I get all the outputs to a certain address?
Clayton Rabenda
CC BY-SA 4.0
2020-12-11T02:17:30.350Z
`getbalance` is a wallet RPC. It only shows information about the current local wallet, you can not use it for anything that isn't stored in a wallet file on the Bitcoin node itself. Why ask questions on stackexchange if you're simply refusing to believe the information given to you by an expert?
Claris
CC BY-SA 4.0
2020-12-11T02:20:20.637Z
The RPC interface is also not exposed to the internet; it's only designed for letting the node's operator query it. The network itself uses a P2P protocol, which has no concept of wallets or addresses at all.
Pieter Wuille
CC BY-SA 4.0
2020-12-11T02:28:49.240Z
Fair enough, right. Why would a miner want to provide wallet services... Okay, so how would I do this? I want to get a balance from the network without running a node...
Clayton Rabenda
CC BY-SA 4.0
2020-12-11T02:39:34.663Z
Then you'll need some service that provides that information to you, and you'll have to trust them. There are plenty of sites that do this (block explorers, and others), but if you're relying on this information for anything important, I'd strongly recommend against this approach.
Pieter Wuille
CC BY-SA 4.0
2020-12-11T04:50:30.237Z
So SPV wallets are not possible on BTC anymore?
Clayton Rabenda
CC BY-SA 4.0
2020-12-11T05:07:21.537Z
SPV is a description of how data is verified, it has absolutely nothing to do with how you obtain that data.
Claris
CC BY-SA 4.0
2020-12-11T14:30:46.990Z
"How old are you?" "I can't tell you, I can only verify that my age is 39". Bitcoiners are weird...
Clayton Rabenda
CC BY-SA 4.0
2020-12-11T14:32:28.587Z
Letter sized paper is 8.5 x 11 inches. Why isn't this a description of where to buy it!?
Claris
CC BY-SA 4.0
2020-12-11T21:44:25.063Z
@ClaytonRabenda You could run a lightweight node that does SPV, though they can't verify completeness of the information they received (they can verify incoming transactions, and how much they pay you, but they can't guarantee that your peers didn't omit information). This has always been an issue for SPV.
Pieter Wuille
CC BY-SA 4.0
2020-12-11T01:30:05.160Z
2020-12-11T02:21:35.057Z
2020-12-11T02:21:35.057Z
Claris
<p>I was under the impression that I'd be able to get a balance from the network directly, not only by going through some http interface which wraps the server RPCs.</p>
<p>I am curious, is it possible to get a balance by hitting a node on the network directly? I've tried using curl to hit every node on the network already.</p>
<pre><code>curl --data-binary '{&quot;jsonrpc&quot;: &quot;1.0&quot;, &quot;id&quot;:&quot;curltest&quot;, &quot;method&quot;: &quot;getbalance&quot;, &quot;params&quot;: [&quot;*&quot;, 6] }' -H 'content-type: text/plain;' http://${server}/
</code></pre>
<p>The documentation says to include the --user flag, so I believe this is why the calls fail.</p>
<p>If not, how is my Trezor able to operate independently? Does my Trezor depend on Trezor.com running a node?</p>
<p>Also, I am curious, some APIs must be open, for example a new node which wishes to sync must be able to fetch blocks from it's peers, but I see that getblock RPC also requires authorization, i.e. &quot;curl --user&quot;...</p>
<p><a href="https://bitcoincore.org/en/doc/0.20.0/rpc/blockchain/getblock/" rel="nofollow noreferrer">https://bitcoincore.org/en/doc/0.20.0/rpc/blockchain/getblock/</a></p>
<p>What APIs do nodes in the network expose directly? Any?</p>
<p>Thanks!</p>

<api>
How to get a balance from the network directly?
Clayton Rabenda
# How to get a balance from the network directly?

(Asked by: username_0 on 2020-12-11)

I was under the impression that I'd be able to get a balance from the network directly, not only by going through some http interface which wraps the server RPCs.

I am curious, is it possible to get a balance by hitting a node on the network directly? I've tried using curl to hit every node on the network already.

```
curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": ["*", 6] }' -H 'content-type: text/plain;' http://${server}/

```

The documentation says to include the --user flag, so I believe this is why the calls fail.

If not, how is my Trezor able to operate independently? Does my Trezor depend on Trezor.com running a node?

Also, I am curious, some APIs must be open, for example a new node which wishes to sync must be able to fetch blocks from it's peers, but I see that getblock RPC also requires authorization, i.e. "curl --user"...

<https://bitcoincore.org/en/doc/0.20.0/rpc/blockchain/getblock/>

What APIs do nodes in the network expose directly? Any?

Thanks!

**Tags:** api


---

## 1 answers

### Answer by username_1 on 2020-12-11. Score: 3

Bitcoin nodes have no idea of what a "balance" is, that's a concept that wallets have. The Bitcoin peer to peer network allows for the communication of transactions or blocks (neither of which contain "balance" information), and nothing else. There is also no portion of the private RPC API which will tell you the "balance" of an arbitrary address either (it can tell you detail about a locally running wallet with `getbalance` however), and these interfaces are never made public because they allow almost complete control of the nodes wallet and operation.

> Does my Trezor depend on Trezor.com running a node?

With their software as supplied, absolutely. If you use it with another piece of software locally it is usually the case that you're trusting a remote party, but there's the possibility of setting it up in such a way that it does not. For example, Electrum, but only when connected to [Personal Electrum Server](https://github.com/chris-belcher/electrum-personal-server), which runs locally as a middle man between a Bitcoin node you operate and Electrum.

> **Comments:**
> **username_0**: https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/getbalance/  
> **username_0**: You're wrong, but fair enough. In that case how do I get all the outputs to a certain address?  
> **username_1**: `getbalance` is a wallet RPC. It only shows information about the current local wallet, you can not use it for anything that isn't stored in a wallet file on the Bitcoin node itself. Why ask questions on stackexchange if you're simply refusing to believe the information given to you by an expert?  
> **username_2**: The RPC interface is also not exposed to the internet; it's only designed for letting the node's operator query it. The network itself uses a P2P protocol, which has no concept of wallets or addresses at all.  
> **username_0**: Fair enough, right. Why would a miner want to provide wallet services... Okay, so how would I do this? I want to get a balance from the network without running a node...  
> **username_2**: Then you'll need some service that provides that information to you, and you'll have to trust them. There are plenty of sites that do this (block explorers, and others), but if you're relying on this information for anything important, I'd strongly recommend against this approach.  
> **username_0**: So SPV wallets are not possible on BTC anymore?  
> **username_1**: SPV is a description of how data is verified, it has absolutely nothing to do with how you obtain that data.  
> **username_0**: "How old are you?" "I can't tell you, I can only verify that my age is 39". Bitcoiners are weird...  
> **username_1**: Letter sized paper is 8.5 x 11 inches. Why isn't this a description of where to buy it!?  
> **username_2**: @username_0 You could run a lightweight node that does SPV, though they can't verify completeness of the information they received (they can verify incoming transactions, and how much they pay you, but they can't guarantee that your peers didn't omit information). This has always been an issue for SPV.  

---

