Json-Rpc

如何在 Ubuntu 伺服器上安裝比特幣客戶端

  • February 3, 2018

我已經為這個問題搜尋了很多。呵呵。我找到了一些教程,但它們沒有用,因為它們適用於具有 GUI 的系統。我沒有計劃在該系統上安裝 GUI,我想從命令行或通過 RPC API 使用比特幣。這是我執行的系統:

Linux 編輯 3.2.0-40-generic-pae #64-Ubuntu SMP Mon Mar 25 21:44:41 UTC 2013 i686 athlon i386 GNU/Linux

我發現我可以這樣做:

sudo apt-get install bitcoind

但在那之後我幾乎不知道該怎麼處理它。它安裝成功。如果您要問我為什麼要這樣做的原因,那是因為我想通過 PHP 與它進行通信,或者我會看看如何,但主要是為了使用它來自動化服務。請幫忙。:-(

一旦您安裝了 bitcoind,您應該創建一個配置文件(儲存在 中~/.bitcoin/bitcoin.conf),其中至少包含一個 RPC 使用者名和密碼,然後您只需執行bitcoind以啟動伺服器。

Edited answer after Tom van der Woerdt's comment about using an untrusted repo

來自:https ://gist.github.com/WyseNynja/2503687

sudo apt-get update
sudo apt-get install -y git-core build-essential libssl-dev libboost-all-dev libdb5.1-dev libdb5.1++-dev libgtk2.0-dev

git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin/src

make -f makefile.unix clean; make -f makefile.unix USE_UPNP= bitcoind

# from #bitcoin-dev:
# sacarlson: USE_UPNP= : don't build upnp, USE_UPNP=0 : build but disable by default, USE_UPNP=1 : build but enable by default

# optionally, 
strip bitcoind

下載區塊鏈(檢查<http://blockexplorer.com/q/getblockcount>):

bitcoind

比特幣測試:

bitcoind getbalance
bitcoind getaccountaddress account #(where account is the rpcuser account you created earlier in your bitcoind.conf file.) It will look like this: 1djfdLXSgqrwtexqkn9JewSrCJU4vu74eR4

將硬幣發送到地址並仔細檢查bitcoind getbalance

引用自:https://bitcoin.stackexchange.com/questions/10010