Author Topic: ubuntu下安装bitshares-core 见证人  (Read 8635 times)

0 Members and 1 Guest are viewing this topic.

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
ubuntu下安装bitshares-core 见证人
« 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

第一步:内存12G以上。
准备环境,保证网络畅通,能翻墙就翻墙。
(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 libcurl4-openssl-dev
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-core.git
cd bitshares-core
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 install 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-core/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]
[email protected]:~/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: January 28, 2018, 01:38:50 pm by ebit »

Offline namjar

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

Offline namjar

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

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #3 on: October 16, 2015, 01:13:49 pm »
第五步:导入账户
unlocked >>> import_key "nathan" 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 true

如果运行中出现错误,检查bitshares-core目录下的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: July 23, 2017, 10:37:19 pm by ebit »

Offline 当年很厉害

  • Sr. Member
  • ****
  • Posts: 310
    • View Profile
Re: ubuntu下安装bts2.0
« Reply #4 on: April 22, 2016, 08:48:12 am »
 +5% +5% +5%
BTS粉里有SB!

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0及见证人、喂价
« Reply #5 on: April 27, 2016, 02:59:37 am »
第八步:喂价
参考资料:
http://python-graphenelib.readthedocs.org/en/latest/installation.html#dependencies
https://bitsharestalk.org/index.php/topic,18852.15.html
Ubuntu下安装Python3.4
http://blog.sina.com.cn/s/blog_7cdaf8b60102vf2b.html
Python 包管理工具解惑
http://zengrong.net/post/2169.htm
Quote
(8.1安装python)
sudo apt-get install libffi-dev libssl-dev python-dev
此时输入python,可以查出还是2.7版本。
apt-get install python3.4
rm /usr/bin/python
ln -s /usr/bin/python3.4 /usr/bin/python



sudo apt-get install python-setuptools
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
easy_install-3.4 install autobahn
easy_install-3.4 install requests
easy_install-3.4 install prettytable
easy_install-3.4 install numpy

Quote
8.2安装喂价程序
apt-get install python3-pip
pip3 install graphenelib
cd /root
git clone  https://github.com/xeroc/python-graphenelib.git
cd python-graphenelib
python3 setup.py install --user
apt-get install python-pip
pip install --user --upgrade  graphenelib

Quote
8.3安装喂价工具包
NumPy系统是Python的一种开源的数值计算扩展。这种工具可用来存储和处理大型矩阵,比Python自身的嵌套列表(nested list structure)结构要高效的多(该结构也可以用来表示矩阵(matrix))。据说NumPy将Python相当于变成一种免费的更强大的MatLab系统。
Python通过prettytable模块将输出内容如表格方式整齐输出:
linux 内核Crypto——加密模块
cd ..
apt-get install python-autobahn
pip3 install requests --upgrade
pip3 install numpy prettytable autobahn crypto



Quote
8.4编辑配置文件
ls
cd python-graphenelib/scripts/pricefeeds/
cp config-example.py config.py
Quote
编辑config.py
apt-get install vim
vi config.py
i

Quote
编辑如下几项
the host to "127.0.0.1" (with quotes)
and the port to 8092
添加解锁钱包密码you can either put your unlock password into unlock or manually unlock your wallet before starting the script
user和passwd是可选项unless you are an expert there is no need to put user/pw info
在producer_name里添加自己的见证人  change your name of your witness in delegate_list
ask_confirmation             = False
保存编辑
esc退出 :wq
Quote
8.5用自己的见证人ip端口(不要泄露,防止损失),进入CLI_wallet窗口,
cd ..
cd ..
cd ..
ls
cd bitshares-core

Code: [Select]
./programs/cli_wallet/cli_wallet  -s ws://127.0.0.1:8090 -H 127.0.0.1:8092正确时,显示lock。
unlock 你的密码
list_account_balances abc123可以查看下余额

