比特股中文网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ubuntu下安装bts2.0 见证人

2016-8-1 12:33| 发布者: admin| 查看: 1847| 评论: 0

原文地址:https://bitsharestalk.org/index.php?topic=18929.0



Offline ebit

  • Hero Member
  • *****
  • Posts: 1585
    • View Profile
    •  
    • 推荐链接
    •  
    • Personal Message (Offline)
  • BTS: ebit
ubuntu下安装bts2.0 见证人
« on: October 13, 2015, 01:40:37 AM »

参考:
https://github.com/cryptonomex/graphene
http://docs.bitshares.eu/installation/Build.html#building-bitshares-graphene

Building BTS 2.0 in Ubuntu from scratch
https://bitsharestalk.org/index.php/topic,19612.0.html

HOWTO RUN A BLOCK-PRODUCING WITNESS
http://docs.bitshares.eu/bitshares/tutorials/witness-howto.html

第一步:准备环境,保证网络畅通,能翻墙就翻墙。
(1)因为14.04 LTS不提供g++-4.9,所以要:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test

Quote
sudo: add-apt-repository: command not found
sudo apt-get install python-software-properties
Quote
安装后还是报command not found,所以依赖包还没有安装完全,少了什么呢?
执行命令:
add-apt-repository
Quote
,发现还需要software-properties-common
ok,执行安装命令:
apt-get install software-properties-common

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

Quote
If you get build failures due to abi incompatibilities, just use gcc 4.9:
CC=gcc-4.9 CXX=g++-4.9 cmake .
参考资料:http://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu-14-04
(2)安装依赖的工具
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
Quote
The --slave, with g++, will cause g++ to be switched along with gcc, to the same version. But, at this point gcc-4.9 will be your only version configured in update-alternatives
sudo apt-get install cmake make libbz2-dev libdb++-dev libdb-dev libssl-dev openssl libreadline-dev autoconf libtool git
Quote
如果gcc-4.9还出错,那就重复上一环节,可能网络问题导致安装失败,多来几次就好了
(3)Build Boost 1.57.0 ,可能要翻墙,有时候连不上。
BOOST_ROOT=$HOME/opt/boost_1_57_0
sudo apt-get update
sudo apt-get install autotools-dev build-essential g++ libbz2-dev libicu-dev python-dev

Code: [Select]
wget -c 'http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.bz2/download' -O boost_1_57_0.tar.bz2
[ $( sha256sum boost_1_57_0.tar.bz2 | cut -d ' ' -f 1 ) == "910c8c022a33ccec7f088bd65d4f14b466588dda94ba2124e78b8c57db264967" ] || ( echo 'Corrupt download' ; exit 1 )

tar xjf boost_1_57_0.tar.bz2

cd boost_1_57_0/

./bootstrap.sh "--prefix=$BOOST_ROOT"

./b2 install

第二步:Build Graphene
cd ..
git clone https://github.com/bitshares/bitshares-2.git
cd bitshares-2
git submodule update --init --recursive
BOOST_ROOT=$HOME/opt/boost_1_57_0
CC=gcc-4.9 CXX=g++-4.9 cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Debug .
make 

Quote
如果出了错误,重来时要 rm CMakeCache.txt
提示错误:编译时找不到Makefile,大多数原因是boost没安装好。

第三步:运行节点
apt-get installs screen
screen -S n
./programs/witness_node/witness_node -s 104.200.28.117:61705 --rpc-endpoint=127.0.0.1:8090
如果同步出错,那么添加--replay-blockchain试试
(要在bitshares-2目录下执行,否则,容易出现路径识别错误)


第四步:  区块同步完成后,另来一个窗口 运行命令行钱包
screen -S w
cd bitshares-2/programs/cli_wallet
./cli_wallet -s ws://127.0.0.1:8090 

new>>>set_password bts2000
locked >>> unlock bts2000


