Compile Cloakcoin Client
Hướng dẫn này bao gồm việc compile CloakCoin trên Linux và raspberry Pi, nó được thử nghiệm bởi các thành viên nhóm Cloak trên Ubuntu 16.04, Xubuntu 16.04 LTS và raspberry Pi3, các bản distribution Linux khác nhau có thể cần thêm tweeking.
"Hướng dẫn build cho phiên bản Ubuntu Linux QT GUI"
- Cài đặt git nếu bạn chưa có
sudo apt install git
- Clone CloakCoin repository từ Github
git clone https://github.com/CloakProject/CloakCoin
cd CloakCoin/src
- Cài đặt dependency
sudo apt install -y \ build-essential \ qt5-default \ qt5-qmake \ libleveldb-dev \ libboost1.58-dev \ libcurl4-openssl-dev \ openssl \ libssl-dev \ libdb++-dev \ libevent-dev \ libboost-dev \ libboost-system-dev \ libboost-filesystem-dev \ libboost-program-options-dev \ libboost-thread-dev \ libminiupnpc-dev
- Build từ source
qmake && make
- Nếu tất cả đều ổn, cloakcoin-qt nên được tạo trong root của thư mục repository
- Lần đầu tiên bạn khởi chạy ví, nó sẽ phải đồng bộ hóa với mạng. Điều này kéo dài mãi mãi nếu bạn chưa có nhiều blockchain được tải xuống. Bạn có thể tải xuống như thế này:
mkdir ~/.CloakCoin && cd ~/.CloakCoin
- Tải xuống ~1,1 GB dữ liệu blockchain
wget https://backend.cloakcoin.com/wallet/v2/cloak_ldb.zip
unzip cloak_ldb.zip
rm cloak_ldb.zip
- Hiện bạn đã sẵn sàng khởi chạy ví
./cloakcoin-qt
- Bạn có thể tùy chọn copy cloakcoin-qt vào directory trong $PATH của bạn để bạn có thể mở nó từ bất kỳ đâu như sau
sudo cp ./cloakcoin-qt /usr/local/bin
"Hướng dẫn build cho phiên bản Linux headless"
- Cài đặt git nếu bạn chưa có
sudo apt install git
- Clone CloakCoin repository từ Github
git clone https://github.com/CloakProject/CloakCoin
cd CloakCoin/src
make -f makefile.unix
"Hướng dẫn build cho phiên bản Raspberry Pi 3 headless"
Hướng dẫn này bao gồm mọi thứ bạn cần biết để thiết lập một ví tiền xách tay và node giao dịch ẩn danh enigma.
Nếu bạn làm theo thứ tự các bước bạn sẽ có một ví CloakCoin hoạt động và có trong tay sức mạnh để hỗ trợ mạng cloakcoin.
"Yêu cầu bắt buộc:"
- Raspberry Pi 3
- SD card 8Gb (khuyên dùng class 10)
- Nguồn 5v 2A
- USB 2Gb để swap drive (khuyên dùng USB 3.0)
- Kết nối mạng internet LAN
- Coffee
Cài OS arm64 trên Raspberry Pi và thiết lập SWAP trên USB
Pi64 là OS 64 bit cho Raspberry Pi 3. Nó dựa trên Debian Stretch và được hỗ trợ bởi 4.11 Linux kernel
- Tải xuống bản pi64 lite từ:
- Để viết image Pi64 vào SD card, chúng ta sử dụng Etcher, tải etcher cho nền tảng của bạn ở đây:
- Chạy Etcher, sau đó nhấp vào select image" và chọn image Pi64 mà bạn đã tải xuống trước đó, sau đó select drive cho SD card bạn sẽ sử dụng trên Pi, sau đó bấm vào Flash!. Đợi thông báo flash completed! và sau đó bạn có SD card sẵn sàng để sử dụng trên Raspberry Pi.
- Insert SD card vào Raspberry Pi và bật nguồn. Trong quá trình khởi động đầu tiên, quá trình cài đặt sẽ tiếp tục trong vài phút, sau đó Raspberry Pi sẽ khởi động lại và bạn sẽ sẵn sàng sử dụng. Người dùng mặc định là pi và mật khẩu là raspberry, nó có quyền root không mật khẩu thông qua sudo. Trên phiên bản lite, SSH được bật theo mặc định.
- Thay đổi mật khẩu người dùng pi bằng câu lệnh:
passwd
- Cập nhật danh sách package Pi64 bằng cách gõ:
sudo apt-get update
- Install a text editor:
sudo apt-get install nano
- Để tạo partition swap trên USB, tạo một partition trống không có hole. Sau đó bạn có thể format partition này bằng:
sudo mkswap /dev/sdX
dmesg
để xác định USB của bạn, trường hợp của tôi là sda1) - Mount partition này như swap với:
sudo swapon -U UUID
sudo blkid /dev/sdX
sudo nano /etc/fstab
UUID=xxx none swap sw 0 0
- Khởi động lại hệ thống bằng:
sudo reboot
- Để xem loại partition swap mới thêm vào:
free -h
Thiết lập môi trường building
- Cài đặt dependency và các ứng dụng bắt buộc bằng các câu lệnh sau:
sudo apt-get update
sudo apt-get install g++
sudo apt-get install zlib1g-dev
sudo apt-get install wget
sudo apt-get install unzip
sudo apt-get install make
sudo apt-get install libboost-all-dev
sudo apt-get install git
- Lấy source CloakCoin:
- Get and compile libevent
sudo wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -zxf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
sudo make install
- Get and compile libssl from source
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
tar -zxf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
./config
make
sudo make install_sw
(no docs/manpages)echo libssl-dev hold | sudo dpkg --set-selections
(keeps from updating)
- Get and compile Berkeley db 4.8
wget http://ftpmirror.your.org/pub/misc/Berkeley-DB/db-4.8.30.zip
unzip db-4.8.30.zip
cd db-4.8.30/build_unix
../dist/configure --build=aarch64-unknown-linux-gnu --enable-cxx
make
sudo make install
- Compile levedb
cd /home/pi/CloakCoin/src/leveldb
chmod 755 build_detect_platform
make clean
make
(ignore compile error, the *.a files have already been created)cp out-static/*.a .
- Get and compile miniupnpc 1.9
wget http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.9.20160209.tar.gz
tar -zxf miniupnpc-1.9.20160209.tar.gz
cd miniupnpc-1.9.20160209
make
cp libminupnpc.a /home/pi/CloakCoin/src/miniupnpc
This will clone the CloakCoin Project source to your machine. If you are in your home directory (by default /home/pi) it will clone to: /home/pi/CloakCoin
copy libminiupnpc.a to (cloaksource)/src/miniupnpc with:
Compile the wallet
- Change to CloakCoin source directory and compile:
cd /home/pi/CloakCoin/src
export CXXFLAG=" -DBOOST_NO_CXX11_SCOPED_ENUMS"
make -f makefile.unix
cp ./cloakcoind /usr/local/bin
You should end up with cloakcoind in /home/pi/CloakCoin/src (grab a cup of coffee, it will take over an hour to complete). On completion do:
Inicialization, Testing and First Commands
- Before you start the wallet you need to open a text editor and create CloakCoin's rpc configuraion file with:
nano /home/pi/.CloakCoin/CloakCoin.conf
- Write the following info:
rpcuser=bitcoinrpc
rpcpassword= <type some ramdom password that you dont need to remember>
- Set it to owner-readable-only with:
chmod 400 /home/pi/.CloakCoin/CloakCoin.conf
- To start the wallet with the database cache limited to 100Mb type:
cloakcoind -dbcache=100
- Open another console by pressing Alt + F2 and type:
cloakcoind getinfo
- Sinchronizing with the blockchain can take several days, its faster if you download the blockchain data manually:
cd /home/pi/.CloakCoin
wget https://backend.cloakcoin.com/wallet/v2/cloak_ldb.zip
unzip cloak_ldb.zip
rm cloak_ldb.zip
- Reboot:
sudo reboot
- Start wallet again:
cloakcoind -dbcache=100
- To get the full list of rpc commands type:
cloakcoind help
press Ctrl + O then Enter to save then Ctrl + X to exit the text editor.
(If you fail to create the above CloakCoin.conf file, when starting the wallet with the command cloakcoind you will receive the following 'error: you must set rpcpassword=<password> in the configuration file: ...')
if you get the response: error: couldnt connect to server Wait a few minutes and try again, as soon as you get a response your CloakCoin Pi wallet is up and running, and its a matter of waiting for the connections to come up and the syncing to start.
Backup SD card image
It's sensible to keep a copy of the entire SD card image, so you can restore the card if you lose it or it becomes corrupt.
Of course make sure your wallet is encrypted, before making the backup.
- To create a backup image file on your computer type:
sudo dd bs=4M if=/dev/sdb of=cloakpi.img
- To restore the image file to another SD card type:
sudo dd bs=4M if=cloakpi.img of=/dev/sdb
That's it, have fun!