EOS · 2018年9月18日 0

EOS常用及部分特殊命令

cleos

导入密钥
$ cleos wallet import -n walletname --private-key 5J9RKG4wskhXHt2mf4wwLxV2wC516iES6NMfbk3aph81DHjLhVz
创建密钥
$ cleos create key --to-console
解锁钱包
$ cleos wallet unlock -n nm1024 --password PW5KC4AVeEspMmMQYYr3JNcejsWuBX5pnsSJtsQayGF9BkaeJLhRL
创建账号
$ cleos create account eosio NEW_ACCOUNT OWNER_KEY ACTIVE_KEY
# 如果部署了eosio.system合约
$ cleos  system newaccount eosio  accountname --transfer  EOS57zTJCWoA6viGYi6y8mUKjfatSFZHxwVFmLdWoXpKDEC2Rx9GR EOS57zTJCWoA6viGYi6y8mUKjfatSFZHxwVFmLdWoXpKDEC2Rx9GR --stake-net '50.00 CYB' --stake-cpu '50.00 CYB' --buy-ram '10.0000 CYB'
部署合约
$ cleos set contract eosio.bios build/contracts/eosio.bios -p eosio.bios@active
调用eosio.bios合约将一个节点注册为区块生产者

注意这里使用的是eosio.bios合约,不是eosio.system

$ cleos push action eosio setprods '{"schedule":[{"producer_name":"cy","block_signing_key":"EOS7YUNnXBjwHZuhguDR9EReZgY3Nzwh5Tg3qzVauFpWgsVy1waHs"}]}' -p eosio@active
创建docker-cleos快捷方式
$ alias cleos='docker exec -it nodeos1 /opt/eosio/bin/cleos --url http://127.0.0.1:8888 --wallet-url http://172.18.0.3:8900'
启用账号特权
$ cleos push action eosio setpriv '["eosio.msig", 1]' -p eosio
修改账户权限
$ cleos set account permission test active '{"threshold":1,"keys":[{"key":"EOS8GiaKRYjJbQMU1huyoJgYRejznn9pLzaCiBULSryYTSuRVLCH8","weight":1}],"accounts":[{"permission":{"actor":"test","permission":"eosio.code"},"weight":1}],"waits":[]}' owner -p test

eosiocpp

通过cpp生成wast与abi
$ eosiocpp -o digital_asset.wast digital_asset.cpp
$ eosiocpp -g digital_asset.abi digital_asset.cpp
token创建、派发、转账
# 创建
$ cleos push action eosio.token create '[ "eosio", "1000000000.0000 CYB"]' -p eosio.token@active
# 派发
$ cleos push action eosio.token issue '[ "nmaccount", "100.0000 CYB", "memo" ]' -p eosio@active
# 转账
$ cleos push action eosio.token transfer '[ "nmaccount", "user", "50.0000 CYB", "m" ]' -p nmaccount@active

docker

创建nodeos容器
$ docker run --name nodeos2 -d -p 8899:8899 --network eosdev --ip 172.18.0.5
-v /opt/eosio2/work:/work -v /opt/eosio2/data:/mnt/dev/data 
-v /opt/eosio2/config:/mnt/dev/config eosio/eos-dev  
/bin/bash -c "nodeos -e -p eosio -d /mnt/dev/data --config-dir /mnt/dev/config"
创建keosd容器
$ docker run -d --name keosd --network=eosdev --ip 172.18.0.8 -i eosio/eos-dev /bin/bash -c "keosd --http-server-address=0.0.0.0:8000"
dockers网络
# 创建网络
$ docker network create eosdev
# 网络使用情况
$ docker network inspect eosdev

.
.
.
.
.
.
.
【本文章出自NM1024.com,转载请注明作者出处。】






>>转载请注明原文链接地址:EOS常用及部分特殊命令