使用教程
https://github.com/cryptonomex/graphene/wiki/CLI-Wallet-Cookbook
命令列表
https://github.com/cryptonomex/graphene/blob/master/libraries/wallet/include/graphene/wallet/wallet.hpp
(help)
        (gethelp)
        (info)
        (about)
        (begin_builder_transaction)
        (add_operation_to_builder_transaction)
        (replace_operation_in_builder_transaction)
        (set_fees_on_builder_transaction)
        (preview_builder_transaction)
        (sign_builder_transaction)
        (propose_builder_transaction)
        (propose_builder_transaction2)
        (remove_builder_transaction)
        (is_new)
        (is_locked)
        (lock)(unlock)(set_password)
        (dump_private_keys)
        (list_my_accounts)
        (list_accounts)
        (list_account_balances)
        (list_assets)
        (import_key)
        (import_accounts)
        (import_account_keys)
        (import_balance)
        (suggest_brain_key)
        (register_account)
        (upgrade_account)
        (create_account_with_brain_key)
        (sell_asset)
        (sell)
        (buy)
        (borrow_asset)
        (cancel_order)
        (transfer)
        (transfer2)
        (get_transaction_id)
        (create_asset)
        (update_asset)
        (update_bitasset)
        (update_asset_feed_producers)
        (publish_asset_feed)
        (issue_asset)
        (get_asset)
        (get_bitasset_data)
        (fund_asset_fee_pool)
        (reserve_asset)
        (global_settle_asset)
        (settle_asset)
        (whitelist_account)
        (create_committee_member)
        (get_witness)
        (get_committee_member)
        (list_witnesses)
        (list_committee_members)
        (create_witness)
        (update_witness)
        (create_worker)
        (update_worker_votes)
        (get_vesting_balances)
        (withdraw_vesting)
        (vote_for_committee_member)
        (vote_for_witness)
        (set_voting_proxy)
        (set_desired_witness_and_committee_member_count)
        (get_account)
        (get_account_id)
        (get_block)
        (get_account_count)
        (get_account_history)
        (get_market_history)
        (get_global_properties)
        (get_dynamic_global_properties)
        (get_object)
        (get_private_key)
        (load_wallet_file)
        (normalize_brain_key)
        (get_limit_orders)
        (get_call_orders)
        (get_settle_orders)
        (save_wallet_file)
        (serialize_transaction)
        (sign_transaction)
        (get_prototype_operation)
        (propose_parameter_change)
        (propose_fee_change)
        (approve_proposal)
        (dbg_make_uia)
        (dbg_make_mia)
        (dbg_push_blocks)
        (dbg_generate_blocks)
        (dbg_stream_json_objects)
        (dbg_update_object)
        (flood_network)
        (network_add_nodes)
        (network_get_connected_peers)
        (set_key_label)
        (get_key_label)
        (get_public_key)
        (get_blind_accounts)
        (get_my_blind_accounts)
        (get_blind_balances)
        (create_blind_account)
        (transfer_to_blind)
        (transfer_from_blind)
        (blind_transfer)
        (blind_history)
        (receive_blind_transfer)
        (get_order_book)

如果同步未完成,cli_wallet运行会出错:
Code: [Select]
root@iZ11zwnk21tZ:~/bitshares-2/programs/cli_wallet# ./cli_wallet -s ws://127.0.0.1:8090 -H 127.0.0.1:8091
Logging RPC to file: logs/rpc/rpc.log
1808214ms th_a       main.cpp:120                  main                 ] key_to_wif( committee_private_key ): 5KCBDTcyDqzsqehcb52tW5nU6pXife6V2rX9Yf7c3saYSzbDZ5W
1808214ms th_a       main.cpp:124                  main                 ] nathan_pub_key: BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
1808214ms th_a       main.cpp:125                  main                 ] key_to_wif( nathan_private_key ): 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
11 eof_exception: End Of File
unexpected end of file
th_a  json.cpp:430 variant_from_stream
« Last Edit: August 20, 2016, 07:52:43 AM by ebit »
telegram:ebit521
www.bts.tips

Offline namjar

  • Full Member
  • ***
  • Posts: 51
    • View Profile
    •  
    • Email
    •  
    • Personal Message (Offline)
Re: ubuntu下安装bts2.0
« Reply #1 on: October 15, 2015, 07:54:55 AM »
up up!

Offline namjar

  • Full Member
  • ***
  • Posts: 51
    • View Profile
    •  
    • Email
    •  
    • Personal Message (Offline)
Re: ubuntu下安装bts2.0
« Reply #2 on: October 15, 2015, 08:11:13 AM »
如何搭建 witness node 服务器?

Offline ebit

  • Hero Member
  • *****
  • Posts: 1585
    • View Profile
    •  
    • 推荐链接
    •  
    • Personal Message (Offline)
  • BTS: ebit
Re: ubuntu下安装bts2.0
« Reply #3 on: October 16, 2015, 01:13:49 PM »
第五步:导入账户
unlocked >>> import_key "nathan" 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 true

如果运行中出现错误,检查bitshares-2目录下的witness_node_data_dir下的config.ini
# Endpoint for P2P node to listen on
# p2p-endpoint =

# P2P nodes to connect to on startup (may specify multiple times)
# seed-node =

# JSON array of P2P nodes to connect to on startup
# seed-nodes =

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =

# Endpoint for websocket RPC to listen on
rpc-endpoint = 127.0.0.1:8090

# Endpoint for TLS websocket RPC to listen on
# rpc-tls-endpoint =

# The TLS certificate file for this server
# server-pem =

# Password for this certificate
# server-pem-password =

# File to read Genesis State from
# genesis-json =

# Block signing key to use for init witnesses, overrides genesis file
# dbg-init-key =

# JSON file specifying API permissions
# api-access =

# Enable block production, even if the chain is stale.
enable-stale-production = false

# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = false

# ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times)
# witness-id =

# Tuple of [PublicKey, WIF private key] (may specify multiple times)
private-key = ["PUBLICKEYHERE","PRIVATEKEYHERE"]

# Account ID to track history for (may specify multiple times)
# track-account =

# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers
bucket-size = [15,60,300,3600,86400]

