mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
commit
1fff738b0d
@ -33,7 +33,7 @@ If your cloud provider offers two-factor authentication for their web tools, we
|
||||
|
||||
### Create a Machine
|
||||
|
||||
You should now create your Bitcoin VPS. For an Unpruned Testnet setup, you should have at least 2-3G of memory and at least 15G of storage.
|
||||
You should now create your Bitcoin VPS. For an Unpruned Testnet setup, you should have at least 2-3G of memory and at least 15G of storage.
|
||||
|
||||
> **WARNING:** We've occasionally had machines run out of memory after running `bitcoind` for a few days when they only had 2G. Coming back, we find that `bitcoind` has stopped, leaving the message "Error: Out of memory. Terminating." in the `debug.log` file. This simply requires a restart of `bitcoind` and ten or fifteen minutes to get the blockchain resynced. Be generous with your memory if you want to avoid this annoyance, but don't worry too much if you hit it.
|
||||
|
||||
@ -41,13 +41,13 @@ We also suggest that you choose a Debian 8 image when you're creating your machi
|
||||
|
||||
Afterward, boot your VPS.
|
||||
|
||||
> **TESTNET vs MAINNET:** The various possible setups require 5-15G of storage and 2-3G of memory. The non-Pruned Mainnet is the only setup that requires considerably more: about 120G of storage to hold the current blockchain.
|
||||
> **TESTNET vs MAINNET:** The various possible setups require 5-15G of storage and 2-3G of memory. The non-Pruned Mainnet is the only setup that requires considerably more: about 170G of storage to hold the current blockchain.
|
||||
>
|
||||
> Following are suggestions for machine requirements:
|
||||
>
|
||||
> | Setup | Memory | Storage |
|
||||
> |-------|--------|---------|
|
||||
> | Mainnet | 2-3G | 120G |
|
||||
> | Mainnet | 2-3G | 170G |
|
||||
> | Pruned Mainnet | 2-3G | ~5G |
|
||||
> | Testnet | 2-3G | ~15G |
|
||||
> | Pruned Testnet | 2-3G | ~5G |
|
||||
@ -61,7 +61,7 @@ You'll need to look up the IP address of your new machine, and then you should b
|
||||
$ ssh root@192.168.1.52
|
||||
```
|
||||
|
||||
Now, you'll need to do some bog-standard configuration, then some work to improve the security of your machine.
|
||||
Now, you'll need to do some bog-standard configuration, then some work to improve the security of your machine.
|
||||
|
||||
_If you already have your own techniques for setting up a machine, go ahead and follow them, then jump ahead to "Setting Up a User", then "Installing Bitcoin". Otherwise,continue on!_
|
||||
|
||||
@ -99,7 +99,7 @@ Though you're not putting much real value on this server, you should still make
|
||||
|
||||
### Create Firewall Rules
|
||||
|
||||
To start with, create a firewall rules file.
|
||||
To start with, create a firewall rules file.
|
||||
|
||||
_For all instructions that look like this, you should just be able to cut from the "cat" all the way down to the EOF, and everything will be placed into the appropriate file._
|
||||
```
|
||||
@ -245,7 +245,7 @@ Afterward give user1 access to the directory:
|
||||
$ chown -R user1 ~user1/.ssh
|
||||
```
|
||||
If you haven't set up an SSH key on your local computer yet, there are good instructions for it on [Github](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/).
|
||||
|
||||
|
||||
## Installing Bitcoin
|
||||
|
||||
You're now ready to get to the bitcoin-specific part of this tutorial!
|
||||
@ -283,7 +283,7 @@ $ /bin/chown user1 ~user1/.bash_profile
|
||||
|
||||
### Login as Your Unprivileged User
|
||||
|
||||
You now want to switch over to the user1 account for the actual install:
|
||||
You now want to switch over to the user1 account for the actual install:
|
||||
```
|
||||
$ su user1
|
||||
$ cd
|
||||
@ -294,9 +294,9 @@ $ source ~/.bash_profile
|
||||
|
||||
We suggest setting up two variables to make this installation more automatic.
|
||||
|
||||
The first variable, $BITCOIN, should be set to the current version of Bitcoin. It was 0.14.1 when we wrote this. The second will then automatically generate a truncated form used by some of the files.
|
||||
The first variable, $BITCOIN, should be set to the current version of Bitcoin. It was 0.15.1 when we wrote this. The second will then automatically generate a truncated form used by some of the files.
|
||||
```
|
||||
$ export BITCOIN=bitcoin-core-0.14.1
|
||||
$ export BITCOIN=bitcoin-core-0.15.1
|
||||
$ export BITCOINPLAIN=`echo $BITCOIN | sed 's/bitcoin-core/bitcoin/'`
|
||||
```
|
||||
|
||||
@ -390,7 +390,7 @@ But wait, your Bitcoin daemon is probably still downloading blocks. This alias,
|
||||
```
|
||||
$ btcblock
|
||||
```
|
||||
0.14.1 is quite fast to download blocks, but it might still take an hour to download the unpruned testnet. It might be time for a few more espressos.
|
||||
0.15.1 is quite fast to download blocks, but it might still take an hour to download the unpruned testnet. It might be time for a few more espressos.
|
||||
|
||||
> **TESTNET vs MAINNET:** An unpruned mainnet will take hours longer.
|
||||
|
||||
|
@ -102,7 +102,7 @@ _You can freely choose to enter this optional information or skip it:_
|
||||
|
||||
**SSH Key.** Copy your local computer's SSH key here; this allows you be able to automatically login in via SSH to your user1 account. If you haven't setup an SSH key on your local computer yet, there are good instructions for it on [Github](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/). You may also want to add your SSH key into your Linode LISH (Linode Interactive Shell) by going to your "Linode Home Page / My Preferences / LISH Settings / LISH Keys". Using an SSH key will give you a simpler and safer way to log in to your server.
|
||||
|
||||
**SSH-Allowed IPs.** This is a comma-separated list of IPs that will be allowed to SSH into the VPS. For example "192.168.1.15,192.168.1.16". If you do not enter any IPs, _your VPS will not be very secure_. It will constantly be bombarded by attackers trying to find their way in, and they may very well succeed.
|
||||
**SSH-Allowed IPs.** This is a comma-separated list of IPs that will be allowed to SSH into the VPS. For example "192.168.1.15,192.168.1.16". If you do not enter any IPs, _your VPS will not be very secure_. It will constantly be bombarded by attackers trying to find their way in, and they may very well succeed.
|
||||
|
||||
*The remaining questions all have to do with the mechanics of the VPS deployment and should be left as they are with one exception: bump the Swap Disk from 256MB to 512MB, to ensure that you have enough memory to download the blockchain._
|
||||
|
||||
@ -148,7 +148,7 @@ You will know the StackScripts are done when a BITCOIN-IS-READY file appears in
|
||||
|
||||
```
|
||||
$ ls
|
||||
bitcoin-0.14.1-x86_64-linux-gnu.tar.gz laanwj-releases.asc
|
||||
bitcoin-0.15.1-x86_64-linux-gnu.tar.gz laanwj-releases.asc
|
||||
BITCOIN-IS-READY SHA256SUMS.asc
|
||||
```
|
||||
|
||||
@ -266,7 +266,7 @@ Creating a Bitcoin-Core VPS with a StackScript made the whole process quick, sim
|
||||
You have a few options for what's next:
|
||||
|
||||
* Read the [StackScript](02_2__Script_Linode_Setup.stackscript) to understand your setup.
|
||||
* See the other method for setting up a VPS in [§2.1: Setting up a Bitcoin-Core VPS by Hand](02_1_Setting_Up_a_Bitcoin-Core_VPS_by_Hand.md).
|
||||
* See the other method for setting up a VPS in [§2.1: Setting up a Bitcoin-Core VPS by Hand](02_1_Setting_Up_a_Bitcoin-Core_VPS_by_Hand.md).
|
||||
* Move on to "bitcoin-cli" with [Chapter Three: Understanding Your Bitcoin Setup](03_0_Understanding_Your_Bitcoin_Setup.md).
|
||||
|
||||
## Appendix: Bitcoin Installation Types
|
||||
|
@ -23,7 +23,7 @@
|
||||
# CURRENT BITCOIN RELEASE:
|
||||
# Change as necessary
|
||||
|
||||
export BITCOIN=bitcoin-core-0.14.2
|
||||
export BITCOIN=bitcoin-core-0.15.1
|
||||
|
||||
# Set the variable $IPADDR to the IP address the new Linode receives.
|
||||
IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')
|
||||
|
@ -32,57 +32,64 @@ Most of your early work will be done with the `bitcoin-cli` command, which offer
|
||||
$ bitcoin-cli help
|
||||
== Blockchain ==
|
||||
getbestblockhash
|
||||
getblock "hash" ( verbose )
|
||||
getblock "blockhash" ( verbosity )
|
||||
getblockchaininfo
|
||||
getblockcount
|
||||
getblockhash index
|
||||
getblockhash height
|
||||
getblockheader "hash" ( verbose )
|
||||
getchaintips
|
||||
getchaintxstats ( nblocks blockhash )
|
||||
getdifficulty
|
||||
getmempoolancestors txid (verbose)
|
||||
getmempooldescendants txid (verbose)
|
||||
getmempoolentry txid
|
||||
getmempoolinfo
|
||||
getrawmempool ( verbose )
|
||||
gettxout "txid" n ( includemempool )
|
||||
gettxout "txid" n ( include_mempool )
|
||||
gettxoutproof ["txid",...] ( blockhash )
|
||||
gettxoutsetinfo
|
||||
verifychain ( checklevel numblocks )
|
||||
preciousblock "blockhash"
|
||||
pruneblockchain
|
||||
verifychain ( checklevel nblocks )
|
||||
verifytxoutproof "proof"
|
||||
|
||||
== Control ==
|
||||
getinfo
|
||||
getmemoryinfo ("mode")
|
||||
help ( "command" )
|
||||
stop
|
||||
uptime
|
||||
|
||||
== Generating ==
|
||||
generate numblocks ( maxtries )
|
||||
generatetoaddress numblocks address (maxtries)
|
||||
generate nblocks ( maxtries )
|
||||
generatetoaddress nblocks address (maxtries)
|
||||
|
||||
== Mining ==
|
||||
getblocktemplate ( TemplateRequest )
|
||||
getmininginfo
|
||||
getnetworkhashps ( blocks height )
|
||||
prioritisetransaction <txid> <priority delta> <fee delta>
|
||||
submitblock "hexdata" ( "jsonparametersobject" )
|
||||
getnetworkhashps ( nblocks height )
|
||||
prioritisetransaction <txid> <dummy value> <fee delta>
|
||||
submitblock "hexdata" ( "dummy" )
|
||||
|
||||
== Network ==
|
||||
addnode "node" "add|remove|onetry"
|
||||
clearbanned
|
||||
disconnectnode "node"
|
||||
getaddednodeinfo dummy ( "node" )
|
||||
disconnectnode "[address]" [nodeid]
|
||||
getaddednodeinfo ( "node" )
|
||||
getconnectioncount
|
||||
getnettotals
|
||||
getnetworkinfo
|
||||
getpeerinfo
|
||||
listbanned
|
||||
ping
|
||||
setban "ip(/netmask)" "add|remove" (bantime) (absolute)
|
||||
setban "subnet" "add|remove" (bantime) (absolute)
|
||||
setnetworkactive true|false
|
||||
|
||||
== Rawtransactions ==
|
||||
createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime )
|
||||
combinerawtransaction ["hexstring",...]
|
||||
createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime ) ( replaceable )
|
||||
decoderawtransaction "hexstring"
|
||||
decodescript "hex"
|
||||
decodescript "hexstring"
|
||||
fundrawtransaction "hexstring" ( options )
|
||||
getrawtransaction "txid" ( verbose )
|
||||
sendrawtransaction "hexstring" ( allowhighfees )
|
||||
@ -91,55 +98,57 @@ signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","re
|
||||
== Util ==
|
||||
createmultisig nrequired ["key",...]
|
||||
estimatefee nblocks
|
||||
estimatepriority nblocks
|
||||
estimatesmartfee nblocks
|
||||
estimatesmartpriority nblocks
|
||||
estimatesmartfee conf_target ("estimate_mode")
|
||||
signmessagewithprivkey "privkey" "message"
|
||||
validateaddress "bitcoinaddress"
|
||||
verifymessage "bitcoinaddress" "signature" "message"
|
||||
validateaddress "address"
|
||||
verifymessage "address" "signature" "message"
|
||||
|
||||
== Wallet ==
|
||||
abandontransaction "txid"
|
||||
abortrescan
|
||||
addmultisigaddress nrequired ["key",...] ( "account" )
|
||||
addwitnessaddress "address"
|
||||
backupwallet "destination"
|
||||
dumpprivkey "bitcoinaddress"
|
||||
bumpfee "txid" ( options )
|
||||
dumpprivkey "address"
|
||||
dumpwallet "filename"
|
||||
encryptwallet "passphrase"
|
||||
getaccount "bitcoinaddress"
|
||||
getaccount "address"
|
||||
getaccountaddress "account"
|
||||
getaddressesbyaccount "account"
|
||||
getbalance ( "account" minconf includeWatchonly )
|
||||
getbalance ( "account" minconf include_watchonly )
|
||||
getnewaddress ( "account" )
|
||||
getrawchangeaddress
|
||||
getreceivedbyaccount "account" ( minconf )
|
||||
getreceivedbyaddress "bitcoinaddress" ( minconf )
|
||||
gettransaction "txid" ( includeWatchonly )
|
||||
getreceivedbyaddress "address" ( minconf )
|
||||
gettransaction "txid" ( include_watchonly )
|
||||
getunconfirmedbalance
|
||||
getwalletinfo
|
||||
importaddress "address" ( "label" rescan p2sh )
|
||||
importprivkey "bitcoinprivkey" ( "label" rescan )
|
||||
importmulti "requests" ( "options" )
|
||||
importprivkey "privkey" ( "label" ) ( rescan )
|
||||
importprunedfunds
|
||||
importpubkey "pubkey" ( "label" rescan )
|
||||
importwallet "filename"
|
||||
keypoolrefill ( newsize )
|
||||
listaccounts ( minconf includeWatchonly)
|
||||
listaccounts ( minconf include_watchonly)
|
||||
listaddressgroupings
|
||||
listlockunspent
|
||||
listreceivedbyaccount ( minconf includeempty includeWatchonly)
|
||||
listreceivedbyaddress ( minconf includeempty includeWatchonly)
|
||||
listsinceblock ( "blockhash" target-confirmations includeWatchonly)
|
||||
listtransactions ( "account" count from includeWatchonly)
|
||||
listunspent ( minconf maxconf ["address",...] )
|
||||
listreceivedbyaccount ( minconf include_empty include_watchonly)
|
||||
listreceivedbyaddress ( minconf include_empty include_watchonly)
|
||||
listsinceblock ( "blockhash" target_confirmations include_watchonly include_removed )
|
||||
listtransactions ( "account" count skip include_watchonly)
|
||||
listunspent ( minconf maxconf ["addresses",...] [include_unsafe] [query_options])
|
||||
listwallets
|
||||
lockunspent unlock ([{"txid":"txid","vout":n},...])
|
||||
move "fromaccount" "toaccount" amount ( minconf "comment" )
|
||||
removeprunedfunds "txid"
|
||||
sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf "comment" "comment-to" )
|
||||
sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] )
|
||||
sendtoaddress "bitcoinaddress" amount ( "comment" "comment-to" subtractfeefromamount )
|
||||
setaccount "bitcoinaddress" "account"
|
||||
sendfrom "fromaccount" "toaddress" amount ( minconf "comment" "comment_to" )
|
||||
sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode")
|
||||
sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount replaceable conf_target "estimate_mode")
|
||||
setaccount "address" "account"
|
||||
settxfee amount
|
||||
signmessage "bitcoinaddress" "message"
|
||||
signmessage "address" "message"
|
||||
```
|
||||
You can also type `bitcoin help [command]` to get even more extensive info on that command. For example:
|
||||
```
|
||||
@ -162,7 +171,7 @@ Result:
|
||||
}
|
||||
|
||||
Examples:
|
||||
> bitcoin-cli getmininginfo
|
||||
> 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/
|
||||
```
|
||||
_What is RPC?_ `bitcoin-cli` is just a handy interface that lets you send commands to the `bitcoind`. More specifically, it's an interface that lets you send RPC (or Remote Procedure Protocol) commands to the `bitcoind`. Often, the `bitcoin-cli` command and the RPC command have identical names and interfaces, but some `bitcoin-cli` commands instead provide shortcuts for more complex RPC requests. Generally, the `bitcoin-cli` interface is much cleaner and simpler than trying to send RPC commands by hand, using `curl` or some other method. However, it also has limitations as to what you can ultimately do.
|
||||
@ -181,8 +190,8 @@ For example `bitcoin-cli getnetworkinfo` gives you a variety of information on y
|
||||
```
|
||||
$ bitcoin-cli getnetworkinfo
|
||||
{
|
||||
"version": 140000,
|
||||
"subversion": "/Satoshi:0.14.0/",
|
||||
"version": 150100,
|
||||
"subversion": "/Satoshi:0.15.1/",
|
||||
"protocolversion": 70015,
|
||||
"localservices": "000000000000000d",
|
||||
"localrelay": false,
|
||||
@ -196,14 +205,14 @@ $ bitcoin-cli getnetworkinfo
|
||||
"reachable": true,
|
||||
"proxy": "",
|
||||
"proxy_randomize_credentials": false
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "ipv6",
|
||||
"limited": false,
|
||||
"reachable": true,
|
||||
"proxy": "",
|
||||
"proxy_randomize_credentials": false
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "onion",
|
||||
"limited": true,
|
||||
@ -232,4 +241,3 @@ The ~/.bitcoin directory contains all of your files, while `bitcoin-cli help` an
|
||||
## What's Next?
|
||||
|
||||
Continue "Understanding Your Bitcoin Setup" with [§3.3: Setting Up Your Wallet](03_3_Setting_Up_Your_Wallet.md).
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user