[BTC] network building – btcoin

Time:2019-11-28

Download / install

download

Source download address: https://github.com/bitcoin/bi
Out of the box installation package download address: https://bitcoin.org/zh cn/dow
API documentation: http://chainquery.com/bitcoin

install

  • Installation directory

    • bitcoin-qt.exe
    • daemon

      • bitcoin-cli.exe
      • bitcoind.exe
      • bitcoin-tx.exe
  • Block directory

    • blocks
    • chainstate
    • testnets It will appear when testing the network synchronously
    • bitcoin.conf configuration file

Basic command

start-up

  • Testnet connection test network
  • Server accepts json-rpc commands
  • Conf specifies the configuration file
  • DataDir specifies the data folder
  • deprecatedrpc=accounts Allow to view account function
  • Daemon background start
  • rpcallowip=127.0.0.1 (::/0)
  • Port = listen for connections on < port > (default: 8333, testnet: 18333)
#GUI BTC start
.\bitcoin-qt.exe -testnet -server -conf='F:\btc\bitcoin.conf' -datadir='F:\btc'
#Command line version launch
.\bitcoind -printtoconsole -conf='F:\btc\bitcoin.conf' -datadir=F:\btc'
. \ bitcoin - testnet - printtoconsole - conf ='f: \ BTC \ bitcoin. Conf '- dataDir = f: \ BTC' ා test environment
#If you start more than one node, you need to specify two ports in front of the port, which are used to specify different ports
./bitcoind.exe -regtest -deprecatedrpc=accounts  -server -conf='F:\btc\regtest.conf' -datadir='F:\btc' --port=8662

Connect

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18332 getblockchaininfo
./bitcoin-cli -conf='F:\btc\bitcoin.conf' getblockchaininfo

network

testnet

Regtest network

#Start network
#Regtest.conf is as follows. Rpcport does not take effect. The system automatically enables 18443
# rpcuser=userrpc  
# rpcpassword=userpassword  
# rpcallowip=127.0.0.1  
# rpcport=18332
./bitcoind.exe -regtest -deprecatedrpc=accounts  -server -conf='F:\btc\regtest.conf' -datadir='F:\btc'

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 getblockchaininfo
./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 getbalance
#Mining rewards can only be used after 100 blocks 
./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 generate 101

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 getaccountaddress ""

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 getbalance

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 getnewaddress

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 sendtoaddress 2MyifBSafpYEdmQLHomqBPBeZSu4pKPtDaJ 10

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 getrawtransaction 2b8968a440dde03591e27f5cff202eaae2c781372ddfd1ab56447a5655de0211

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 generate 1

./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=userrpc -rpcpassword=userpassword -rpcport=18443 listreceivedbyaddress

omni

Get recharge test usdt: moneyqman7uh8fqdca2bv5yz8qvrc9iklp
Test BTC to the above address, 1btc = 100usdt, and the propertyid of the main test network is 2