您正在查看: EOS-新手教程 分类下的文章

零基础EOS 节点部署,BP出块(三)-->开始部署

1.进入eosio主机终端

//eosio节点创建钱包
cleos wallet create
//保存解锁密钥
PW5K2Rg4rSYanfdcjnMcPhLUKZoBd2rq1W9mDZSoebgmKG55JXugU
//导入eosio帐号私钥
cleos wallet import 5KeqsXty9Sa8GfJgNfkckYxKKGcAWE4AWmUHiw6ifDcn3jjUg2i
//创建 eosio.token
cleos create account eosio eosio.token EOS5M2sNqDPZtQoBcRMnPQEnY1MJaVtdWWPx7A3UpcLgtzdLusFVW EOS5M2sNqDPZtQoBcRMnPQEnY1MJaVtdWWPx7A3UpcLgtzdLusFVW
//导入eosio.token私钥
cleos wallet import 5JvL5wbJeQdgpKDDLRFUyWmHwBpRDgvARn99cS4pXoxZt8p7p4w
//创建系统预留账户
cleos create account eosio eosio.bpay EOS5iezVa6bsmvZ3HNxdqgyX6GFRMWzE7FsjS3cui8Foavxnj8CfR EOS5iezVa6bsmvZ3HNxdqgyX6GFRMWzE7FsjS3cui8Foavxnj8CfR
cleos create account eosio eosio.msig EOS8K1wkfCzPmxAjjfqvqw6zQ1Dbc82YsQyR8MmwNFLcRHcJtth89 EOS8K1wkfCzPmxAjjfqvqw6zQ1Dbc82YsQyR8MmwNFLcRHcJtth89
cleos create account eosio eosio.names EOS5ps938c5zj6UqhdCfssyAy7WSbHgfZoraqD6HrnbpmpEwPwX7S EOS5ps938c5zj6UqhdCfssyAy7WSbHgfZoraqD6HrnbpmpEwPwX7S
cleos create account eosio eosio.ram EOS7DA8jGA6HfZXYcGSGJNsWJL5Q6t5bWcvm4zNykN3Jw7tASzBCR EOS7DA8jGA6HfZXYcGSGJNsWJL5Q6t5bWcvm4zNykN3Jw7tASzBCR
cleos create account eosio eosio.ramfee EOS7R1Ds4zLMPN6onVXjL8XGgKHHCMWjLT7wn3bHcHnQX3dVLErjE EOS7R1Ds4zLMPN6onVXjL8XGgKHHCMWjLT7wn3bHcHnQX3dVLErjE
cleos create account eosio eosio.saving EOS4uDMpca1dAK7HZZRQ1SqWZHvJNnakzsSuTmM12crvzwRorwQcQ EOS4uDMpca1dAK7HZZRQ1SqWZHvJNnakzsSuTmM12crvzwRorwQcQ
cleos create account eosio eosio.stake EOS6BDfFaFZgvx889BQbdaGTMYSn5tUuxaynGQDhpDGD662eBGwkF EOS6BDfFaFZgvx889BQbdaGTMYSn5tUuxaynGQDhpDGD662eBGwkF
cleos create account eosio eosio.upay EOS7zS7sHctU54oD6is2oPfq11duCMSWfda3HXJAghSfqqr2BZZnV EOS7zS7sHctU54oD6is2oPfq11duCMSWfda3HXJAghSfqqr2BZZnV
//切换到contracts目录
cd /eos/build/contracts
//部署eosio.token合约
cleos set contract eosio.token eosio.token
//创建代币 (BM将线上代码EOS 改成了SYS,之后上线后还是EOS)
cleos push action eosio.token create '["eosio","10000000000.0000 SYS",0,0,0]' -p eosio.token
//发布代币
cleos push action eosio.token issue '["eosio","10000000000.0000 SYS","issue"]' -p eosio
//查询代币数量
cleos get currency balance eosio.token eosio
//部署eosio.bios合约
cleos set contract eosio eosio.bios/ -p eosio
//部署eosio.system合约
cleos set contract eosio eosio.system -p eosio
//创建BP节点账户
cleos system newaccount eosio eosio.bp1 EOS7mcXeVUSLCZxEf8eBPm2MbmiswNovoB6rk71pPqaZoxwSAeK7b EOS7mcXeVUSLCZxEf8eBPm2MbmiswNovoB6rk71pPqaZoxwSAeK7b  --stake-net '50.00 SYS' --stake-cpu '50.00 SYS'  --buy-ram-kbytes 10000
cleos system newaccount eosio eosio.bp2 EOS6hfh1yup4tZjbjhD3oPuZwMFqL4iUVehgMsukuvx5ojTWuurtT EOS6hfh1yup4tZjbjhD3oPuZwMFqL4iUVehgMsukuvx5ojTWuurtT  --stake-net '50.00 SYS' --stake-cpu '50.00 SYS'  --buy-ram-kbytes 10000

