0

It's seems like this question, but it's no clear show. I have followed this step by step, and after finish last step which generate a block to confirm the transaction, I couldn't see my second address have add money (bitcoin). Anyone who encountered such problem?

My bitcoin.conf

[frank@localhost bin]$ cat ~/.bitcoin/bitcoin.conf 
rpcpassword=this_is_a_password_for_api_call

Run my bitcoind like

[frank@localhost bin]$ ./bitcoind -regtest -daemon
Bitcoin server starting

Run my bitcoin-cli as

[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
0.00000000

[frank@localhost bin]$ ./bitcoin-cli -regtest generate 101
[
  "7b611f41281c882c7b786c74e01b70e990c102aefb5fc28ee12c1d5b90156fb3",
  "505699b3bcb9faa394cb3533ed970ca48195643e1a034fc8fe64a34e019e12cd",
  "3845286183586d91f3b6a64aa5fb7f741378747b82ed781bc32e2a9d79ac22af",
  "342c881a888de56524368fc04735edfbb23ab1767717df8f9c68218a57b852ee",
....]
[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
50.00000000

You can see what I've done at above, everything so far so good. When I try to do the following thing, I meet some trouble.

[frank@localhost bin]$ ./bitcoin-cli -regtest getnewaddress
2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV

[frank@localhost bin]$ ./bitcoin-cli -regtest sendtoaddress 2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV 10
89d08e5517a8f40cfca50b0323c835056c166255d8430897affa6c1cde797b18

For now, I will list all transactions to you:

[frank@localhost bin]$ ./bitcoin-cli -regtest listunspent 0
[
  {
    "txid": "89d08e5517a8f40cfca50b0323c835056c166255d8430897affa6c1cde797b18",
    "vout": 0,
    "address": "2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV",
    "account": "",
    "redeemScript": "0014b24df37ce7d779a84b06b35517fae3c8229daa3c",
    "scriptPubKey": "a914910f020cef414bcafc49ab1236c82be6367045f287",
    "amount": 10.00000000,
    "confirmations": 0,
    "spendable": true,
    "solvable": true,
    "safe": true
  },
  {
    "txid": "89d08e5517a8f40cfca50b0323c835056c166255d8430897affa6c1cde797b18",
    "vout": 1,
    "address": "2NDjzxeozTK8uZ567tCBvCY9aqCL5wKL4rs",
    "redeemScript": "00143a1c7678f95db28e17c47ab32e9a7e8be5b5150a",
    "scriptPubKey": "a914e0d3b4074fdb1a3defd5ca0e660d3c656b0b054087",
    "amount": 39.99996240,
    "confirmations": 0,
    "spendable": true,
    "solvable": true,
    "safe": true
  }
]

You can see the transaction's confirmations is 0, it's mean no confirmed. so last step I will generate a block to confirm it. but before confirm I simply check both account's balance.

[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
49.99996240
[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance 2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV
0.00000000

And we absolute sure the transaction is submit, so go on.

[frank@localhost bin]$ ./bitcoin-cli -regtest generate 1
[
  "0636e8cba682cc382833923e23028664e49ade44764cdf81b375b59675b84e7e"
]

Okay, We have generate a new block and it's also successful. How about the balance? let check it.

[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance 2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV
0.00000000
[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
99.99996240

Sadly, I got nothing in the dest account, but the origin account has increment the balance .So my question is how it's going ?

  • Check to see if the newly generated address is same as the current address - ./bitcoin-cli -regtest getaccountaddress "" – Abhishek Sinha Jul 16 '18 at 13:23
1

I think it did work, but the getbalance function does not work as you expect. The ./bitcoin-cli -regtest help getbalance reveals that getbalance returns

"The available balance is what the wallet considers currently spendable."

The address you generated with ./bitcoin-cli -regtest getnewaddress is probably just a script that routes the funds back into your main account, so it's address is different, but can be spent using the private key in the main account. You can verify this by ./bitcoin-cli -regtest listaccounts and seeing if it returns something like:

{
  "": 10.00000000,
  ...
}

The "" account is the default account, and you can get it's address using: ./bitcoin-cli -regtest getaccountaddress "".

It might be more convenient to generate an address as a new bitcoind wallet account. Try using:

./bitcoin-cli -regtest getaccountaddress "<optional_name>"

Then send the coins to that address and check it's balance using ./bitcoin-cli -regtest listaccounts

  • Yes, As you said that I have a account with empty string name. So, How can I set a new account to the default account? Also I want to delete that one without name / – Frank AK Jul 17 '18 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.