create account

尝试编译BitShares Core by oflyhigh

View this thread on: hive.blogpeakd.comecency.com
· @oflyhigh ·
$149.32
尝试编译BitShares Core
都说***纸上得来终觉浅,绝知此事要躬行***,尽管看过好多大神的编译指南之类的,但是还有感觉有些迷糊,没办法,不亲自操作一下,理解的难免不深刻。怎么形容呢,就好比学数学不做习题,学编程不上机。所以今天就上机操作一下。

![](https://steemitimages.com/DQmbetK9MHQbWok8gPBTMkvuJQe6meQP5rRKdXQbwgvCUc5/image.png)

# 系统要求

在@abit的 [《BTS交易所对接指南(单节点版)》](https://github.com/abitmore/bts-cn-docs/blob/master/BTS%E4%BA%A4%E6%98%93%E6%89%80%E5%AF%B9%E6%8E%A5%E6%8C%87%E5%8D%97%EF%BC%88%E5%8D%95%E8%8A%82%E7%82%B9%E7%89%88%EF%BC%89.txt)中提到,系统的最小要求为:

>独立服务器或者VPS
8G 内存(更多更好)
50G 硬盘

所以我去Linode选了如下VPS
![](https://steemitimages.com/DQmNjup8W7KMS5sLWdniADNhyzQxxXVFJ9AWDSmuGyaKHZi/image.png)
看起来应该符合要求

官方推荐的系统为:`Ubuntu 16.04 LTS`,听人劝吃饱饭,那就用`Ubuntu 16.04 LTS`好了。
内核版本为`4.14.14`,据说***打完Meltdown补丁***了😳

# 准备工作

#### 更新系统软件包

首先更新了一下系统上的软件包
`sudo apt-get update`
`sudo apt-get upgrade`

#### 安装依赖

安装必要的依赖
`sudo apt-get install autoconf cmake git libboost-all-dev libssl-dev g++ libcurl4-openssl-dev`

# 编译

检出代码并编译
```
git clone https://github.com/bitshares/bitshares-core.git
cd bitshares-core
git checkout <LATEST_RELEASE_TAG>
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make witness_node cli_wallet
```

上述指令中,需要将`<LATEST_RELEASE_TAG> `替换成[最新发布版本号](https://github.com/bitshares/bitshares-core/releases),撰写本文时,为`2.0.171212`

# 编译结果

经过漫长的等待(约1一个半小时),编译总算完成了。这个时间应该取决于硬件配置。

编译完成后我们得到两个程序
* build/programs/witness_node/witness_node
* build/programs/cli_wallet/cli_wallet

为了方便,我把它俩复制到~/programs 目录下。

# 时间校准

因为广播交易什么的都和时间有关,所以必须保证时间正确,否则一切免谈。

大神推荐如下方法:
`sudo timedatectl set-ntp false`
`sudo apt-get install ntp`

我看了一下,系统上已经启动了一个[`systemd-timesyncd`](http://man7.org/linux/man-pages/man8/systemd-timesyncd.8.html)进程,由[timedatectl](http://man7.org/linux/man-pages/man1/timedatectl.1.html)指令控制,也是用于时间同步的,大神的做法是关掉这个,启用ntp。

我测试一下,貌似这个东东应该可以用,那就先用着好了,出问题的时候再换其它方法。

来试试看:`timedatectl`
![](https://steemitimages.com/DQmRrmd5irjFVQRKjk1uytgDae9JPPCcBaG68EPzbrXnQBh/image.png)

# 其它

本来想再做做其它尝试,结果我到VPS的连接掉线了。为什么会掉线呢,当然是Party 妈妈怕我们受到资本主义那么腐朽的东西的毒害。其实我真的就是ssh登陆,没用来做ssh隧道,冤枉死我了。

不过既然Party 妈妈让我休息休息,那就先写到这里好了,晚上再说吧。

# 参考链接

* https://github.com/bitshares/bitshares-core
* [BTS交易所对接指南(单节点版)by @abit](https://github.com/abitmore/bts-cn-docs/blob/master/BTS%E4%BA%A4%E6%98%93%E6%89%80%E5%AF%B9%E6%8E%A5%E6%8C%87%E5%8D%97%EF%BC%88%E5%8D%95%E8%8A%82%E7%82%B9%E7%89%88%EF%BC%89.txt)
* [Memory Reduction for Nodes](https://github.com/bitshares/bitshares-core/wiki/Memory-reduction-for-nodes)
* https://github.com/bitshares/bitshares-core/releases
* http://man7.org/linux/man-pages/man1/timedatectl.1.html
* http://man7.org/linux/man-pages/man8/systemd-timesyncd.8.html
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 111 others
properties (23)
authoroflyhigh
permlinkbitshares-core
categorybitshares
json_metadata{"tags":["bitshares","bts","cn","cn-programming","study"],"users":["abit"],"image":["https://steemitimages.com/DQmbetK9MHQbWok8gPBTMkvuJQe6meQP5rRKdXQbwgvCUc5/image.png","https://steemitimages.com/DQmNjup8W7KMS5sLWdniADNhyzQxxXVFJ9AWDSmuGyaKHZi/image.png","https://steemitimages.com/DQmRrmd5irjFVQRKjk1uytgDae9JPPCcBaG68EPzbrXnQBh/image.png"],"links":["https://github.com/abitmore/bts-cn-docs/blob/master/BTS%E4%BA%A4%E6%98%93%E6%89%80%E5%AF%B9%E6%8E%A5%E6%8C%87%E5%8D%97%EF%BC%88%E5%8D%95%E8%8A%82%E7%82%B9%E7%89%88%EF%BC%89.txt","https://github.com/bitshares/bitshares-core/releases","http://man7.org/linux/man-pages/man8/systemd-timesyncd.8.html","http://man7.org/linux/man-pages/man1/timedatectl.1.html","https://github.com/bitshares/bitshares-core","https://github.com/bitshares/bitshares-core/wiki/Memory-reduction-for-nodes"],"app":"steemit/0.1","format":"markdown"}
created2018-01-29 03:47:57
last_update2018-01-29 03:47:57
depth0
children13
last_payout2018-02-05 03:47:57
cashout_time1969-12-31 23:59:59
total_payout_value128.724 HBD
curator_payout_value20.597 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,587
author_reputation6,302,571,573,724,840
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,176,703
net_rshares19,126,938,688,798
author_curate_reward""
vote details (175)
@abdurrazzak ·
Where You are... I'm there...
What are you doing....  I'm just showing..
when make you theme... I want to resteem...
& 
You Post here photo...my Upvote auto..
Who are you man... I'm your Big fan...
"" Great to Share"'
properties (22)
authorabdurrazzak
permlinkre-oflyhigh-bitshares-core-20180129t034933225z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 03:49:36
last_update2018-01-29 03:49:36
depth1
children1
last_payout2018-02-05 03:49:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length217
author_reputation121,581,509,286
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,177,020
net_rshares0
@jake2j ·
Abdul, you okk?? lol
properties (22)
authorjake2j
permlinkre-abdurrazzak-re-oflyhigh-bitshares-core-20180129t044818611z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 04:48:18
last_update2018-01-29 04:48:18
depth2
children0
last_payout2018-02-05 04:48:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length20
author_reputation476,094,614
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,188,170
net_rshares0
@ariyansrizon ·
You always upload importance post thanks for sharing
properties (22)
authorariyansrizon
permlinkre-oflyhigh-bitshares-core-20180129t044316416z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 04:43:24
last_update2018-01-29 04:43:24
depth1
children0
last_payout2018-02-05 04:43:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length52
author_reputation32,440,197,390
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,187,247
net_rshares0
@boxes ·
好高深
properties (22)
authorboxes
permlinkre-oflyhigh-bitshares-core-20180129t074853514z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 07:48:54
last_update2018-01-29 07:48:54
depth1
children0
last_payout2018-02-05 07:48:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3
author_reputation207,040,876,238
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,221,733
net_rshares0
@enajo ·
Nice work. Honestly I really appreciate it
properties (22)
authorenajo
permlinkre-oflyhigh-bitshares-core-20180129t042037760z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 04:20:42
last_update2018-01-29 04:20:42
depth1
children0
last_payout2018-02-05 04:20:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length42
author_reputation1,039,883,065,869
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,182,927
net_rshares0
@eric-boucher ·
$0.13
Thanks a lot for sharing extra goodness for our almighty ***Bitshares***!

All for one and one for all!   Namaste    :)
👍  
properties (23)
authoreric-boucher
permlinkre-oflyhigh-bitshares-core-20180129t043002839z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 04:30:03
last_update2018-01-29 04:30:03
depth1
children0
last_payout2018-02-05 04:30:03
cashout_time1969-12-31 23:59:59
total_payout_value0.128 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length119
author_reputation68,503,601,066,539
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,184,701
net_rshares17,204,676,961
author_curate_reward""
vote details (1)
@frederichs · (edited)
Your post is awesome thanks for sharing this post. Please upvote my post too,,, You always upload importance post thanks for sharing,,,  
look at this project please
https://steemit.com/cryptocurrency/@frederichs/10-best-cryptocurrency-to-invest-in-short-medium-and-long-term-we-will-talk-one-by-one-in-different-post-for-further-explanation
properties (22)
authorfrederichs
permlinkre-oflyhigh-bitshares-core-20180129t045056907z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1","links":["https://steemit.com/cryptocurrency/@frederichs/10-best-cryptocurrency-to-invest-in-short-medium-and-long-term-we-will-talk-one-by-one-in-different-post-for-further-explanation"]}
created2018-01-29 04:51:06
last_update2018-01-29 04:54:54
depth1
children0
last_payout2018-02-05 04:51:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length341
author_reputation1,265,622,414,838
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,188,671
net_rshares0
@hrishikesh ·
Your post is awesome thanks for sharing this post. Please  upvote my post too.
properties (22)
authorhrishikesh
permlinkre-oflyhigh-bitshares-core-20180129t035911451z
categorybitshares
json_metadata{"tags":["bitshares"],"community":"busy","app":"busy/2.3.0"}
created2018-01-29 03:59:15
last_update2018-01-29 03:59:15
depth1
children0
last_payout2018-02-05 03:59:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length78
author_reputation936,726,318,626
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,178,888
net_rshares0
@hui.zhao ·
O哥
我现在做了个wordpress的站点
但是想知道怎么使用 steemconnect的api  实现steemit账号 可以登陆我的wordpress站点嘛?
properties (22)
authorhui.zhao
permlinkre-oflyhigh-bitshares-core-20180129t060549175z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 06:05:21
last_update2018-01-29 06:05:21
depth1
children1
last_payout2018-02-05 06:05:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length81
author_reputation3,520,187,684,701
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,202,415
net_rshares0
@oflyhigh ·
WordPress和steemconnect我都不太了解 😳
properties (22)
authoroflyhigh
permlinkre-huizhao-re-oflyhigh-bitshares-core-20180129t075701033z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 07:57:03
last_update2018-01-29 07:57:03
depth2
children0
last_payout2018-02-05 07:57:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length30
author_reputation6,302,571,573,724,840
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,223,360
net_rshares0
@skenan ·
$0.92
推荐使用这个https://contabo.com  VPS,性价比超高。。
👍  
properties (23)
authorskenan
permlinkre-oflyhigh-bitshares-core-20180129t051131132z
categorybitshares
json_metadata{"tags":["bitshares"],"links":["https://contabo.com"],"app":"steemit/0.1"}
created2018-01-29 05:11:30
last_update2018-01-29 05:11:30
depth1
children1
last_payout2018-02-05 05:11:30
cashout_time1969-12-31 23:59:59
total_payout_value0.688 HBD
curator_payout_value0.228 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length38
author_reputation8,219,510,746,132
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,192,477
net_rshares118,480,852,261
author_curate_reward""
vote details (1)
@oflyhigh ·
感谢推荐,下次试试
properties (22)
authoroflyhigh
permlinkre-skenan-re-oflyhigh-bitshares-core-20180129t075609732z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 07:56:12
last_update2018-01-29 07:56:12
depth2
children0
last_payout2018-02-05 07:56:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length9
author_reputation6,302,571,573,724,840
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,223,172
net_rshares0
@tumutanzi ·
$2.57
O哥在技术的路上越走越远啊。
👍  ,
properties (23)
authortumutanzi
permlinkre-oflyhigh-bitshares-core-20180129t083653761z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2018-01-29 08:36:57
last_update2018-01-29 08:36:57
depth1
children0
last_payout2018-02-05 08:36:57
cashout_time1969-12-31 23:59:59
total_payout_value1.932 HBD
curator_payout_value0.638 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length14
author_reputation193,777,509,634,731
root_title"尝试编译BitShares Core"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,230,974
net_rshares334,495,587,026
author_curate_reward""
vote details (2)