A series of articles on how Bitcoin makes money, an online currency invented by computer hackers, has no borders, no government and no center. No government printing money, no inflation. In the global computer network, the free realization of currency exchange and circulation.
This series of articles is about procedures and strategies, not mining…
About the author:
Zhang (zhang Conan), programmers/Quant: Java, R, Nodejsblog: http://blog.fens.meemail: [email protected]
Reprint please indicate the source:
preface
The first step of quantitative transactions is to obtain data, so the most direct way to obtain bitcoin data is to build a bitcoin client, directly from the bitcoin public chain above the synchronous ledger to obtain data. The foundation of the Bitcoin network is based on centrless nodes and transparency, so that each node can get the full amount of data in the Bitcoin network.
So, let’s start by building a Bitcoin client node.
directory
The
- bitcoin installation process starts the node of bitcoin
Bitcoin installation process
The procedure for installing the Bitcoin client from the source code is divided into the following seven steps:
-
- download the library from github switch to the latest version of the installation system dependent library run autogen.sh script run configure script run make and make install verify that bitcoin has been installed successfully </ol b> Now, let’s do it step by step. The Linux system environment used in this article is Linux Ubuntu 16.04 LTS 64bit.
-
- 1.1 Download the codlibrary from Bitcoin’s official Github.
-
- The process of installing Git is not much more than a simple command apt Install Git.
> git clone https://github.com/bitcoin/bitcoin.git
> cd bitcoin
1.2 Find the latest TAG version as V0.16.0.
> git tag
noversion
v0.1.5
...
v0.16.0
v0.16.0rc1
v0.16.0rc2
v0.16.0rc3
v0.16.0rc4
v0.2.0
...
v0.9.3
v0.9.3rc1
v0.9.3rc2
v0.9.4
v0.9.5
v0.9.5rc1
v0.9.5rc2
Switch to the latest version of the branch.
> git checkout v0.16.0
1.3 Install the system tools that need to be depended on, here will use Libtool, pkg-config, libboost, libDB toolkit, need to install in advance.
> apt install libtool
> apt install pkg-config
> apt install libboost-all-dev
> apt install libdb5.3++-dev
> apt install libevent-dev
1.4 Compile with the./ Autogen.sh script,
> ./autogen.sh
1.5 Run the configure script
When you’re done, you find that the current target has generated a configure file, and then run the configure file. At run time, a BerkerlyDB error occurs specifying that a version 4.8 BerkerlyDB is required. There are two solutions. The first solution is to download the corresponding version of BerkerlyDB. Second, skip this step. Let’s start with the second approach and skip the BerkeleyDB compatibility check.
> ./configure
configure: error: Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)
> ./configure --with-incompatible-bdb
1.6 Perform make and make install.
> make
> make install
1.7 Verify that bitcoin has been installed successfully
Verify that the bitcoin installation is successful. There are two commands bitcoind and BitcoI. We need to check if this boot command is installed in the system environment.
Bitcoind, the node used to start Bitcoin, synchronizes ledger data. Bitcoin-cli, used to communicate with bitcoind nodes.
View the system installation location of the boot command.
> which bitcoin-cli
/usr/local/bin/bitcoin-cli
> which bitcoind
/usr/local/bin/bitcoind
View the help information for bitcoind and Bitcoin-CLi commands, respectively.
> bitcoind -help
> bitcoin-cli -help
That completes the installation of the client of Bitcoin.
2. Start the Bitcoin node
Start bitcoin’s core client program with the bitcoind command. Before running it, I’ll define a bitcoin.conf configuration file to set up the user accessing RPC-JSON.
New configuration file.bitcoin/ Cobit.conf. Set the RPC user’s account and password. Please set it according to the requirements of complex password setting. The configuration item for the official recommended Bitcoin.conf file, open the file.
> vi .bitcoin/bitcoin.conf
rpcuser=bsspirit
rpcpassword=98jfidayelqlvjieJDIjda
Start the BitcoIND server and write the data to /data/ BTC directory to print out the output in the console.
> bitcoind -datadir=/data/btc -conf=/root/.bitcoin/bitcoin.conf -printtoconsole
2018-05-30 01:51:06 Bitcoin Core version v0.16.0 (release build)
2018-05-30 01:51:06 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-05-30 01:51:06 Assuming ancestors of block 0000000000000000005214481d2d96f898e3d5416e43359c145944a909d242e0 have valid signatures.
2018-05-30 01:51:06 Setting nMinimumChainWork=000000000000000000000000000000000000000000f91c579d57cad4bc5278cc
2018-05-30 01:51:06 Using the 'sse4' SHA256 implementation
2018-05-30 01:51:06 Using RdRand as an additional entropy source
2018-05-30 01:51:06 Default data directory /root/.bitcoin
2018-05-30 01:51:06 Using data directory /data/btc
2018-05-30 01:51:06 Using config file /root/.bitcoin/bitcoin.conf
2018-05-30 01:51:06 Using at most 125 automatic connections (1024 file descriptors available)
2018-05-30 01:51:06 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-05-30 01:51:06 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-05-30 01:51:06 Using 4 threads for script verification
2018-05-30 01:51:06 scheduler thread start
2018-05-30 01:51:06 HTTP: creating work queue of depth 16
2018-05-30 01:51:06 Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.
2018-05-30 01:51:06 HTTP: starting 4 worker threads
2018-05-30 01:51:06 Using wallet directory /data/btc
2018-05-30 01:51:06 init message: Verifying wallet(s)...
2018-05-30 01:51:06 Using BerkeleyDB version Berkeley DB 5.3.28: (September 9, 2013)
2018-05-30 01:51:06 Using wallet wallet.dat
2018-05-30 01:51:06 CDBEnv::Open: LogDir=/data/btc/database ErrorFile=/data/btc/db.log
2018-05-30 01:51:06 Cache configuration:
2018-05-30 01:51:06 * Using 2.0MiB for block index database
2018-05-30 01:51:06 * Using 8.0MiB for chain state database
2018-05-30 01:51:06 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-05-30 01:51:06 init message: Loading block index...
2018-05-30 01:51:06 Opening LevelDB in /data/btc/blocks/index
2018-05-30 01:51:07 Opened LevelDB successfully
2018-05-30 01:51:07 Using obfuscation key for /data/btc/blocks/index: 0000000000000000
2018-05-30 01:51:08 LoadBlockIndexDB: last block file = 0
2018-05-30 01:51:08 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=1, size=293, heights=0...0, time=2009-01-03...2009-01-03)
2018-05-30 01:51:08 Checking all blk files are present...
2018-05-30 01:51:08 LoadBlockIndexDB: transaction index disabled
2018-05-30 01:51:08 Opening LevelDB in /data/btc/chainstate
2018-05-30 01:51:08 Opened LevelDB successfully
2018-05-30 01:51:08 Using obfuscation key for /data/btc/chainstate: 6adad0af82f188f1
2018-05-30 01:51:08 Loaded best chain: hashBestChain=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 date=2009-01-03 18:15:05 progress=0.000000
2018-05-30 01:51:08 init message: Rewinding blocks...
2018-05-30 01:51:09 init message: Verifying blocks...
2018-05-30 01:51:09 block index 2369ms
2018-05-30 01:51:09 init message: Loading wallet...
2018-05-30 01:51:09 nFileVersion = 160000
2018-05-30 01:51:09 Keys: 2001 plaintext, 0 encrypted, 2001 w/ metadata, 2001 total
2018-05-30 01:51:09 wallet 67ms
2018-05-30 01:51:09 setKeyPool.size() = 2000
2018-05-30 01:51:09 mapWallet.size() = 0
2018-05-30 01:51:09 mapAddressBook.size() = 0
2018-05-30 01:51:09 mapBlockIndex.size() = 279999
2018-05-30 01:51:09 nBestHeight = 0
2018-05-30 01:51:09 Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there
2018-05-30 01:51:09 AddLocal(103.211.167.71:8333,1)
2018-05-30 01:51:09 Discover: IPv4 eth0: 103.211.167.71
2018-05-30 01:51:09 Bound to [::]:8333
2018-05-30 01:51:09 Bound to 0.0.0.0:8333
2018-05-30 01:51:09 init message: Loading P2P addresses...
2018-05-30 01:51:09 torcontrol thread start
2018-05-30 01:51:09 Loaded 2445 addresses from peers.dat 9ms
2018-05-30 01:51:09 init message: Loading banlist...
2018-05-30 01:51:09 init message: Starting network threads...
2018-05-30 01:51:09 dnsseed thread start
2018-05-30 01:51:09 net thread start
2018-05-30 01:51:09 addcon thread start
2018-05-30 01:51:09 init message: Done loading
2018-05-30 01:51:09 opencon thread start
2018-05-30 01:51:09 msghand thread start
2018-05-30 01:51:09 New outbound peer connected: version: 70015, blocks=525031, peer=0
2018-05-30 01:51:11 New outbound peer connected: version: 70015, blocks=525031, peer=1
....
Startup parameters:
-Datadir, which specifies the directory -conf, and -printtoconsole, which specifies the configuration file for console output
If you want to do background execution, you can add the -daemon parameter. At the same time, remove the -printtoConsole parameter and print it out in a later log file.
> bitcoind -datadir=/data/btc -conf=/root/.bitcoin/bitcoin.conf -daemon
Bitcoin server starting
# View the log, in the directory where the data is exported, to track the debug.log file.
> tail -f /data/btc/debug.log
11-04-11 22:01:50' progress=0.001211 cache=23.8MiB(165438txo)
2018-05-30 04:21:12 UpdateTip: new best=00000000000044640cb1d3e034f8df6604d1ac1346e6162bfca8dc60c4bbd887 height=117873 version=0x00000001 log2_work=61.645341 tx=403428 date='2011-04-11 22:02:29' progress=0.001212 cache=23.8MiB(165441txo)
2018-05-30 04:21:12 UpdateTip: new best=0000000000006488914c16dc226f1d73d5dcd6c258c3bc926fa0f804909dbd1b height=117874 version=0x00000001 log2_work=61.645483 tx=403445 date='2011-04-11 22:19:06' progress=0.001212 cache=23.8MiB(165459txo)
2018-05-30 04:21:12 UpdateTip: new best=000000000000988f65c0d5b018241f0dd13ea6b73c6228efccbbb577b5791f06 height=117875 version=0x00000001 log2_work=61.645624 tx=403453 date='2011-04-11 22:21:40' progress=0.001212 cache=23.8MiB(165460txo)
...
Run the bitcoin-CLi GetBlockChainInfo command to display basic information about the status of bitcoin network nodes, wallets, and blockchain databases.
> bitcoin-cli getblockchaininfo
{
"chain": "main",
"blocks": 2867,
"headers": 525050,
"bestblockhash": "000000006d6af482c12555a44bed3a0d4bbadf0fa27274225a1ed808b8a7d405",
"difficulty": 1,
"mediantime": 1233666084,
"verificationprogress": 8.75401245716694e-06,
"initialblockdownload": true,
"chainwork": "00000000000000000000000000000000000000000000000000000b340b340b34",
"size_on_disk": 852350,
"pruned": false,
"softforks": [
{
"id": "bip34",
"version": 2,
"reject": {
"status": false
}
},
{
"id": "bip66",
"version": 3,
"reject": {
"status": false
}
},
{
"id": "bip65",
"version": 4,
"reject": {
"status": false
}
}
],
"bip9_softforks": {
"csv": {
"status": "defined",
"startTime": 1462060800,
"timeout": 1493596800,
"since": 0
},
"segwit": {
"status": "defined",
"startTime": 1479168000,
"timeout": 1510704000,
"since": 0
}
},
"warnings": ""
}
When you see this information, it means that your Bitcoin application has started. There are dozens of gigabytes of data, need to be synchronized!
Bitcoin is a bit more complicated to install than APT, but according to the official documentation it should work properly and the installation process should not be a major problem for technicians. Different common chains, different node software, different installation methods, the next article will cover the ethereum client Geth installation.
Reprint please indicate the source:
This entry was posted in digital currency
Read More:
- Bitcoin source code analysis – load Wallet
- How to mine Bitcoin using Alibaba Cloud and Tencent Cloud servers (ubuntu)
- Error: No such keg: /usr/local/Cellar/node&install nvm&brew installation&Oh my zsh.git installation&git set alias&No bundle URL prese
- Node configuration environment variable and global installation of webapck
- Simple solution for node sass installation failure
- Solution to node sass installation failure
- Unloading and installation of node and NPM of Vue Foundation
- Solution of node canvas error reporting in MacOS M1 installation
- brew install node Error: No such file or directory @ dir_chdir Bottle installation failed
- Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘
- Module build failed: Error: ENOENT: no such file or directory, scandir,‘node_modules\node-sass\vend’
- Uncaught TypeError: Failed to execute ‘removeChild’ on ‘Node’: parameter 1 is not of type ‘Node’.
- Completely solve install_ FAILED_ UPDATE_ Incompatible installation error, the installation package is not consistent with the previous installation package signature on the device
- [Solved] gitbook: node_modules\npm\node_modules\graceful-fs\polyfills.js:287
- VUEJS Failed to execute ‘removeChild’ on ‘Node’: The node to be removed is not a child of
- Uncaught TypeError: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node How to Fix
- The Ethereum private chain is built, and the block information cannot be synchronized. The error is resolved: Node data write error err=”state node failed with all peers(1 tries, 1 peers)
- Win10 installation PostgreSQL error running… And installation process
- After node.js is installed, use the instruction node version in vscode to show that it is not an external or internal instruction. The solution is as follows:
- Another installation will pop up when Windows installs the application inprogress.you must complete that installation before continu