mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-08 00:16:26 +00:00
Merge remote-tracking branch 'base/master'
This commit is contained in:
commit
315d7e2725
@ -65,7 +65,7 @@ A message (or more commonly, a hash of a message) can be signed with a private k
|
|||||||
|
|
||||||
### What Is a Hash Function?
|
### What Is a Hash Function?
|
||||||
|
|
||||||
A hash function is an algorithm frequently used with cryptograpy. It's a way to map a large, arbitrary amount of data to a small, fixed amount of data. Hash functions used in cryptography are one-way and collision-resistant, meaning that a hash can very reliably be linked to the original data, but the original data can not be regenerated from the hash. Hashes thus allow the transmission of small amounts of data to represent large amounts of data, which can be important for efficiency and storage requirements.
|
A hash function is an algorithm frequently used with cryptography. It's a way to map a large, arbitrary amount of data to a small, fixed amount of data. Hash functions used in cryptography are one-way and collision-resistant, meaning that a hash can very reliably be linked to the original data, but the original data can not be regenerated from the hash. Hashes thus allow the transmission of small amounts of data to represent large amounts of data, which can be important for efficiency and storage requirements.
|
||||||
|
|
||||||
### Public-Key Cryptography — In Short
|
### Public-Key Cryptography — In Short
|
||||||
|
|
||||||
|
@ -41,13 +41,13 @@ We also suggest that you choose a Debian 8 image when you're creating your machi
|
|||||||
|
|
||||||
Afterward, boot your VPS.
|
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:
|
> Following are suggestions for machine requirements:
|
||||||
>
|
>
|
||||||
> | Setup | Memory | Storage |
|
> | Setup | Memory | Storage |
|
||||||
> |-------|--------|---------|
|
> |-------|--------|---------|
|
||||||
> | Mainnet | 2-3G | 120G |
|
> | Mainnet | 2-3G | 170G |
|
||||||
> | Pruned Mainnet | 2-3G | ~5G |
|
> | Pruned Mainnet | 2-3G | ~5G |
|
||||||
> | Testnet | 2-3G | ~15G |
|
> | Testnet | 2-3G | ~15G |
|
||||||
> | Pruned Testnet | 2-3G | ~5G |
|
> | Pruned Testnet | 2-3G | ~5G |
|
||||||
@ -294,9 +294,9 @@ $ source ~/.bash_profile
|
|||||||
|
|
||||||
We suggest setting up two variables to make this installation more automatic.
|
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/'`
|
$ 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
|
$ 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.
|
> **TESTNET vs MAINNET:** An unpruned mainnet will take hours longer.
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ You will know the StackScripts are done when a BITCOIN-IS-READY file appears in
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ ls
|
$ 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
|
BITCOIN-IS-READY SHA256SUMS.asc
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# CURRENT BITCOIN RELEASE:
|
# CURRENT BITCOIN RELEASE:
|
||||||
# Change as necessary
|
# 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.
|
# Set the variable $IPADDR to the IP address the new Linode receives.
|
||||||
IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')
|
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
|
$ bitcoin-cli help
|
||||||
== Blockchain ==
|
== Blockchain ==
|
||||||
getbestblockhash
|
getbestblockhash
|
||||||
getblock "hash" ( verbose )
|
getblock "blockhash" ( verbosity )
|
||||||
getblockchaininfo
|
getblockchaininfo
|
||||||
getblockcount
|
getblockcount
|
||||||
getblockhash index
|
getblockhash height
|
||||||
getblockheader "hash" ( verbose )
|
getblockheader "hash" ( verbose )
|
||||||
getchaintips
|
getchaintips
|
||||||
|
getchaintxstats ( nblocks blockhash )
|
||||||
getdifficulty
|
getdifficulty
|
||||||
getmempoolancestors txid (verbose)
|
getmempoolancestors txid (verbose)
|
||||||
getmempooldescendants txid (verbose)
|
getmempooldescendants txid (verbose)
|
||||||
getmempoolentry txid
|
getmempoolentry txid
|
||||||
getmempoolinfo
|
getmempoolinfo
|
||||||
getrawmempool ( verbose )
|
getrawmempool ( verbose )
|
||||||
gettxout "txid" n ( includemempool )
|
gettxout "txid" n ( include_mempool )
|
||||||
gettxoutproof ["txid",...] ( blockhash )
|
gettxoutproof ["txid",...] ( blockhash )
|
||||||
gettxoutsetinfo
|
gettxoutsetinfo
|
||||||
verifychain ( checklevel numblocks )
|
preciousblock "blockhash"
|
||||||
|
pruneblockchain
|
||||||
|
verifychain ( checklevel nblocks )
|
||||||
verifytxoutproof "proof"
|
verifytxoutproof "proof"
|
||||||
|
|
||||||
== Control ==
|
== Control ==
|
||||||
getinfo
|
getinfo
|
||||||
|
getmemoryinfo ("mode")
|
||||||
help ( "command" )
|
help ( "command" )
|
||||||
stop
|
stop
|
||||||
|
uptime
|
||||||
|
|
||||||
== Generating ==
|
== Generating ==
|
||||||
generate numblocks ( maxtries )
|
generate nblocks ( maxtries )
|
||||||
generatetoaddress numblocks address (maxtries)
|
generatetoaddress nblocks address (maxtries)
|
||||||
|
|
||||||
== Mining ==
|
== Mining ==
|
||||||
getblocktemplate ( TemplateRequest )
|
getblocktemplate ( TemplateRequest )
|
||||||
getmininginfo
|
getmininginfo
|
||||||
getnetworkhashps ( blocks height )
|
getnetworkhashps ( nblocks height )
|
||||||
prioritisetransaction <txid> <priority delta> <fee delta>
|
prioritisetransaction <txid> <dummy value> <fee delta>
|
||||||
submitblock "hexdata" ( "jsonparametersobject" )
|
submitblock "hexdata" ( "dummy" )
|
||||||
|
|
||||||
== Network ==
|
== Network ==
|
||||||
addnode "node" "add|remove|onetry"
|
addnode "node" "add|remove|onetry"
|
||||||
clearbanned
|
clearbanned
|
||||||
disconnectnode "node"
|
disconnectnode "[address]" [nodeid]
|
||||||
getaddednodeinfo dummy ( "node" )
|
getaddednodeinfo ( "node" )
|
||||||
getconnectioncount
|
getconnectioncount
|
||||||
getnettotals
|
getnettotals
|
||||||
getnetworkinfo
|
getnetworkinfo
|
||||||
getpeerinfo
|
getpeerinfo
|
||||||
listbanned
|
listbanned
|
||||||
ping
|
ping
|
||||||
setban "ip(/netmask)" "add|remove" (bantime) (absolute)
|
setban "subnet" "add|remove" (bantime) (absolute)
|
||||||
|
setnetworkactive true|false
|
||||||
|
|
||||||
== Rawtransactions ==
|
== 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"
|
decoderawtransaction "hexstring"
|
||||||
decodescript "hex"
|
decodescript "hexstring"
|
||||||
fundrawtransaction "hexstring" ( options )
|
fundrawtransaction "hexstring" ( options )
|
||||||
getrawtransaction "txid" ( verbose )
|
getrawtransaction "txid" ( verbose )
|
||||||
sendrawtransaction "hexstring" ( allowhighfees )
|
sendrawtransaction "hexstring" ( allowhighfees )
|
||||||
@ -91,55 +98,57 @@ signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","re
|
|||||||
== Util ==
|
== Util ==
|
||||||
createmultisig nrequired ["key",...]
|
createmultisig nrequired ["key",...]
|
||||||
estimatefee nblocks
|
estimatefee nblocks
|
||||||
estimatepriority nblocks
|
estimatesmartfee conf_target ("estimate_mode")
|
||||||
estimatesmartfee nblocks
|
|
||||||
estimatesmartpriority nblocks
|
|
||||||
signmessagewithprivkey "privkey" "message"
|
signmessagewithprivkey "privkey" "message"
|
||||||
validateaddress "bitcoinaddress"
|
validateaddress "address"
|
||||||
verifymessage "bitcoinaddress" "signature" "message"
|
verifymessage "address" "signature" "message"
|
||||||
|
|
||||||
== Wallet ==
|
== Wallet ==
|
||||||
abandontransaction "txid"
|
abandontransaction "txid"
|
||||||
|
abortrescan
|
||||||
addmultisigaddress nrequired ["key",...] ( "account" )
|
addmultisigaddress nrequired ["key",...] ( "account" )
|
||||||
addwitnessaddress "address"
|
addwitnessaddress "address"
|
||||||
backupwallet "destination"
|
backupwallet "destination"
|
||||||
dumpprivkey "bitcoinaddress"
|
bumpfee "txid" ( options )
|
||||||
|
dumpprivkey "address"
|
||||||
dumpwallet "filename"
|
dumpwallet "filename"
|
||||||
encryptwallet "passphrase"
|
encryptwallet "passphrase"
|
||||||
getaccount "bitcoinaddress"
|
getaccount "address"
|
||||||
getaccountaddress "account"
|
getaccountaddress "account"
|
||||||
getaddressesbyaccount "account"
|
getaddressesbyaccount "account"
|
||||||
getbalance ( "account" minconf includeWatchonly )
|
getbalance ( "account" minconf include_watchonly )
|
||||||
getnewaddress ( "account" )
|
getnewaddress ( "account" )
|
||||||
getrawchangeaddress
|
getrawchangeaddress
|
||||||
getreceivedbyaccount "account" ( minconf )
|
getreceivedbyaccount "account" ( minconf )
|
||||||
getreceivedbyaddress "bitcoinaddress" ( minconf )
|
getreceivedbyaddress "address" ( minconf )
|
||||||
gettransaction "txid" ( includeWatchonly )
|
gettransaction "txid" ( include_watchonly )
|
||||||
getunconfirmedbalance
|
getunconfirmedbalance
|
||||||
getwalletinfo
|
getwalletinfo
|
||||||
importaddress "address" ( "label" rescan p2sh )
|
importaddress "address" ( "label" rescan p2sh )
|
||||||
importprivkey "bitcoinprivkey" ( "label" rescan )
|
importmulti "requests" ( "options" )
|
||||||
|
importprivkey "privkey" ( "label" ) ( rescan )
|
||||||
importprunedfunds
|
importprunedfunds
|
||||||
importpubkey "pubkey" ( "label" rescan )
|
importpubkey "pubkey" ( "label" rescan )
|
||||||
importwallet "filename"
|
importwallet "filename"
|
||||||
keypoolrefill ( newsize )
|
keypoolrefill ( newsize )
|
||||||
listaccounts ( minconf includeWatchonly)
|
listaccounts ( minconf include_watchonly)
|
||||||
listaddressgroupings
|
listaddressgroupings
|
||||||
listlockunspent
|
listlockunspent
|
||||||
listreceivedbyaccount ( minconf includeempty includeWatchonly)
|
listreceivedbyaccount ( minconf include_empty include_watchonly)
|
||||||
listreceivedbyaddress ( minconf includeempty includeWatchonly)
|
listreceivedbyaddress ( minconf include_empty include_watchonly)
|
||||||
listsinceblock ( "blockhash" target-confirmations includeWatchonly)
|
listsinceblock ( "blockhash" target_confirmations include_watchonly include_removed )
|
||||||
listtransactions ( "account" count from includeWatchonly)
|
listtransactions ( "account" count skip include_watchonly)
|
||||||
listunspent ( minconf maxconf ["address",...] )
|
listunspent ( minconf maxconf ["addresses",...] [include_unsafe] [query_options])
|
||||||
|
listwallets
|
||||||
lockunspent unlock ([{"txid":"txid","vout":n},...])
|
lockunspent unlock ([{"txid":"txid","vout":n},...])
|
||||||
move "fromaccount" "toaccount" amount ( minconf "comment" )
|
move "fromaccount" "toaccount" amount ( minconf "comment" )
|
||||||
removeprunedfunds "txid"
|
removeprunedfunds "txid"
|
||||||
sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf "comment" "comment-to" )
|
sendfrom "fromaccount" "toaddress" amount ( minconf "comment" "comment_to" )
|
||||||
sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] )
|
sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode")
|
||||||
sendtoaddress "bitcoinaddress" amount ( "comment" "comment-to" subtractfeefromamount )
|
sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount replaceable conf_target "estimate_mode")
|
||||||
setaccount "bitcoinaddress" "account"
|
setaccount "address" "account"
|
||||||
settxfee amount
|
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:
|
You can also type `bitcoin help [command]` to get even more extensive info on that command. For example:
|
||||||
```
|
```
|
||||||
@ -181,8 +190,8 @@ For example `bitcoin-cli getnetworkinfo` gives you a variety of information on y
|
|||||||
```
|
```
|
||||||
$ bitcoin-cli getnetworkinfo
|
$ bitcoin-cli getnetworkinfo
|
||||||
{
|
{
|
||||||
"version": 140000,
|
"version": 150100,
|
||||||
"subversion": "/Satoshi:0.14.0/",
|
"subversion": "/Satoshi:0.15.1/",
|
||||||
"protocolversion": 70015,
|
"protocolversion": 70015,
|
||||||
"localservices": "000000000000000d",
|
"localservices": "000000000000000d",
|
||||||
"localrelay": false,
|
"localrelay": false,
|
||||||
@ -232,4 +241,3 @@ The ~/.bitcoin directory contains all of your files, while `bitcoin-cli help` an
|
|||||||
## What's Next?
|
## What's Next?
|
||||||
|
|
||||||
Continue "Understanding Your Bitcoin Setup" with [§3.3: Setting Up Your Wallet](03_3_Setting_Up_Your_Wallet.md).
|
Continue "Understanding Your Bitcoin Setup" with [§3.3: Setting Up Your Wallet](03_3_Setting_Up_Your_Wallet.md).
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ You can also use it to look at individual transactions:
|
|||||||
|
|
||||||
A block explorer doesn't generally provide any more information than a command line look at a raw transaction; it just does a good job of highlighting the important information and putting together the puzzle pieces, including the transaction fees behind a transaction — another concept that we'll be covering in future sections.
|
A block explorer doesn't generally provide any more information than a command line look at a raw transaction; it just does a good job of highlighting the important information and putting together the puzzle pieces, including the transaction fees behind a transaction — another concept that we'll be covering in future sections.
|
||||||
|
|
||||||
## Summary: Receiving a Transactions
|
## Summary: Receiving a Transaction
|
||||||
|
|
||||||
Faucets will give you money on the testnet. They come in as raw transactions, which can be examined with `getrawtransaction` or a block explorer. Once you've receive a transaction, you can see it in your balance and your wallet.
|
Faucets will give you money on the testnet. They come in as raw transactions, which can be examined with `getrawtransaction` or a block explorer. Once you've receive a transaction, you can see it in your balance and your wallet.
|
||||||
|
|
||||||
|
@ -21,15 +21,14 @@ sudo apt-get install mocha -g
|
|||||||
```
|
```
|
||||||
### Set Up BCRPC
|
### Set Up BCRPC
|
||||||
|
|
||||||
You should next download BCRPC from the [BCRPC Repository](https://github.com/dgarage/bcrpc). Clone it or download it, as you prefer.
|
Create a new node.js project and install BCRPC via NPM.
|
||||||
|
|
||||||
Once you've done that, you can finish setting it up:
|
|
||||||
```
|
```
|
||||||
$ unzip bcrpc-master.zip
|
$ mkdir myproject
|
||||||
$ cd bcrpc-master
|
$ cd myproject
|
||||||
$ npm install
|
$ npm init
|
||||||
|
[...]
|
||||||
|
$ npm install --save bcrpc
|
||||||
```
|
```
|
||||||
|
|
||||||
### Test BCRPC
|
### Test BCRPC
|
||||||
|
|
||||||
To test the BCRPC package, you must first set environmental variables for your rpcuser and rpcpassword. As noted in [§12.1: Accessing Bitcoind with Curl](12_1_Accessing_Bitcoind_with_Curl.md), these come from `~/.bitcoin/bitcoin.conf`.
|
To test the BCRPC package, you must first set environmental variables for your rpcuser and rpcpassword. As noted in [§12.1: Accessing Bitcoind with Curl](12_1_Accessing_Bitcoind_with_Curl.md), these come from `~/.bitcoin/bitcoin.conf`.
|
||||||
|
@ -17,7 +17,7 @@ Unless otherwise noted, the contents of this repository are Copyright ©2017 by
|
|||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
The best way to learn to learn deeply about bitcoin is to avoid GUIs (even bitcoin-qt), and instead learn it from the command line.
|
The best way to learn deeply about bitcoin is to avoid GUIs (even bitcoin-qt), and instead learn it from the command line.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user