Playing with Bitcoin at this stage is considered "buying at a high price," but it doesn't prevent us from understanding it. We don't aim to make money, just to satisfy our curiosity.
So how do we play? First, we need a wallet. Previously, there were various trading platforms in China that didn't require us to install a wallet to trade. But now, most of them have been shut down, and it doesn't feel good to have our wallet in someone else's hands.
So why should we install the wallet in a Linux system? Because the Bitcoin wallet is large. How large? We'll talk about it below. And it needs to synchronize with the network nodes. When running the wallet for the first time, it needs to connect to the internet to synchronize data. The specific time depends on your computer's performance.
Using my cloud server with 4 cores, 4GB RAM, and 5MB bandwidth as an example: It took about two days to complete the data synchronization. If you install it on your Windows 10, your computer will need to be on for two days and two nights, and synchronizing the nodes will consume CPU resources. During these two days, your computer won't be very responsive, and most importantly, it will occupy your valuable hard disk space.
Without further ado, let's start teaching everyone how to install the wallet:
Personal opinion: I think Bitcoin, Ethereum, Monero, and other cryptocurrencies are too complicated. I advise beginners not to play with them. However, their blockchain technology is likely to be the future of the internet, at least a part of it.
Installing the Bitcoin Wallet (v0.21.0)#
Installing the Bitcoin Core full node requires 400GB of hard disk space. If you don't have enough space, you can install the Bitcoin Core light node. We'll discuss how to choose between a full node and a light node later. Using a light node requires approximately 7GB of hard disk space.
- Download Bitcoin
https://bitcoincore.org/en/download/
wget https://bitcoincore.org/bin/bitcoin-core-0.21.0/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz
- Extract the downloaded file
tar xzf bitcoin-0.21.0-x86_64-linux-gnu.tar.gz
- Install using the graphical interface
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.21.0/bin/*
/usr/local/bin/bitcoin-qt
- Installation is complete. Start synchronizing blocks (at this point, you can close the GUI program and continue with command-line operations).
Bitcoin Configuration#
- The default configuration directory for Bitcoin is ~/.bitcoin/bitcoin.conf. Fill in the following configuration:
# ~/.bitcoin/bitcoin.conf
datadir=/opt/btc/datadir
# Set the database cache size
dbcache=10240
# Transaction index txindex=1 represents a full node. If not specified, it is a light node.
# txindex=1
# Enable pruning mode (https://bitcoin.org/en/full-node#reduce-storage)
prune=10240
# RPC access user
rpcuser=zhaoyang
# RPC access password
rpcpassword=zy980355088
# Run in the background
daemon=1
server=1
rest=1
rpcbind=0.0.0.0:8332
rpcallowip=0.0.0.0/0
deprecatedrpc=accounts
# The following two lines are required for Lightning Network support
# Allow broadcasting raw block information on port 28332
zmqpubrawblock=tcp://127.0.0.1:28332
# Allow broadcasting raw transaction information on port 28333
zmqpubrawtx=tcp://127.0.0.1:28333
Command Usage Instructions#
Start Bitcoin
bitcoind -daemon
Shutdown Bitcoin. Make sure to use the following command; otherwise, it may cause data corruption and require resynchronization.
bitcoin-cli stop
Some other commands
# Create a wallet
bitcoin-cli createwallet "zhaoyang"
# Generate a wallet address
bitcoin-cli getnewaddress "test" #"test" is the account label you input
# Get all wallet addresses and their account names
bitcoin-cli listreceivedbyaddress 1 true
# Check network status:
bitcoin-cli getnetworkinfo
# Check network nodes:
bitcoin-cli getpeerinfo
# Check blockchain information, such as synchronization progress:
bitcoin-cli getblockchaininfo
# View all commands
bitcoin-cli help
After starting, the wallet will automatically synchronize blocks. You can open the log file to view the synchronization progress.
tail -f nohup.out
Enter the Bitcoin installation directory
cd $HOME/.bitcoin
ls
banlist.dat bitcoind.pid blocks chainstate debug.log peers.dat wallets
ls wallets/
database db.log wallet.dat
bitcoind.pid bitcoind Running process file
blocks Blockchain data files
chainstate Blockchain state database stored using LevelDB
db.log Database log file
debug.log Runtime log file
wallet.dat Wallet file (This is important. It contains the private keys generated by our wallet. It is recommended to back it up daily using shell scripts or background programs.)
Wallet command introduction
bitcoin-cli getwalletinfo View wallet details. In version 0.18, the previous getinfo command has been deprecated.
{
"walletname": "",
"walletversion": 169900, Wallet version
"balance": 0.00000000, Wallet balance
"unconfirmed_balance": 0.00000000, Unconfirmed balance
"immature_balance": 0.00000000, This is currently unclear
"txcount": 0, Number of transactions in the wallet
"keypoololdest": 1562826486, Earliest key creation time in the key pool
"keypoolsize": 1000, Key pool size
"keypoolsize_hd_internal": 1000,
"paytxfee": 0.00000000, Transaction fee rate (this is important and will be discussed separately later)
"hdseedid": "ed13b2019c2e28e9dc84cf7124ba2e36cebcb656",
"private_keys_enabled": true
}
bitcoin-cli getblockchaininfo View blockchain details
{
"chain": "main",
"blocks": 238558, Current block in the wallet (After Bitcoin installation and startup, it usually takes 1-2 days to synchronize to the latest block height)
"headers": 584893, Current latest block height
.... There are other information following, but we don't need to focus on them for now.
}
bitcoin-cli sendtoaddress Transfer interface (will be discussed in detail later)
Response:
1. "address" (string, required) Receiving address
2. "amount" (numeric or string, required) Transfer amount
Result:
"txid" (string) Unique transaction ID
Examples:
> bitcoin-cli sendtoaddress "bc1q7wuvm9q4s0gr9mtqtn2wamjx0462hg43g8h8ak" 0.1
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendtoaddress", "params": ["bc1q7wuvm9q4s0gr9mtqtn2wamjx0462hg43g8h8ak", 0.1] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
GitHub Repository#
Official Website#
https://bitcoincore.org/en/download/
Download Links#
Monero#
- Official Website (Download Wallet): https://www.getmonero.org/downloads/
- Download Mining Software: https://github.com/xmrig/xmrig/releases
- Mining Pool: mine.c3pool.com:13333