Quote
8.6启动喂价程序
unlock your wallet
另开一个窗口
Code: [Select]
screen -S py
cd python-graphenelib/scripts/pricefeeds

python3 pricefeeds.py
Quote
You will be asked to provide confirmation of the prices!

出现错误:
Code: [Select]
myWitness = rpc.get_witness(config.producer_name)
  File "/root/.local/lib/python3.4/site-packages/graphenelib-0.3.9-py3.4.egg/grapheneapi/grapheneapi.py", line 160, in method
  File "/root/.local/lib/python3.4/site-packages/graphenelib-0.3.9-py3.4.egg/grapheneapi/grapheneapi.py", line 146, in rpcexec
  File "/root/.local/lib/python3.4/site-packages/graphenelib-0.3.9-py3.4.egg/grapheneapi/grapheneapi.py", line 138, in rpcexec
grapheneapi.grapheneapi.RPCError: 7 bad_cast_exception: Bad Cast
Invalid cast from array_type to string
    {"type":"array_type"}
    th_a  variant.cpp:478 as_string

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pricefeeds.py", line 605, in <module>
    update_price_feed()
  File "pricefeeds.py", line 464, in update_price_feed
    fetch_from_wallet(rpc)
  File "pricefeeds.py", line 104, in fetch_from_wallet
    producerAccount = rpc.get_account(config.producer_name)
  File "/root/.local/lib/python3.4/site-packages/graphenelib-0.3.9-py3.4.egg/grapheneapi/grapheneapi.py", line 160, in method
  File "/root/.local/lib/python3.4/site-packages/graphenelib-0.3.9-py3.4.egg/grapheneapi/grapheneapi.py", line 146, in rpcexec
  File "/root/.local/lib/python3.4/site-packages/graphenelib-0.3.9-py3.4.egg/grapheneapi/grapheneapi.py", line 138, in rpcexec
grapheneapi.grapheneapi.RPCError: 7 bad_cast_exception: Bad Cast
Invalid cast from array_type to string
    {"type":"array_type"}
    th_a  variant.cpp:478 as_string
原因是我在producer_name里填了两个见证人的名字。其中一个还没有添加到witness_node,于是删掉。程序被正常执行。
但,选择公布喂价y,后,又出现了新的问题:
Code: [Select]
"feed":{"settlement_price":{"base":{"amount":315,"asset_id":"1.3.109"},"quote":{"amount":99382,"asset_id":"1.3.0"}},"maintenance_collateral_ratio":1750,"maximum_short_squeeze_ratio":1100,"core_exchange_rate":{"base":{"amount":315,"asset_id":"1.3.109"},"quote":{"amount":94412,"asset_id":"1.3.0"}}},"extensions":[]}]],"extensions":[],"signatures":["1f3219d0ff02ddf7a3ff43854ed970245051b0ccaa4ae27eefe183f347936d50862d6fc05e45a29d4856f843dc00966686bc8114c3a9ce7619d8710c97b2912df3"]}}}]}}}}
    th_a  state.cpp:38 handle_reply
同时,cli_wallet也同时崩溃,显示同上。
明天继续
« Last Edit: July 23, 2017, 10:36:04 pm by ebit »

Offline ripplexiaoshan

  • Moderator
  • Hero Member
  • *****
  • Posts: 2145
    • View Profile
  • BitShares: xiaoshan
Re: ubuntu下安装bts2.0
« Reply #6 on: April 27, 2016, 04:46:08 am »
E神 +5% +5% +5%
BTS committee member:jademont

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #7 on: May 04, 2016, 09:18:23 am »
问题集锦

