Experimenting further with bitcoin-cli
As we've seen so far, bitcoin-cli is a powerful and feature-rich command-line interface available with the Bitcoin Core client and can be used to perform various functions using the RPC interface provided by the Bitcoin Core client.
We will now see how to send Bitcoin to an address using the command line. For this, we will use the Bitcoin command-line interface on the Bitcoin regtest:
- Generate a new address using the following command:
$ bitcoin-cli -regtest getnewaddress
2NC31WFFRwRkwd3S4TpyjN5GGDY7E63GSVd
- Send 20 BTC to the newly generated address:
$ bitcoin-cli -regtest sendtoaddress \ 2NC31WFFRwRkwd3S4TpyjN5GGDY7E63GSVd 20.00
- The output of this command will show the transaction ID, which is:
a83ff460a32f29387d531f19e7092a5dcf6ce52d20931227447c0b9b7a5f2980
- We can now generate a few more blocks to get some confirmation for this:
$ bitcoin-cli -regtest generatetoaddress 7 $(bitcoin-cli -regtest getnewaddress)
- We can also query...