mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
Update 3_1_Verifying_Your_Bitcoin-CLI_Setup.md
This commit is contained in:
parent
e7ad2d57c3
commit
ceb2910402
@ -205,59 +205,7 @@ Result:
|
|||||||
"networkhashps": nnn, (numeric) The network hashes per second
|
"networkhashps": nnn, (numeric) The network hashes per second
|
||||||
"pooledtx": n (numeric) The size of the mempool
|
"pooledtx": n (numeric) The size of the mempool
|
||||||
"testnet": true|false (boolean) If using testnet or not
|
"testnet": true|false (boolean) If using testnet or not
|
||||||
"chain": "xxxx", (string) current network name as defined in BIP70 (main, test, regtest)
|
|
||||||
}
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
> bitcoin-cli getmininginfo
|
|
||||||
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
|
|
||||||
```
|
|
||||||
|
|
||||||
## Optional: Get More Info
|
|
||||||
|
|
||||||
A variety of commands will give oyu move info on your setup:
|
|
||||||
```
|
|
||||||
$ bitcoin-cli getblockchaininfo
|
|
||||||
$ bitcoin-cli getmininginfo
|
|
||||||
$ bitcoin-cli getnetworkinfo
|
|
||||||
$ bitcoin-cli getnettotals
|
|
||||||
$ bitcoin-cli getwalletinfo
|
|
||||||
```
|
|
||||||
Feel free to play with any of these, and use "bitcoin-cli help" if you want more information on what any of them do.
|
|
||||||
|
|
||||||
## Optional: Know Your Server Types
|
|
||||||
|
|
||||||
> **TESTNET vs MAINNET:** When you set up your node, you choose to create it as either a Mainnet, Testnet, or Regtest node. Though this document presumes a testnet setup, it's worth understanding how you might access and use the other setup types — even all on the same machine!
|
|
||||||
|
|
||||||
The type of setup is mainly controlled through the ~/.bitcoin/bitcoin.conf file. If you're running testnet, it probably contains this line:
|
|
||||||
```
|
|
||||||
testnet=1
|
|
||||||
```
|
|
||||||
While if you're running regtest, it probably contains this line:
|
|
||||||
```
|
|
||||||
regtest=1
|
|
||||||
```
|
|
||||||
However, if you want to run several different sorts of nodes simultaneously, you should leave the testnet (or regtest) flag out of your configuration file. You can then choose whether you're using the mainnet, the testnet, or your regtest every time you run bitcoind or bitcoin-cli.
|
|
||||||
|
|
||||||
Here's a set of aliases that would make that easier by creating a specific alias for starting and stopping the bitcoind, for going to the bitcoin directory, and for running bitcoin-cli, for each of the mainnet (which has no extra flags), the testnet (which is -testnet), or your regtest (which is -regtest).
|
|
||||||
```
|
|
||||||
alias bcstart="bitcoind -daemon"
|
|
||||||
alias btstart="bitcoind -testnet -daemon"
|
|
||||||
alias brstart="bitcoind -regtest -daemon"
|
|
||||||
|
|
||||||
alias bcstop="bitcoin-cli stop"
|
|
||||||
alias btstop="bitcoin-cli -testnet stop"
|
|
||||||
alias brstop="bitcoin-cli -regtest -stop"
|
|
||||||
|
|
||||||
alias bcdir="cd ~/.bitcoin/" #linux default bitcoin path
|
|
||||||
alias btdir="cd ~/.bitcoin/testnet" #linux default bitcoin testnet path
|
|
||||||
alias brdir="cd ~/.bitcoin/regtest" #linux default bitcoin regtest path
|
|
||||||
|
|
||||||
alias bc="bitcoin-cli"
|
|
||||||
alias bt="bitcoin-cli -testnet"
|
|
||||||
alias br="bitcoin-cli -regtest"
|
|
||||||
```
|
|
||||||
For even more complexity, you could have each of your 'start' aliases use the -conf flag to load configuration from a different file. This goes far beyond the scope of this tutorial, but we offer it as a starting point for when your explorations of Bitcoin reach the next level.
|
|
||||||
|
|
||||||
## Summary: Verifying Your bitcoin-cli Setup
|
## Summary: Verifying Your bitcoin-cli Setup
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user