<p><code>getreceivedbyaddress</code> is only able to show the balance for the addresses in the account: it stores only UTXO for these. The addresses generated with Pybitcointools are not stored in the account (contrary to addresses generated with <code>getnewaddress</code>).</p>

<p>To get the balance of any address, a block explorer is needed, which scan ALL UTXOs of the blockchain (like blockexporer.com or blockchain.info). </p>

<p>And for Regtest, it's more complicated since a local server is needed like <a href="https://github.com/bitcoin-abe/bitcoin-abe" rel="nofollow">https://github.com/bitcoin-abe/bitcoin-abe</a>.</p>

<p>Conclusion: I"ve finally switched to Testnet mode, for convenience.</p>

CC BY-SA 3.0
2016-01-09T07:43:20.897Z
2016-01-09T07:43:20.897Z
ThePhi
<p>By default, <code>getreceivedbyaddress</code> doesn't include unconfirmed transactions. The second parameter is for the minimum number of confirmations.</p>

<p>So either do <code>getreceivedbyaddress 0</code>, or do <code>setgenerate true 6</code>, and the received by should be correct.</p>

CC BY-SA 3.0
2016-01-09T07:36:13.387Z
It's not unconfirmed: you can see in listtransactions: ` "...confirmations" : 1,...`. But I finally solved the riddle. I didn't get properly what `getreceivedbyaddress` was doing in fact.
ThePhi
CC BY-SA 3.0
2016-01-09T14:07:15.570Z
Glad you figured it out :)
morsecoder
CC BY-SA 3.0
2016-01-06T18:42:49.560Z
2016-01-06T18:42:49.560Z
morsecoder
<p>I'm trying to send some btc to an address in Regtest mode:</p>

<p>the address where I want to send is: <code>mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H</code></p>

<pre><code>$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 sendtoaddress mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H 5.00
9caca4f88c6bf727f6e8599fc1012867561ff7ef34412ef1fc70457fadf08e0b
</code></pre>

<p>I generate a new block:</p>

<pre><code>$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 generate 1
[
    "5851b3adfd810480e53fbb5dab1ce4967a50f072a5a7abe054f114839ea3501e"
]
</code></pre>

<p>Then, I check the amount of btc inside the address:</p>

<pre><code>$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 getreceivedbyaddress mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H 
0.00000000
</code></pre>

<p>Nevertheless the transaction is well listed on listtransactions:</p>

<pre><code>$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 listtransactions
...
    {
        "account" : "",
        "address" : "mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H",
        "category" : "send",
        "amount" : -5.00000000,
        "vout" : 1,
        "fee" : -0.00001860,
        "confirmations" : 1,
        "blockhash" : "5851b3adfd810480e53fbb5dab1ce4967a50f072a5a7abe054f114839ea3501e",
        "blockindex" : 1,
        "blocktime" : 1452096896,
        "txid" : "9caca4f88c6bf727f6e8599fc1012867561ff7ef34412ef1fc70457fadf08e0b",
        "walletconflicts" : [
        ],
        "time" : 1452096887,
        "timereceived" : 1452096887
    },
...
</code></pre>

<p>Is there a problem with my address? </p>

<p>I've generated it thanks to <a href="https://github.com/vbuterin/pybitcointools/blob/master/bitcoin/main.py" rel="nofollow">pybitcointools</a> , doing:</p>

<pre><code>magickey = '111' # regtest mode

priv = random_key()

addr = privkey_to_address(priv, magickey)
</code></pre>

<p>Thanks a lot in advance</p>

<python><regtest>
Regtest: address is still at zero after sending some bitcoins
ThePhi
# Regtest: address is still at zero after sending some bitcoins

(Asked by: username_0 on 2016-01-06)

I'm trying to send some btc to an address in Regtest mode:

the address where I want to send is: `mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H`

```
$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 sendtoaddress mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H 5.00
9caca4f88c6bf727f6e8599fc1012867561ff7ef34412ef1fc70457fadf08e0b

```

I generate a new block:

```
$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 generate 1
[
    "5851b3adfd810480e53fbb5dab1ce4967a50f072a5a7abe054f114839ea3501e"
]

```

Then, I check the amount of btc inside the address:

```
$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 getreceivedbyaddress mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H 
0.00000000

```

Nevertheless the transaction is well listed on listtransactions:

```
$  bitcoin-cli -regtest -rpcuser=bitcoinrpc -rpcpassword=Alice -rpcport=16591 listtransactions
...
    {
        "account" : "",
        "address" : "mjeoXvBnD4DtZumeSJEjNJfLb4RrhpbH1H",
        "category" : "send",
        "amount" : -5.00000000,
        "vout" : 1,
        "fee" : -0.00001860,
        "confirmations" : 1,
        "blockhash" : "5851b3adfd810480e53fbb5dab1ce4967a50f072a5a7abe054f114839ea3501e",
        "blockindex" : 1,
        "blocktime" : 1452096896,
        "txid" : "9caca4f88c6bf727f6e8599fc1012867561ff7ef34412ef1fc70457fadf08e0b",
        "walletconflicts" : [
        ],
        "time" : 1452096887,
        "timereceived" : 1452096887
    },
...

```

Is there a problem with my address?

I've generated it thanks to [pybitcointools](https://github.com/vbuterin/pybitcointools/blob/master/bitcoin/main.py) , doing:

```
magickey = '111' # regtest mode

priv = random_key()

addr = privkey_to_address(priv, magickey)

```

Thanks a lot in advance

**Tags:** python, regtest


---

## 2 answers

### Answer by username_0 on 2016-01-09. Score: 1 | Accepted answer

`getreceivedbyaddress` is only able to show the balance for the addresses in the account: it stores only UTXO for these. The addresses generated with Pybitcointools are not stored in the account (contrary to addresses generated with `getnewaddress`).

To get the balance of any address, a block explorer is needed, which scan ALL UTXOs of the blockchain (like blockexporer.com or blockchain.info).

And for Regtest, it's more complicated since a local server is needed like <https://github.com/bitcoin-abe/bitcoin-abe>.

Conclusion: I"ve finally switched to Testnet mode, for convenience.


---

### Answer by username_1 on 2016-01-06. Score: 0

By default, `getreceivedbyaddress` doesn't include unconfirmed transactions. The second parameter is for the minimum number of confirmations.

So either do `getreceivedbyaddress 0`, or do `setgenerate true 6`, and the received by should be correct.

> **Comments:**
> **username_0**: It's not unconfirmed: you can see in listtransactions: ` "...confirmations" : 1,...`. But I finally solved the riddle. I didn't get properly what `getreceivedbyaddress` was doing in fact.  
> **username_1**: Glad you figured it out :)  

---