# How far back in time to track history for each bucket size, measured in the number of buckets (default: 1000)
history-per-size = 1000

# declare an appender named "stderr" that writes messages to the console
[log.console_appender.stderr]
stream=std_error

# declare an appender named "p2p" that writes messages to p2p.log
[log.file_appender.p2p]
filename=logs/p2p/p2p.log
# filename can be absolute or relative to this config file

# route any messages logged to the default logger to the "stderr" logger we
# declared above, if they are info level are higher
[logger.default]
level=info
appenders=stderr

# route messages sent to the "p2p" logger to the p2p appender declared above
[logger.p2p]
level=debug
appenders=p2p


第六步:升级账户
unlocked >>> upgrade_account my-account true
unlocked >>> create_witness my-account "http://witness.bar.com/" true

第七步:让大家投票
自己投自己unlocked >>> vote_for_witness my-account my-account true true
自己投nathan unlocked >>> vote_for_witness nathan my-account true true

第八步:运行见证人
找见证人id和私钥
unlocked >>> get_witness my-account
{
  "id": "1.6.10",
  "witness_account": "1.2.16",
  "signing_key": "GPH7vQ7GmRSJfDHxKdBmWMeDMFENpmHWKn99J457BNApiX1T5TNM8",
}
unlocked >>> dump_private_keys
[[
  ...
  ],[
    "GPH7vQ7GmRSJfDHxKdBmWMeDMFENpmHWKn99J457BNApiX1T5TNM8",
    "5JGi7DM7J8fSTizZ4D9roNgd8dUc5pirUe9taxYCUUsnvQ4zCaQ"
  ]
]

重新运行witness_node
./witness_node --rpc-endpoint=0.0.0.0:8090 --enable-stale-production --witness-id \""1.6.0"\" \""1.6.1"\" \""1.6.2"\" \""1.6.3"\" \""1.6.4"\"  \""1.6.5"\" \""1.6.6"\" \""1.6.7"\" \""1.6.8"\" \""1.6.9"\"  \""1.6.10"\" --private-key "[\"GPH7vQ7GmRSJfDHxKdBmWMeDMFENpmHWKn99J457BNApiX1T5TNM8\", \"5JGi7DM7J8fSTizZ4D9roNgd8dUc5pirUe9taxYCUUsnvQ4zCaQ\"]"错了,这是测试链的

正确的是:
Code: [Select]
./witness_node -s 104.200.28.117:61705 --rpc-endpoint=127.0.0.1:8090 --witness-id '"你的见证人序列号"' --private-key '["账户公钥", "账户activkey"]' --replay-blockchain

一个非常特殊的IP:0.0.0.0 这个IP相当于java中的this,代表当前设备的IP。
特殊的IP地址段:
127.x.x.x
这是大家最熟悉不过的本地loopback地址,在windows和linux上等价于localhost。
我们习惯于使用127.0.0.1,实际上,
如果你在命令行下ping 127.0.0.1-127.255.255.254之间的任意地址,结果都是一样的,它们是等价的。
背后的秘密就在与0.0.0.0这个IP,他可以代表本机的所有IP地址,
但这个IP并不是真是存在的,我们ping不通它
本机ip、127.0.0.1和0.0.0.0区别
http://www.2cto.com/net/201310/253427.html

例如:
./witness_node -s 104.200.28.117:61705 --rpc-endpoint=127.0.0.1:8090 --witness-id '"1.6.69"' --private-key '["BTSertyugfdutruytiS71MtyGrZkvvtyiyttTWyiyt1", "5triytiytritriytiytiv8DnZuFrytiytVytiytf7ryiuT"]' --replay-blockchain
或者
./witness_node --rpc-endpoint=127.0.0.1:8090 \
               --witness-id '"1.6.10"' \
               --private-key '["GPH7vQ7GmRSJfDHxKdBmWMeDMFENpmHWKn99J457BNApiX1T5TNM8", "5JGi7DM7J8fSTizZ4D9roNgd8dUc5pirUe9taxYCUUsnvQ4zCaQ"]'










How To become an active witness in BitShares 2.0
https://github.com/cryptonomex/graphene/wiki/How%20to%20become%20an%20active%20witness%20in%20BitShares%202.0


In case it may be helpful, here is the whole procedure I have used:
https://bitsharestalk.org/index.php/topic,18751.375.html
« Last Edit: May 04, 2016, 09:09:39 AM by ebit »
telegram:ebit521
www.bts.tips

Offline 当年很厉害

  • Sr. Member
  • ****
  • Posts: 309
    • View Profile
    •  
    • Email
    •  
    • Personal Message (Offline)
Re: ubuntu下安装bts2.0
« Reply #4 on: April 22, 2016, 08:48:12 AM »
 +5% +5% +5%
BTS粉里有SB!

Offline ebit

  • Hero Member
  • *****
  • Posts: 1585
    • View Profile
    •  
    • 推荐链接
    •  
    • Personal Message (Offline)
  • BTS: ebit
比特帝国区块链交易所

最新评论