<p>You'll want to use <code>getnewaddress</code>. Here is the output of <code>bitcoin-cli help getnewaddress</code> from <code>Satoshi:0.17.0.1</code>: </p>

<pre><code>bitcoin-cli getnewaddress( "label" "address_type" )

Returns a new Bitcoin address for receiving payments.
If 'label' is specified, it is added to the address book 
so payments received with the address will be associated with 'label'.

Arguments:
1. "label"          (string, optional) The label name for the address to be linked to. If not provided, the default label "" is used. It can also be set to the empty string "" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.
2. "address_type"   (string, optional) The address type to use. Options are "legacy", "p2sh-segwit", and "bech32". Default is set by -addresstype.

Result:
"address"    (string) The new bitcoin address

Examples: 
   &gt; bitcoin-cli getnewaddress  
   &gt; curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
</code></pre>

CC BY-SA 4.0
2019-02-15T09:01:15.740Z
Once I get the new address funded, how will spend those coins. I am guessing, I'll have to get the private key using `dumpprivkey` rpc command.
Deb
CC BY-SA 4.0
2019-02-15T09:14:04.057Z
@Deb no, you do not need to handle the raw private keys. You will use `sendtoaddress`, or perhaps `createrawtransaction` etc. You can use `bitcoin-cli help` to see a list of commands available.
chytrik
CC BY-SA 4.0
2019-02-15T09:14:21.900Z
I got the private key using `dumpprivkey` however when I tried to get the balance using the command `bitcoin-cli -testnet getbalance ["*", "<address>"]` it returns and error saying cannot parse <address>. What is correct method of getting balance. And also when I tried `bitcoin-cli -testnet getbalance` it returns 0.0000, even though I got the new address funded from a faucet. If that is the case, how can I do a transaction using the newly generated address as the sender.
Deb
CC BY-SA 4.0
2019-02-15T09:16:39.207Z
Basically, how do I set the newly generated address as the sender's address?
Deb
CC BY-SA 4.0
2019-02-15T09:24:09.793Z
@Deb First you need to have received coins to an address, then you can spend them. You do not need to specify an address (you can just use `sendtoaddress`, and your wallet will select the UTXOs to spend for you), but if you want finer control you can use `createrawtransaction` to build a transaction using specified UTXOs. Then use `signrawtransaction` and `sendrawtransaction` to broadcast it to the network.
chytrik
CC BY-SA 4.0
2019-02-15T08:01:22.837Z
2019-02-15T08:01:22.837Z
chytrik
<p>I have bitcoin-core installed, I am running it in testnet mode. Now if I want to fund my wallet, I need to know the receiving address. How do find my receiving address, so that I can fund it and then complete a transaction.
I am using bitcoin-cli -testnet , what is best way to fund my own wallet so that I can send some coins to another address?</p>

<transactions><testnet><bitcoin-cli><receiving>
How find own address in testnet using bitcoin-cli?
Deb
# How find own address in testnet using bitcoin-cli?

(Asked by: username_0 on 2019-02-15)

I have bitcoin-core installed, I am running it in testnet mode. Now if I want to fund my wallet, I need to know the receiving address. How do find my receiving address, so that I can fund it and then complete a transaction.
I am using bitcoin-cli -testnet , what is best way to fund my own wallet so that I can send some coins to another address?

**Tags:** transactions, testnet, bitcoin-cli, receiving


---

## 1 answers

### Answer by username_1 on 2019-02-15. Score: 1

You'll want to use `getnewaddress`. Here is the output of `bitcoin-cli help getnewaddress` from `Satoshi:0.17.0.1`:

```
bitcoin-cli getnewaddress( "label" "address_type" )

Returns a new Bitcoin address for receiving payments.
If 'label' is specified, it is added to the address book 
so payments received with the address will be associated with 'label'.

Arguments:
1. "label"          (string, optional) The label name for the address to be linked to. If not provided, the default label "" is used. It can also be set to the empty string "" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.
2. "address_type"   (string, optional) The address type to use. Options are "legacy", "p2sh-segwit", and "bech32". Default is set by -addresstype.

Result:
"address"    (string) The new bitcoin address

Examples: 
   > bitcoin-cli getnewaddress  
   > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

```

> **Comments:**
> **username_0**: Once I get the new address funded, how will spend those coins. I am guessing, I'll have to get the private key using `dumpprivkey` rpc command.  
> **username_1**: @username_0 no, you do not need to handle the raw private keys. You will use `sendtoaddress`, or perhaps `createrawtransaction` etc. You can use `bitcoin-cli help` to see a list of commands available.  
> **username_0**: I got the private key using `dumpprivkey` however when I tried to get the balance using the command `bitcoin-cli -testnet getbalance ["*", "<address>"]` it returns and error saying cannot parse <address>. What is correct method of getting balance. And also when I tried `bitcoin-cli -testnet getbalance` it returns 0.0000, even though I got the new address funded from a faucet. If that is the case, how can I do a transaction using the newly generated address as the sender.  
> **username_0**: Basically, how do I set the newly generated address as the sender's address?  
> **username_1**: @username_0 First you need to have received coins to an address, then you can spend them. You do not need to specify an address (you can just use `sendtoaddress`, and your wallet will select the UTXOs to spend for you), but if you want finer control you can use `createrawtransaction` to build a transaction using specified UTXOs. Then use `signrawtransaction` and `sendrawtransaction` to broadcast it to the network.  

---