//创建Voter账户
cleos system newaccount eosio voter1 EOS6wLrhcEQDZJvfZSCgVkFzsKcv34XTsTTjXXQZajWaBbEhvLPMg  EOS6wLrhcEQDZJvfZSCgVkFzsKcv34XTsTTjXXQZajWaBbEhvLPMg  --stake-net '50.00 SYS' --stake-cpu '50.00 SYS'  --buy-ram-kbytes 10000
cleos system newaccount eosio voter2 EOS6u8i7rknHyAd7AdziWSnEsAbyJHA3U9So4R8p2z58cA1KeEDv2  EOS6u8i7rknHyAd7AdziWSnEsAbyJHA3U9So4R8p2z58cA1KeEDv2  --stake-net '50.00 SYS' --stake-cpu '50.00 SYS'  --buy-ram-kbytes 10000
cleos system newaccount eosio voter3 EOS8LyieKTsMAZGp7DSEhBPEPmPXvQKT5c3EXgEvACcdRwwRwDzoy  EOS8LyieKTsMAZGp7DSEhBPEPmPXvQKT5c3EXgEvACcdRwwRwDzoy  --stake-net '50.00 SYS' --stake-cpu '50.00 SYS'  --buy-ram-kbytes 10000
//导入Voter私钥
cleos wallet import 5Jb2DtzYFU9c3LSEP5PPAfN7Je8d8yLGdDN42n561zy34UFwzTN
cleos wallet import 5JsFet6W3Xmp3DvcHJsJ6GVcksSZJunGhmjpQaE9Np2ZtK4JYbc
cleos wallet import 5JdQRPPCXtVLKBj5qhg6QtVq5PHuKoKnrcpePG6CsryPuYkiWX6

//给Voter账户转账
cleos push action eosio.token transfer '["eosio", "voter1","100000000.0000 SYS","vote"]' -p eosio
cleos push action eosio.token transfer '["eosio", "voter2","100000000.0000 SYS","vote"]' -p eosio
cleos push action eosio.token transfer '["eosio", "voter3","100000000.0000 SYS","vote"]' -p eosio
//锁定Voter账户需要投票的代币
cleos system delegatebw voter1 voter2 '25000000.0000 SYS' '25000000.0000 SYS' --transfer
cleos system delegatebw voter2 voter3 '25000000.0000 SYS' '25000000.0000 SYS' --transfer
cleos system delegatebw voter3 voter1 '25000000.0000 SYS' '25000000.0000 SYS' --transfer

2.进入eosio.bp1 主机终端

//BP1节点创建钱包
cleos wallet create
//保存解锁密钥
PW5HsYdyQdQfTgHJnpaiGRjFVDLs7Cb48A6PzeneaDNdSf8UnrntT
//导入私钥
cleos wallet import 5JzWCZ9W7VNWLYroQpjYG2z6H6UjJUkKdinZpumf6Ru2xoxSrKT
//BP1节点申请BP
cleos system regproducer eosio.bp1 EOS7mcXeVUSLCZxEf8eBPm2MbmiswNovoB6rk71pPqaZoxwSAeK7b http://eosio.bp1.ip:8888

3.进入eosio.bp2 主机终端

