EOS应该是最火的区块链项目之一,同样EOS币也是成交最活跃的币种之一,一直关注却没真正去了解EOS,近期又看到不少说RAM的,虽然迟钝了一点,那也赶紧了解一下吧!
下载代码
先下载代码,大概有几百M,慢慢等吧。
git clone https://github.com/EOSIO/eos --recursive
更新
Chaim:workspace Chaim$ cd eos
Chaim:eos Chaim$ git submodule update --init --recursive
编译安装
EOS的编译安装提供了4种方式:Autobuild Script、Docker、Manual Build、Install Executables,我选择一个最简单的方式:Autobuild Script
Chaim:eos Chaim$ ./eosio_build.sh
Autobuild时会检测依赖项,如果有需要安装的包会提示是否安装,选择“1)Yes”,会自动下载安装。
Do you wish to install these packages?
1) Yes
2) No
#? 1
执行完后发现并没有build目录,看来并没有成功安装,重新执行eosio_build.sh,提示要安装Boost1.67,但安装中有错误:
==> Downloading https://homebrew.bintray.com/bottles/boost-1.67.0_1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring boost-1.67.0_1.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/boost/accumulators/accumulators.hpp
Target /usr/local/include/boost/accumulators/accumulators.hpp
already exists. You may want to remove it:
rm '/usr/local/include/boost/accumulators/accumulators.hpp'
To force the link and overwrite all conflicting files:
brew link --overwrite boost
To list all files that would be deleted:
brew link --overwrite --dry-run boost
强制link提示不可写:
(env3) Chaim:eos Chaim$ brew link --overwrite boost
Linking /usr/local/Cellar/boost/1.67.0_1...
Error: Could not symlink include/boost/algorithm/cxx14/equal.hpp
/usr/local/include/boost/algorithm/cxx14 is not writable.
把boost目录全改成可写试试:
(env3) Chaim:eos Chaim$ sudo chmod -R a+w /usr/local/include/boost/
(env3) Chaim:eos Chaim$ brew link --overwrite boost
Linking /usr/local/Cellar/boost/1.67.0_1... 13070 symlinks created
可以编译了,编译时间比较长,还是蹦出一错误,如下:
CMake Error at libraries/wasm-jit/Source/Runtime/CMakeLists.txt:26 (find_package):
Could not find a package configuration file provided by "LLVM" (requested
version 4.0) with any of the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.
用brew install llvm装的是6.0.0版本,还是同样的错误,要llvm4.0这有点坑啊!
这个问题的解决方案如下:
export LLVM_DIR=/usr/local/Cellar/llvm\@4/4.0.1/lib/cmake
继续执行编译安装,这次成功了,显示红色的"EOSIO"如下:
[100%] Built target unit_test
_______ _______ _______ _________ _______
( ____ \( ___ )( ____ \\__ __/( ___ )
| ( \/| ( ) || ( \/ ) ( | ( ) |
| (__ | | | || (_____ | | | | | |
| __) | | | |(_____ ) | | | | | |
| ( | | | | ) | | | | | | |
| (____/\| (___) |/\____) |___) (___| (___) |
(_______/(_______)\_______)\_______/(_______)
EOSIO has been successfully built. 00:08:29
To verify your installation run the following commands:
/usr/local/bin/mongod -f /usr/local/etc/mongod.conf &
cd /Users/Chaim/Documents/workspace/eos/build; make test
For more information:
EOSIO website: https://eos.io
EOSIO Telegram channel @ https://t.me/EOSProject
EOSIO resources: https://eos.io/resources/
EOSIO Stack Exchange: https://eosio.stackexchange.com
EOSIO wiki: https://github.com/EOSIO/eos/wiki
除了卡在llvm那一会,没有去配置过多的环境,总的来说这种方式安装还算是比较简单。
运行
cleos是EOS的命令行工具,有以下OPTIONS、SUBCOMMAND:
Usage: ./cleos [OPTIONS] SUBCOMMAND
Options:
-h,--help Print this help message and exit
-u,--url TEXT=http://localhost:8888/
the http/https URL where nodeos is running
--wallet-url TEXT=http://localhost:8900/
the http/https URL where keosd is running
-r,--header pass specific HTTP header; repeat this option to pass multiple headers
-n,--no-verify don't verify peer certificate when using HTTPS
-v,--verbose output verbose actions on error
--print-request print HTTP request to STDERR
--print-response print HTTP response to STDERR
Subcommands:
version Retrieve version information
create Create various items, on and off the blockchain
get Retrieve various items and information from the blockchain
set Set or update blockchain state
transfer Transfer EOS from account to account
net Interact with local p2p network connections
wallet Interact with local wallet
sign Sign a transaction
push Push arbitrary transactions to the blockchain
multisig Multisig contract commands
system Send eosio.system contract action to the blockchain.
区别于Bitshares、Steem、Yoyo的命令行工具,EOSIO使用子命令的方式,对于用惯了其它cli_wallet的人来说这种方式并不是很习惯。
没硬盘空间了,不想再运行节点了,直接找公共的节点运行一下命令:
(env3) Chaim:cleos Chaim$ ./cleos -u https://api.helloeos.com.cn/ get info
{
"server_version": "b195012b",
"chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
"head_block_num": 3906822,
"last_irreversible_block_num": 3906493,
"last_irreversible_block_id": "003b9bbda0075fa4f716a48f5432b8bf3a021b4c37386096c5314de1f4170494",
"head_block_id": "003b9d066db6d1d1c4d2b1c34ea686f5e30b927de39c30ecf1475152ba0af5af",
"head_block_time": "2018-07-03T07:02:02.000",
"head_block_producer": "cypherglasss",
"virtual_block_cpu_limit": 200000000,
"virtual_block_net_limit": 1048576000,
"block_cpu_limit": 199900,
"block_net_limit": 1048576
}
再发几个可用公共节点,别像我一样编译完了都不知道去连哪测试:-(
- https://eos.greymass.com
- https://api.cypherglass.com
- https://publicapi-mainnet.eosauthority.com
- https://mainnet.eoscanada.com
- http://mainnet.eoswz.com
参考
https://github.com/EOSIO/eos/issues/2998