[member=18687]abit[/member] 
我想update signing key,操作如下:
Code: [Select]
update_witness abc123 "http://www.btsabc.org/" "BTS8KpYFdGQQeQ1MTrWcrA6tbS71MupkqGFbhDM7su8AnZkvv7TW1" true
{
  "ref_block_num": 13568,
  "ref_block_prefix": 216310923,
  "expiration": "2016-05-03T03:27:15",
  "operations": [[
      21,{
        "fee": {
          "amount": 146763,
          "asset_id": "1.3.0"
        },
        "witness": "1.6.65",
        "witness_account": "1.2.4952",
        "new_url": "http://www.btsabc.org/",
        "new_signing_key": "BTS8KpYFdGQQeQ1MTrWcrA6tbS71MupkqGFbhDM7su8AnZkvv7TW1"
      }
    ]
  ],
  "extensions": [],
  "signatures": [
    "1f6ce724b273d41339171c66bb2139ce1a78339fc8446f7b04984b92921180021b0764bcb195419783b49bed89b7818e66888ac212756b543dc7b6e4157ef9091c"
  ]
}
结果:还是那个signing key,浏览器里也没有发生变化:
http://cryptofresh.com/u/abc123
错在哪里?

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3136
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: ubuntu下安装bts2.0
« Reply #8 on: May 04, 2016, 09:22:59 am »
[member=20]ebit[/member] 没同步?

不过,看起来abc123的witness本来就是这个key。换个?
« Last Edit: May 04, 2016, 09:26:32 am by abit »
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #9 on: May 04, 2016, 09:47:58 am »
[member=20]ebit[/member] 没同步?

不过,看起来abc123的witness本来就是这个key。换个?
是啊,我在测试怎么在新机器上迁徙xman的那个见证人。

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3136
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: ubuntu下安装bts2.0
« Reply #10 on: May 04, 2016, 11:02:18 am »
[member=20]ebit[/member] 没同步?

不过,看起来abc123的witness本来就是这个key。换个?
是啊,我在测试怎么在新机器上迁徙xman的那个见证人。
昨天同步有问题。现在应该好了。再试试?
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline ripplexiaoshan

  • Moderator
  • Hero Member
  • *****
  • Posts: 2145
    • View Profile
  • BitShares: xiaoshan
Re: ubuntu下安装bts2.0
« Reply #11 on: May 04, 2016, 03:21:57 pm »
ebit主贴中的喂价部分好像没写完,[member=18687]abit[/member]可否补充一下呢?  先谢过了 +5%

[member=20]ebit[/member] 没同步?

不过,看起来abc123的witness本来就是这个key。换个?
是啊,我在测试怎么在新机器上迁徙xman的那个见证人。
昨天同步有问题。现在应该好了。再试试?
BTS committee member:jademont

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3136
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: ubuntu下安装bts2.0
« Reply #12 on: May 04, 2016, 03:49:02 pm »
ebit主贴中的喂价部分好像没写完,[member=18687]abit[/member]可否补充一下呢?  先谢过了 +5%

[member=20]ebit[/member] 没同步?

不过,看起来abc123的witness本来就是这个key。换个?
是啊,我在测试怎么在新机器上迁徙xman的那个见证人。
昨天同步有问题。现在应该好了。再试试?
ebit 在搞witness,应该会接着写下去的。 +5% +5%
我好久没弄都差不多忘了  :P
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #13 on: May 08, 2016, 09:22:20 am »
Quote
茄子时代  17:12:14
钱包能连上witness
喂价出错和钱包里显示的一样

ebit  17:14:51
和我一样。
一大堆东西,好像是喂价接口没找到。
茄子时代  17:17:50
。。。对   好像没找到接口
8092和8090  哪个是哪个?
有点晕
ebit  17:21:06
我理解,8090是witness的。8092是rpc-http-endpoint。可能哪里还需要设置,我不知道。

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #14 on: May 09, 2016, 09:45:54 am »
[member=18687]abit[/member]  听说你已经理顺了这个安装过程中的疏漏,能分享下么?

是要排查某个资产么?
Code: [Select]
python3 pricefeeds.py CNY 试试这样
« Last Edit: May 09, 2016, 10:00:45 am by ebit »

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3136
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: ubuntu下安装bts2.0
« Reply #15 on: May 09, 2016, 10:39:05 am »
[member=18687]abit[/member]  听说你已经理顺了这个安装过程中的疏漏,能分享下么?