//BP2节点创建钱包
cleos wallet create
//保存私钥
PW5JaB4WtawXWE6wmDymsprEdh9xPiL5EakY83JDywdvpFbK9fWpG
//导入私钥
cleos wallet import 5HragVTsSmmAg1mznNMDSeAp2ZezcNBw6SbczrNpNtUqRcx4vhh
//BP2申请BP
cleos system regproducer eosio.bp2 EOS6hfh1yup4tZjbjhD3oPuZwMFqL4iUVehgMsukuvx5ojTWuurtT http://eosio.bp2.ip:8888

4.回到eosio主机终端

//BP节点申请BP
cleos system regproducer eosio EOS5DkKbBZnSKNSV1iu27ovnygGhoCA99eH69KyNNkSkNrrbBoiRe http://eosio.eosio.ip:8888

//开始投票
cleos system voteproducer prods voter1 eosio.bp1
cleos system voteproducer prods voter2 eosio.bp1
cleos system voteproducer prods voter3 eosio.bp1
cleos system voteproducer prods voter1 eosio.bp2
cleos system voteproducer prods voter2 eosio.bp2
cleos system voteproducer prods voter3 eosio.bp2

cleos system voteproducer prods voter1 eosio
cleos system voteproducer prods voter2 eosio
cleos system voteproducer prods voter3 eosio

此时 eosio, eosio.bp1, eosio.bp2 已出块

零基础EOS 节点部署,BP出块(二)-->节点连接

1.进入eosio主机终端,

cd ~/.local/share/eosio/nodeos/config
//编辑配置文件
vi config.ini
//修改p2p-server-address 为本机ip
p2p-server-address = 192.168.1.116:9876
//修改初始化创世块
enable-stale-production = true
//修改producer-name 为eosio(创世节点必须此名)
producer-name = eosio
//修改key
private-key = ["EOS5DkKbBZnSKNSV1iu27ovnygGhoCA99eH69KyNNkSkNrrbBoiRe","5KeqsXty9Sa8GfJgNfkckYxKKGcAWE4AWmUHiw6ifDcn3jjUg2i"]
//添加插件支持
plugin = eosio::producer_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::wallet_api_plugin
#plugin = eosio::account_history_api_plugin
plugin = eosio::http_plugin

2.进入 eosio.bp1主机终端

cd ~/.local/share/eosio/nodeos/config
//编辑配置文件
vi config.ini
//修改p2p-server-address 为本机ip
p2p-server-address = 192.168.1.116:9876
//p2p-peer-address 添加 eosio和eosio.bp2 ip
p2p-peer-address = 192.168.1.112:9876
p2p-peer-address = 192.168.1.168:9876
//修改 producer-name
producer-name = eosio.bp1
//修改 key
private-key = ["EOS6hfh1yup4tZjbjhD3oPuZwMFqL4iUVehgMsukuvx5ojTWuurtT","5HragVTsSmmAg1mznNMDSeAp2ZezcNBw6SbczrNpNtUqRcx4vhh"]
//添加插件支持
plugin = eosio::chain_api_plugin
plugin = eosio::chain_plugin
plugin = eosio::producer_plugin
plugin = eosio::http_plugin
plugin = eosio::net_api_plugin
plugin = eosio::net_plugin
plugin = eosio::wallet_api_plugin
plugin = eosio::history_api_plugin

3.进入eosio.bp2主机终端 同2

//注意修改 config.ini
//p2p-peer-address 添加 eosio和eosio.bp1 ip

EOS 节点部署,BP出块(三)-->开始部署

EOS 在Ubuntu 16.04 编译及安装

  1. 获取EOS代码 `git clone https://github.com/eosio/eos --recursive`

  2. 更新子模块  `git submodule update --init --recursive`

  3. 执行sh 自动安装 `cd eos`  `./eosio_build.sh`

       安装会先自动判断系统硬件是否符合安装条件及系统版本是否支持。

       漫长等待,半小时左右,网络不好的话,40 - 50分钟。

       编译完成后 `cd eos/build`  执行 `sudo make install` 否则会提示各种程序无法找到问题


常见问题

  1. eos fatal: destination path ‘llvm’ already exists and is not an empty directory