0

Please explain to me what should be the procedure for working with a bitcoin-cli / RPC wallet.

For example:

  1. Create a wallet
  2. Get a new address
  3. Sending BTC: creating a transaction, signing a transaction, sending a transaction or some else?

Creating a wallet
--------------------

Everything is more or less clear here, we use:

curl --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "createwallet", "params": {"wallet_name":"WalletName", "avoid_reuse":true , "descriptors":true, "load_on_startup":true}}' -H 'content-type: text/plain;' http://127.0.0.1:8332/

or

bitcoin-cli -named createwallet wallet_name=descriptors avoid_reuse=true descriptors=true load_on_startup=true

Getting a new address
------------------------

Here we use getnewaddress, and the questions begin: if we use deriveaddresses, then we get several addresses. What do these addresses refer to, how many of them can I receive?

From the documentation:

Arguments:
1. descriptor (string, required) The descriptor.
2. range (numeric or array, optional) If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive.

What is end equal to? How can I find out?


Sending BTC
--------------

There are several ways:

  • send
  • sendtoaddress

I received the transaction Id, what should I do after that? Use createrawtransaction, then signrawtransactionwithwallet, and then sendrawtransaction? Or something else?

Thank you.

1 Answer 1

1

1. Creating a new wallet

$ bitcoin-cli createwallet "my-wallet"

2. Get new Address

Generate a new address from the wallet which you can share and use to receive coins

bitcoin-cli -rpcwallet="my-wallet" getnewaddress

3. Sending Money

(After loading money to the wallet) Send money from my-wallet to bitcoin address "tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx"

bitcoin-cli -rpcwallet="my-wallet" sendtoaddress "tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx" 0.01

More information on using and managing the wallet can be found on https://github.com/bitcoin/bitcoin/blob/master/doc/managing-wallets.md

6
  • Thanks, @brandon-odiwuor. >> Generate a new address from the wallet which you can share and use to receive coins But what about anothers addresses whic I get from deriveaddresses? >> (After loading money to the wallet) Send money from my-wallet to bitcoin address "tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx" What is this address? Why I can't use another? >> More information on using and managing the wallet can be found on https://github.com/bitcoin/bitcoin/blob/master/doc/managing-wallets.md Thanks. But there is so Jan 23 at 15:05
  • The getnewaddress RPC is generally used to get a new address while the deriveaddress RPC is used more specifically to derive addresses corresponding to an output descriptor Jan 23 at 17:52
  • > bitcoin-cli deriveaddresses "descriptor" ( range ) Jan 23 at 17:52
  • >> The getnewaddress RPC is generally used to get a new address while the deriveaddress RPC is used more specifically to derive addresses corresponding to an output descriptor What it's mean? Should I use it? Or not? Jan 23 at 19:06
  • You should use the getnewaddress RPC to generate a new address to use from the wallet Jan 23 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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