是要排查某个资产么?
Code: [Select]
python3 pricefeeds.py CNY 试试这样
TCNY权限坏掉了。删掉就好了。
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline freedom

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
Re: ubuntu下安装bts2.0
« Reply #16 on: May 09, 2016, 12:35:11 pm »
谢谢a神,搞定了
E神写的全对,感谢E神

删掉tcny就可以了

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #17 on: May 19, 2016, 12:25:53 pm »
谢谢a神,谢谢极乐净土。
最后,总结一下遇到的问题。

(1)如果不是本机创建的witness,那么dump_private_keys,找到的只是active_key的私钥,而不是出块所需要的signing_key的私钥。

(2)以上两个key对不对,node一开机出现的两行地址如是。

(3)找不到signing_key怎么办?杀手锏是:suggest_brain_key 和update_witness这两条命令。
前者产生一组密钥,后者使用这组密钥更新signing_key。update_witness命令后面有个true或false的参数,后者不广播,可以用于检测。

(4)多见证人模式
改bitshares-2\witness_node_data_dir里面的config.ini
witness-id="1.6.1"
witness-id="1.6.2"
private-key=[]
private-key=[]

(5)喂价程序修改config.py
ask_confirmation             = False

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3136
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: ubuntu下安装bts2.0
« Reply #18 on: May 19, 2016, 08:13:53 pm »
谢谢a神,谢谢极乐净土。
最后,总结一下遇到的问题。

(1)如果不是本机创建的witness,那么dump_private_keys,找到的只是active_key的私钥,而不是出块所需要的signing_key的私钥。

(2)以上两个key对不对,node一开机出现的两行地址如是。

(3)找不到signing_key怎么办?杀手锏是:suggest_brain_key 和update_witness这两条命令。
前者产生一组密钥,后者使用这组密钥更新signing_key。update_witness命令后面有个true或false的参数,后者不广播,可以用于检测。

(4)多见证人模式
改bitshares-2\witness_node_data_dir里面的config.ini
witness-id="1.6.1"
witness-id="1.6.2"
private-key=[]
private-key=[]

(5)喂价程序修改config.py
ask_confirmation             = False
+5% +5% +5%
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #19 on: May 25, 2016, 01:51:07 pm »
python-graphenelib: Release 0.4
https://bitsharestalk.org/index.php/topic,22533.0.html

cd python-graphenelib
git pull
git checkout origin/master  确定位置
git submodule update    更新子模块
python3 setup.py install --user
pip install --user --upgrade graphenelib
« Last Edit: June 11, 2016, 02:07:16 am by ebit »

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #20 on: June 10, 2016, 11:32:37 pm »
Quote
alt(9351964) 6:58:41
操,又被坑了,谁喂价249的,害我2500块买高了快3个点。喂价不准的witness我取消支持了
alt(9351964) 7:03:06
xman xn-delegate harvey-xts delegate.freedom 你们喂价都有问题,我先把你们的投票取消了

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3136
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: ubuntu下安装bts2.0
« Reply #21 on: June 12, 2016, 12:10:18 am »
Quote
alt(9351964) 6:58:41
操,又被坑了,谁喂价249的,害我2500块买高了快3个点。喂价不准的witness我取消支持了
alt(9351964) 7:03:06
xman xn-delegate harvey-xts delegate.freedom 你们喂价都有问题,我先把你们的投票取消了

修改 config.py
第88行,ccedk,在最前面加 # 注释掉
第117行,ccedk,在最前面加 # 注释掉
第119行,btc38的bts/btc交易对,最前面加 # 注释掉
第120行,yunbi的bts/btc交易对,最前面加 # 注释掉
第192行,把最后面的BTC删掉,改成 bases=["CNY"]
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3136
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: ubuntu下安装bts2.0
« Reply #22 on: June 13, 2016, 09:02:15 am »
Quote
alt(9351964) 6:58:41
操,又被坑了,谁喂价249的,害我2500块买高了快3个点。喂价不准的witness我取消支持了
alt(9351964) 7:03:06
xman xn-delegate harvey-xts delegate.freedom 你们喂价都有问题,我先把你们的投票取消了

