什么是量子链
量子链是一个基于比特币核心和集成Ethereum的智能合约的新的区块链。他实现了一种可扩展的设计,能添加更多的虚拟机,允许账户的虚拟机在UTXO的区块链上执行。
安装
需要有OS X的命令行工具
xcode-select --install
需要环境安装Homebrew.
安装依赖
brew install cmake automake berkeley-db4 libtool boost --c++11 --without-single --without-static miniupnpc openssl pkg-config protobuf qt5 libevent imagemagick --with-librsvg
安装核心
xiaoyu@LIXIAOYUdeMacBook-Pro.com git clone --recursive https://github.com/qtumproject/qtum.git
Cloning into 'qtum'...
remote: Counting objects: 82732, done.
remote: Compressing objects: 100% (172/172), done.
remote: Total 82732 (delta 147), reused 148 (delta 84), pack-reused 82476
Receiving objects: 100% (82732/82732), 70.07 MiB | 91.00 KiB/s, done.
Resolving deltas: 100% (61844/61844), done.
Submodule 'src/cpp-ethereum' (https://github.com/qtumproject/cpp-eth-qtum.git) registered for path 'src/cpp-ethereum'
Cloning into '/Users/xiaoyu/qtum/qtum/src/cpp-ethereum'...
remote: Counting objects: 114829, done.
remote: Total 114829 (delta 0), reused 0 (delta 0), pack-reused 114829
Receiving objects: 100% (114829/114829), 49.26 MiB | 851.00 KiB/s, done.
Resolving deltas: 100% (73868/73868), done.
Submodule path 'src/cpp-ethereum': checked out '488ccdc7cef0a0b4fa54c88b7e44e43ed8316ea7'
Submodule 'evmjit' (https://github.com/ethereum/evmjit) registered for path 'src/cpp-ethereum/evmjit'
Cloning into '/Users/xiaoyu/qtum/qtum/src/cpp-ethereum/evmjit'...
remote: Counting objects: 6600, done.
remote: Total 6600 (delta 0), reused 0 (delta 0), pack-reused 6600
Receiving objects: 100% (6600/6600), 1.91 MiB | 306.00 KiB/s, done.
Resolving deltas: 100% (4282/4282), done.
Submodule path 'src/cpp-ethereum/evmjit': checked out '81fc5be25987020f498ea0100a7fb9055c08b84f'
遇到的问题
configure: WARNING: libprotobuf not found; bitcoin-qt frontend will not be buil
解决问题
//更新了cmake,更新后的版本为3.9.2
brew upgrade cmake
//再次执行以下命令
brew install cmake automake berkeley-db4 libtool boost --c++11 --without-single --without-static miniupnpc openssl pkg-config protobuf qt5 libevent imagemagick --with-librsvg
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew install cmake automake berkeley-db4 libtool boost --c++11 --without-single --without-static miniupnpc openssl pkg-config protobuf qt5 libevent imagemagick --with-librsvg
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
anjuta baobab gdl
Warning: cmake 3.9.2 is already installed
Warning: automake 1.15.1 is already installed
Warning: berkeley-db@4 4.8.30 is already installed
Warning: libtool 2.4.6_1 is already installed
Warning: boost 1.65.1 is already installed
Warning: miniupnpc 2.0.20170509 is already installed
Warning: openssl 1.0.2l is already installed
Warning: pkg-config 0.29.2 is already installed
Warning: protobuf 3.4.0 is already installed, it's just not linked.
You can use `brew link protobuf` to link this version.
Warning: qt 5.9.1 is already installed
Warning: libevent 2.1.8 is already installed, it's just not linked.
You can use `brew link libevent` to link this version.
Warning: imagemagick 7.0.7-1 is already installed, it's just not linked.
You can use `brew link imagemagick` to link this version.
//提示需要执行link操作,下面执行了link操作,提示权限不足
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew link protobuf
Linking /usr/local/Cellar/protobuf/3.4.0...
Error: Could not symlink lib/pkgconfig/protobuf-lite.pc
/usr/local/lib/pkgconfig is not writable.
//但是不支持root用户执行
xiaoyu@LIXIAOYUdeMacBook-Pro.com sudo brew link protobuf
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
//解决方式,unlnk后再执行link就行了,protobuf libevent imagemagick 一样处理
~/qtum/qtum git:(master) [15:28:23]
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew unlink protobuf
Unlinking /usr/local/Cellar/protobuf/3.4.0... 0 symlinks removed
~/qtum/qtum git:(master) [15:28:54]
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew link protobuf
Linking /usr/local/Cellar/protobuf/3.4.0... 15 symlinks created
~/qtum/qtum git:(master) [15:31:51]
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew unlink libevent
Unlinking /usr/local/Cellar/libevent/2.1.8... 0 symlinks removed
~/qtum/qtum git:(master) [15:32:11]
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew link libevent
Linking /usr/local/Cellar/libevent/2.1.8... 817 symlinks created
~/qtum/qtum git:(master) [15:32:17]
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew unlink imagemagick
Unlinking /usr/local/Cellar/imagemagick/7.0.7-1... 0 symlinks removed
~/qtum/qtum git:(master) [15:32:34]
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew link imagemagick
Linking /usr/local/Cellar/imagemagick/7.0.7-1... 71 symlinks created
//再次执行,证明全部环境安装完毕,没有报错
~/qtum/qtum git:(master) [15:32:41]
xiaoyu@LIXIAOYUdeMacBook-Pro.com brew install cmake automake berkeley-db4 libtool boost --c++11 --without-single --without-static miniupnpc openssl pkg-config protobuf qt5 libevent imagemagick --with-librsvg
Updating Homebrew...
Warning: cmake 3.9.2 is already installed
Warning: automake 1.15.1 is already installed
Warning: berkeley-db@4 4.8.30 is already installed
Warning: libtool 2.4.6_1 is already installed
Warning: boost 1.65.1 is already installed
Warning: miniupnpc 2.0.20170509 is already installed
Warning: openssl 1.0.2l is already installed
Warning: pkg-config 0.29.2 is already installed
Warning: protobuf 3.4.0 is already installed
Warning: qt 5.9.1 is already installed
Warning: libevent 2.1.8 is already installed
Warning: imagemagick 7.0.7-1 is already installed
再次执行
~/qtum/qtum git:(master) [15:34:51]
xiaoyu@LIXIAOYUdeMacBook-Pro.com ./configure
(.....)
Options used to compile and link:
with wallet = yes
with gui / qt = yes
qt version = 5
with qr = auto
with zmq = no
with test = yes
with bench = yes
with upnp = yes
debug enabled = no
werror = no
target os = darwin
build os = darwin
CC = gcc
CFLAGS = -g -O2
CPPFLAGS = -DQTUM_BUILD -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -I/usr/local/opt/berkeley-db@4/include -DMAC_OSX
CXX = g++ -std=c++11
CXXFLAGS = -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-unknown-pragmas
LDFLAGS = -Wl,-headerpad_max_install_names -Wl,-dead_strip
下面进行编译
make
经过漫长的等待,编译成功。
Making all in doc/man
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all-am'.
启动
执行src/qtumd
或者src/qtum-cli
启动UI界面的话,执行src/qt/qtum-qt
注意目前的是主干网络。
领取测试网络的币
访问 http://qtum.me/#!/ ,领取测试币的发放。
在钱包界面,找到receive,在界面中,点击请求付款,就会得到一个地址,将地址复制到网页中,就能收到测试代币。
…
一直没收到,失败~
切换到测试网络
拉取测试网络的代码 git checkout testnet-2
然后再次执行
./autogen.sh
./configure
make
注意的是,切换网络后,需要删除之前用的数据文件,所在的位置是~/Library/Application Support/Qtum
到此,量子链的正式环境和测试环境部署完成。