LOADING...
LOADING...
LOADING...
当前位置: 玩币族首页 > 行情分析 > 手把手教你玩转YAS/EOS官方钱包cleos教程

手把手教你玩转YAS/EOS官方钱包cleos教程

2020-06-06 老王区块链 来源:区块链网络

cleos作为EOS自带的钱包,具有开源,安全性高,不用担心钱包有上传私钥的风险(电脑木马中毒除外)

首先安装cleos钱包:

linux centos安装:

#进入/opt目录

cd /opt

#下载eosio安装包

wget https://github.com/EOSIO/eos/releases/download/v2.0.5/eosio-2.0.5-1.el7.x86_64.rpm ./

#安装eosio

yum install ./eosio-2.0.5-1.el7.x86_64.rpm

linux Ubuntu安装:

#进入/opt目录

cd /opt

#下载eosio安装包

wget https://github.com/EOSIO/eos/releases/download/v2.0.5/eosio_2.0.5-1-ubuntu-18.04_amd64.deb ./

#安装eosio

apt install ./eosio_2.0.5-1-ubuntu-18.04_amd64.deb

Mac OS X 安装:

# 使用brew安装eosio

brew tap eosio/eosio

brew install eosio

以上步骤eosio安装完成后,会自带cleos钱包功能

2.创建钱包, 这里钱包名称叫mywallet,可自定义其它名称:

cleos wallet create -n mywallet --to-console

#输出如下内容,PW开头的是钱包密码,妥善保存下来,如果你没备份钱包里账号的私钥,丢失钱包密码会导致资产丢失:

Without password imported keys will not be retrievable.

PW5JVNHZJmiapNvNSZM69bGw8z8ayEkSngfCuHzVeiabPnD5SXy4C

3.打开钱包:

cleos wallet open -n mywallet

# 打开钱包后输出如下信息

Opened: mywallet

5.锁定/解锁钱包,需要步骤3中输出的密码才能解锁:

#解锁钱包

cleos wallet unlock -n mywallet --password PW5JVNHZJmiapNvNSZM69bGw8z8ayEkSngfCuHzVeiabPnD5SXy4C

#打印如下内容表示解锁成功

Unlocked: mywallet

#锁定钱包

cleos wallet lock -n mywallet

#打印如下内容表示解锁成功

Locked: mywallet

6.导入EOS账号私钥到钱包:

账号:hello.com

公钥: EOS4zEf7K8UByukZB4nBDNNPjGthHUUN9GSa3T71nD7xyv81wQhAVz

私钥: j6F2yz92sS2x39cu4icvjUYsohasf3HKASDF83sifhsdj2242324fjsf23

# 将hello.com的私钥导入钱包

cleos wallet import -n mywallet --private-key j6F2yz92sS2x39cu4icvjUYsohasf3HKASDF83sifhsdj2242324fjsf23

#打印如下内容表示导入成功

imported private key for: EOS4zEf7K8UByukZB4nBDNNPjGthHUUN9GSa3T71nD7xyv81wQhAVz

7.查看钱包内的所有账号的公钥:

#查看所有公钥

cleos wallet keys

#输出公钥列表

[

"EOS4zEf7K8UByukZB4nBDNNPjGthHUUN9GSa3T71nD7xyv81wQhAVz",

"EOSJVNHZJmiapNvNSZM69bGw8z8ayEkSngfCuHzVeiabPnD5SXy4C",

]

8.根据公钥查看EOS账号:

cleos -u https://yas.maiziqianbao.net get accounts EOS4zEf7K8UByukZB4nBDNNPjGthHUUN9GSa3T71nD7xyv81wQhAVz

#输出公钥关联的账号

{

"account_names": [

"hello.com"

]

}

9.获取钱包内所有的EOS账号私钥:

#获取所有私钥(危险操作,应防止输出记录被木马窃取)

cleos wallet private_keys -n mywallet

10.获取账号代币余额:

#获取hello.com账号的YAS余额

cleos -u https://yas.maiziqianbao.net get currency balance eosio.token hello.com YAS

#获取hello.com账号IBT余额

cleos -u https://yas.maiziqianbao.net get currency balance ibt.com hello.com IBT

11.超级节点领取节点奖励:

#假设你节点的账号为yas.bp

cleos -u https://yas.maiziqianbao.net system claimrewards yas.bp

12.转账

#用yas.io账号向hello.com转账700 YAS

cleos -u https://yas.maiziqianbao.net transfer yas.io hello.com "700.0000 YAS"

#其它代币转账, -c fobtokencode是该代币的合约账号

cleos -u https://yas.maiziqianbao.net transfer yas.io hello.com "500.0000 FOB" "备注信息" -c fobtokencode

13.创建账号

#用hello.com给公钥EOS5bFtBhkM9...创建yasyasyasyas账号,并且给yasyasyasyas账号抵押0.1YAS的CPU和NET, 购买10kb的内存

cleos -u https://yas.maiziqianbao.net system newaccount --stake-net '0.1 YAS' --stake-cpu '0.1 YAS' --buy-ram-kbytes 10 hello.com yasyasyasyas EOS5bFtBhkM9k1JjKGigsDQ9qgNPDDMrpR8UJt8ziAXBqfrFeZKti EOS5bFtBhkM9k1JjKGigsDQ9qgNPDDMrpR8UJt8ziAXBqfrFeZKti

14.抵押YAS获得CPU和NET资源

#用hello.com账号给yas.io账号抵押1YAS的NET,100YAS的CPU

cleos -u https://yas.maiziqianbao.net system delegatebw hello.com yas.io '1 YAS' '100 YAS'

14.购买内存资源

#用hello.com为yas.io购买10kb的内存

cleos -u https://yas.maiziqianbao.net system buyram hello.com yas.io -k 10 -p hello.com@active

15.更改账号权限1

#给hello.com设置eosio.code权限,有这个权限才能执行智能合约

cleos set account permission hello.com active '{"threshold":1, "keys":[{"key":"EOS5bSwmq6NgdSkbvRKD2U3ANALn8UKU359TcKEtMxeZErHCdzkJn", "weight":1}], "accounts": [{"permission":{"actor":"hello.com","permission":"eosio.code"},"weight":1}]}' -p hello.com@active

16.更改账号权限2

#把hello.com的公钥EOS5bSwmq6Ng...改为EOS5bFtBhkM9...,如果你想把账号送给别人,可以把key改为别人的公钥即可

#先修改active权限

cleos set account permission hello.com active '{"threshold":1, "keys":[{"key":"EOS5bFtBhkM9k1JjKGigsDQ9qgNPDDMrpR8UJt8ziAXBqfrFeZKti", "weight":1}], "accounts": []}' -p hello.com@active

#再修改owner权限

cleos set account permission hello.com owner '{"threshold":1, "keys":[{"key":"EOS5bFtBhkM9k1JjKGigsDQ9qgNPDDMrpR8UJt8ziAXBqfrFeZKti", "weight":1}], "accounts": []}' -p hello.com@owner

18.部署合约

#给hello.com部署合约,$pwd为当前路径,请在合约的abi和wasm文件所在目录执行下面的命令

cleos set contract hello.com $pwd

喜欢本教程的币友可以转载分享,我会继续努力编写更多对大家有用的文章,谢谢!

—-

编译者/作者:老王区块链

玩币族申明:玩币族作为开放的资讯翻译/分享平台,所提供的所有资讯仅代表作者个人观点,与玩币族平台立场无关,且不构成任何投资理财建议。文章版权归原作者所有。

LOADING...
LOADING...