修改 config.py
第88行,ccedk,在最前面加 # 注释掉
第117行,ccedk,在最前面加 # 注释掉
第119行,btc38的bts/btc交易对,最前面加 # 注释掉
第120行,yunbi的bts/btc交易对,最前面加 # 注释掉
第192行,把最后面的BTC删掉,改成 bases=["CNY"]

喂价在BTS系统中的用途:
1. 计算爆仓触发条件,以及爆仓惩罚上限
2. 计算强制清算价格

个人认为,规则虽不完美,但基本合理。
喂价,等于见证人说:我觉得现在价格应该是多少多少。不可能每个人意见都一致,也就是说,容许有偏差。

alt所说的xeroc的喂价脚本bug,是按权重计算平均价格的原因。

xeroc脚本的喂价,等于几个交易所的 最新成交价*近期成交量*见证人自定义交易对权重,取平均值,完全是历史数据

这里有几个风险:
1. 市场深度,上面列出的几个交易对,由于长期深度低,价格偏差可能很大,要刷量也相对容易,会导致结果偏离
2. 网络问题,如果有的交易所数据取不到,导致结果偏离
3. 价格波动,可能正好在取值时,某交易所出现价格偏离,导致结果偏离
4. 汇率偏差,BTC市场按人民币、美元价格存在偏差,外汇市场时有波动,会导致多次转换时出现结果偏差
5. 更新延迟,见证人两次喂价之间有时间间隔,上次更新后,最新市场价可能已经变了,所以平均喂价有滞后效应
6. 参数设置,自定义权重是各见证人自己决定,不同人有不同看法,所以可能有不同设置。并不是非黑即白。
7. 程序BUG,未知/不详

小结:庄家要影响喂价,需要拉盘或者砸盘


alt的喂价脚本思路,是根据几个交易所的 当前挂单价格、挂单深度,以及历史成交数据加权计算,进行价格预测
(我没仔细研究,不知道是否有自定义权重等设置,也不知道汇率如何转换)

存在的风险:
1. 预测风险,历史数据及盘面数据,并不一定能确定后期走势
2. 根据历史成交数据进行负反馈计算,一定程度导致滞后效应
3. 网络问题、价格波动、更新延迟、参数设置、BUG风险等,与对xeroc脚本的分析相同

小结:庄家要影响喂价,可以拉盘或者砸盘,也可以挂单但不成交。


总结:
bts是基于信任的系统,存在系统风险,投资、决策请谨慎。
« Last Edit: June 13, 2016, 09:04:24 am by abit »
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #23 on: July 16, 2016, 01:01:36 am »
 +5%

Offline freedom

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
Re: ubuntu下安装bts2.0
« Reply #24 on: August 04, 2016, 06:29:05 am »
alt喂价安装

https://github.com/pch957/btsprice                                                                                               GITHUB
https://bitsharestalk.org/index.php/topic,20529.msg268242.html#msg268242                   论坛

代码:
pip3 install btsprice
pip3 install btsprice --upgrade
git clone https://github.com/pch957/btsprice.git
cd btsprice
python3 setup.py install --user
btsprice --config config.json

------------------------------------------
需要安装
autobahn安装0.12.1
这是btsprice的一个依赖版本过高

或者改源代码
/usr/local/lib/python3.4/dist-packages/btspusher/wamp.py

from autobahn.websocket.protocol import parseWsUr1
改成
from autobahn.websocket.util import parse_url
在把这个文件里的parseWsUrl改成parse_url
就OK了

我是改的代码
---------------------------------------------------------


