Ubuntu上安装Bitcoin Core

来源:互联网 发布:八皇后问题递归c语言 编辑:程序博客网 时间:2024/05/21 11:08

首先需要添加bitcoin的源:

sudo add-apt-repository ppa:bitcoin/bitcoin

Stable Channel of bitcoin-qt and bitcoind for Ubuntu, and their dependencies More info: https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoinPress [ENTER] to continue or ctrl-c to cancel adding it......gpg:               imported: 1  (RSA: 1)OK

添加源成功之后,需要更新下源:

sudo apt-get update

安装bitcoind:

sudo apt-get install bitcoind

可以选择性的安装bitcoin-qt,在ubuntu-service版本上是不需要bitcoin-qt的,如果是在ubuntu-desktop上面想使用bitcoin-qt的话可以选择安装:

sudo apt-get install bitcoin-qt

运行bitcoind

直接输入bitcoind命令可以让bitcoind在前台直接运行:

bitcoind

也可以采用后台运行的方式:

bitcoind --daemon

运行的时候我们可以使用命令查看bitcoind的运行情况:

bitcoin-cli getinfo

{  "version": 120100,  "protocolversion": 70012,  "walletversion": 60000,  "balance": 0.00000000,  "blocks": 32,  "timeoffset": 0,  "connections": 6,  "proxy": "",  "difficulty": 1,  "testnet": false,  "keypoololdest": 1472539508,  "keypoolsize": 101,  "paytxfee": 0.00000000,  "relayfee": 0.00001000,  "errors": ""}

也可以直接查看debug.log,监控当前运行情况。
进入.bitcoin目录:

cd $HOME/.bitcoin

使用tail命令:

tail -f debug.log

区块链数据

在Linux中bitcoind的数据存在$HOME/.bitcoin目录下,该目录下有以下的文件。

  • bitcoind.pid bitcoind运行的进程文件

  • blocks 区块链数据文件

  • chainstate 区块链状态的数据库使用LevelDB存储

  • db.log 数据库日志文件

  • debug.log 运行时的日志文件

  • wallet.dat 钱包文件

bitcoind数据在其它平台存在的地址。

Windows

  • %APPDATA%Bitcoin 例如:C:UsersusernameAppDataRoamingBitcoin

Mac OSX

  • $HOME/Library/Application Support/Bitcoin/ 例如:/Users/username/Library/Application Support/Bitcoin

原创粉丝点击