1)安裝
1.1) 安裝VMware
1.2) 在VMware上創(chuàng)建Ubuntu17.10(64bit)的鏡像(目前17.xx版本比較穩(wěn)定),今后根據(jù)情況追加 ?
根據(jù)EOS3.0 的要求注意選擇以下spec:?
_CPU X 2 ?
_Memory 虛擬內(nèi)存 8G?
_虛擬硬盤? 40G?
?網(wǎng)絡(luò)模式選擇NAT侣颂,這樣就可以用主機(jī)的IP地址,直接可以access internet
1.3) 從git 下載EOS source: ?
git clone https://github.com/eosio/eos --recursive?
1.4) 編譯:?
cd eos?
./eosio_build.sh?
?到此為止比較順利中符。
2) 單節(jié)點(diǎn)啟動(dòng):?
cd ~/build/programs/nodeos
./nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::account_history_api_plugin?
此處如果出現(xiàn)?database dirty flag set (likely due to unclean shutdown) replay or resync required 的錯(cuò)誤配阵,加上 --resync-blockchain 參數(shù)
./nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::account_history_api_plugin --resync-blockchain
此處平均1ms 出2-3個(gè)塊,一個(gè)塊包含500交易(目前沒有交易記錄)钦勘,因此計(jì)算下來1000TPS
3) 單機(jī)多節(jié)點(diǎn)模式:
在~/opt 目錄下創(chuàng)建
cd ~/opt?
mkdir mainnode?
cd mainnode?
cp ~/build/programs/nodeos/nodeos/config/.? .?
(config.ini and genesis.json)?
vi config.ini?
change:?
enable-stale-production = true? (original: false)?
啟動(dòng)出塊節(jié)點(diǎn):
nohup nodeos -d ~/eos.data/producer_node --config-dir ~/eos.data/producer_node -l ~/eos.data/logging.json --http-server-address "" -p eosio -e > bpnode.log &? ?
啟動(dòng)非出塊節(jié)點(diǎn): ?
nohup nodeos -d ~/eos.data/generator_node --config-dir ~/eos.data/generator_node -l ~/eos.data/logging.json --plugin eosio::txn_test_gen_plugin --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --p2p-peer-address localhost:9876 --p2p-listen-endpoint localhost:5555 > nonbp.log &?
*啟動(dòng)后臺(tái)運(yùn)行模式
加圖對(duì)比一下不出塊的節(jié)點(diǎn)日志:?
加載智能合約:?
cleos wallet create ?
如果錢包創(chuàng)建之后沒有保存Key陋葡,用此命令查詢: ?
cleos wallet keys
cleos set contract eosio ~/eos/build/contracts/eosio.bios/ ?
初始化txn_test_gen_plugin插件?
curl --data-binary '["eosio", "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]' http://localhost:8888/v1/txn_test_gen/create_test_accounts?
運(yùn)行命令,施加壓力?
curl --data-binary '["", 20, 20]' http://localhost:8888/v1/txn_test_gen/start_generation?
top查看CPU運(yùn)行:
其中个盆,為了查看CPU脖岛, 安裝glances:?
結(jié)論: 單機(jī)版和官方文檔介紹基本一致,在1000TPS左右颊亮。