建立config.json文件
地址:https://github.com/pch957/btsprice/blob/master/config.json.sample
#####################
{
    "witness": "",
    "timer_minute": 2,
    "asset_list": [
        "BTC", "SILVER", "GOLD", "TRY", "SGD", "HKD", "NZD", "CNY", "TCNY",
    "MXN", "CAD", "CHF", "AUD", "GBP", "JPY", "EUR", "USD", "KRW", "TUSD", "ARS"],
    "cli_wallet": {
        "host" : "localhost",
        "port" : 8092,
        "user" : "",
        "passwd" : "",
        "unlock" : ""
    },
    "price_limit": {
        "common": "only update price feed when the change rate is between 1% ~ 50%",
        "change_min": 1,
        "change_max": 50,
        "common": "spread bid price to price*(1+spread), ask price to price*(1-spread)",
        "common": "excute the order book, get the real price",
        "spread": 0.01,
        "common": "we use the average price in this time",
        "filter_minute": 30
    },
    "market_weight": {
        "poloniex_btc": 1,
        "yunbi_cny": 1,
        "btc38_cny": 1,
        "btc38_btc": 1,
        "bter_cny": 0
    },
    "asset_config": {
        "default": {
            "core_exchange_factor": 1.01,
            "maintenance_collateral_ratio": 1750,
            "maximum_short_squeeze_ratio": 1100
        },
        "TCNY": {"maximum_short_squeeze_ratio": 1001},
        "TUSD": {"maximum_short_squeeze_ratio": 1001}
    },
    "pusher": {
        "common": "set enable to 1, if you want to subscribe data from pusher service",
        "enable": "1",
        "user": "",
        "password": ""
    }
}
####################
注意把tcny和tusd删除掉,这个有喂价权限限制。
并修改
"witness": "",        ------------->"witness": "delegate.XXXXX",
"host" : "localhost", ------------->"host" : "127.0.0.1",
"port" : 8092,        ------------->"port" : 8095,            #这个看钱包怎么启动的端口
"unlock" : ""         ------------->"unlock" : "钱包解锁密码"
"timer_minute": 2,                   #这里是检测时间,每过2分钟检测,有变动喂价

同时,钱包要用以下启动
./programs/cli_wallet/cli_wallet -H 127.0.0.1:8095 -s ws://127.0.0.1:8090       #端口8095要对上号


-------------------
然后启动,不需要做定时任务
btsprice --config config.json


Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0
« Reply #25 on: August 04, 2016, 07:07:15 am »
详细 +5%

Offline freedom

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
Re: ubuntu下安装bts2.0 见证人
« Reply #26 on: September 05, 2016, 03:14:01 am »
补充win7 64 sever下,做WSS节点的方法。
1、注册域名:一定要留自己的邮箱,申请证书时要用到。
2、申请证书:https://buy.wosign.com/free/#ssl     A记录解析没限制。但如果域名用cname解析就用二级域名,空的主机名不能设置cname。
3、等待通过,20分钟左右,然后下载证书。
4、解压:for Apache.zip              复制证书          2_你的域名.crt   和    3_你的域名.key     2个文件到桌面上。
5、cmd
cd desktop
copy 2_你的域名.crt /b + 3_你的域名.key /b server.pem

6、复制桌面生成的server.pem到   *\BitShares 2\bin  目录下
7、修改启动的bat文件如下并保存。
cd "%~dp0
witness_node.exe --rpc-endpoint 0.0.0.0:8090 --rpc-tls-endpoint 0.0.0.0:8089 -p server.pem
8、双击bat文件启动就可以了。

访问WSS用8089端口,WS用8090端口

至于内网没有公网IP,可以用花生壳或者nat123。
« Last Edit: September 06, 2016, 02:59:34 am by freedom »

Offline ebit

  • Committee member
  • Hero Member
  • *
  • Posts: 1706
    • View Profile
    • 推荐链接
  • BitShares: ebit
Re: ubuntu下安装bts2.0 见证人
« Reply #27 on: September 06, 2016, 07:12:45 am »
 +5%
节点这么多了

国内近日已新增以下 API 服务器节点,使用网页钱包和轻钱包的可以自行添加:
● wss://bit.btsabc.org/ws (比特股中文网 @吴序强 提供)
● wss://bts.transwiser.com/ws (易转网 @巨蟹 提供)
● wss://freedom.bts123.cc:15138 (著名的黑粉 @惨 提供)
● wss://okbtc.org:8089/ws (bebtc.com 的 @郑浩 提供)
● wss://ratebts.com:8089([member=21209]AJ[/member] 提供)
● wss://openledger.hk/ws (OpenLedger 香港提供)

Offline ripplexiaoshan

  • Moderator
  • Hero Member
  • *****
  • Posts: 2145
    • View Profile
  • BitShares: xiaoshan
Re: ubuntu下安装bts2.0 见证人
« Reply #28 on: May 09, 2017, 04:54:29 pm »
转自kimziv在steemit的总结

选用备用服务器,最好换一家服务器提供商和地点,安装见证人节点,这个过程就略掉;

同步区块:
screen -S witness_node
./programs/witness_node/witness_node --replay-blockchain --rpc-endpoint=127.0.0.1:8090 #加上--replay-blockchain选项,可以降低内存

运行钱包,设置密码,解锁钱包
screen -S cli_wallet
.programs/cli_wallet/cli_wallet -s ws://127.0.0.1:8090
new>>>set_password 123456
locked >>> unlock 123456

创建sign秘钥对:

suggest_brain_key
{
"brain_priv_key": "XXXXX XXXX XXXXX XXXX",
"wif_priv_key": "5Kxxxxxxxxxxxxxxxxxxxxxxxxxxxxxkf2ure",
"pub_key": "BTSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaerwr"
}
保存秘钥对,以供后面作为signing key使用;

Ctrl+C, 重新运行witness_node(关闭和启动的时候多耐心等待)
./witness_node -s 104.200.28.117:61705 --rpc-endpoint=127.0.0.1:8090 --witness-id '"1.6.71"' --private-key '["pub_key", "wif_priv_key"]’
#将1.671换成你的见证人序列号,pub_key和wif_priv_key分别换成第4步你创建的pub_key和wif_priv_key

运行钱包,解锁,导入sigin private key和active wif key
screen -r cli_wallet
.programs/cli_wallet/cli_wallet -s ws://127.0.0.1:8090
unlocked >>> import_key “witness.yao” 5Kxxxxxxxxxxx3 true #witness.yao换成你自己的账号,5Kxxxxxxxxxxx3换称该账号的签名权限的signing key
unlocked >>> import_key “witness.yao” 5Gxxxxxxxxxxx6 true #witness.yao换成你自己的账号,5Gxxxxxxxxxxx6换称该账号的活跃权限active key

更新见证人signing key
update_witness “witness.yao” "https://bitsharestalk.org/index.php/topic,23628.0.html" "BTSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaerwr" true
#将witness.yao换成你自己的账号,https://xxx换成你自己的url,没有可以填xxx,BTSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaerwr换成你第4步创建的pub_key

过几秒钟,在你主节点cli钱包查看你自己的见证人信息,检查你的signing_key是否更新:

get_witness “witness.yao” #将witness.yao换成你自己的见证人账号
{
[...]
"id": "1.6.71",
"signing_key": "BTSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaerwr",
[...]
}
或者进入http://cryptofresh.com/查看你自己的见证人信息,检查你的signing_key是否更新
,若signing_key更新了,同时出块正常,代表你成功了。

|9. 把你主节点和备用节点的signing key都保存下来,当你的当前出块节点出现问题的时候,你就可通过第7步更新成你的另一个节点的signing key,这样你就可以避免大量丢快。
P.S. 目前在研究见证人监控脚本,后面最好做到当出块节点出现故障的时候,自动切换到备用节点,希望多多交流。
BTS committee member:jademont