EOS4.0 代币发放指南

作者: 糖果果老师 | 来源:发表于2018-05-19 01:34 被阅读18次

运行本地节点

方法1

nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::account_history_api_plugin

方法2

step1:运行nodeos,节点会创建nodeos的config.ini 文件,文件地址可能在两个地方:

 1.eos/build/etc/node_00/

 2.~/.local/share/eosio/nodeos/config/

step2: 更改config文件,然后运行nodeos,就可以正常运行。

创建合约账户

查询eosio上有没有合约

cleos get account eosio

cleos get code eosio

创建一组密钥对

创建合约账户(token)

cleos create account eosio token EOS4wZRH63Qaih87UcgxhuTRbRartjcizi8h8oCjVEjnkCaEQmfEf EOS4wZRH63Qaih87UcgxhuTRbRartjcizi8h8oCjVEjnkCaEQmfEf

创建钱包(default),并将合约账户的私钥导入钱包

cleos wallet create

cleos wallet import 5KQQLpL3wkrMqXFUy51jZ6ZQSHbHsX38w9vCecNsi4CKADN9Fvn

创建合约,并把放到区块链网络

cleos set contract token ./build/contracts/eosio.token -p token

cleos get code token

cleos push action token create '["eosio","10000000000.0000 EOS",0,0,0]' -p token

创建账户user1,user2,发放100EOS

cleos create key

cleos create account eosio user1 EOS6mQLPrpmVLhy22t9xg8qqJ4u6WyCdjFRLPRSvVhHpzbzmiQBdX EOS6mQLPrpmVLhy22t9xg8qqJ4u6WyCdjFRLPRSvVhHpzbzmiQBdX

cleos wallet import 5KhRJKeWcMSCa4GZciBvwGygTr3ZgauF4vpTTvHLVS9VLYdswn4

cleos push action token issue '[ "user1", "100.0000 EOS", "to user1" ]' -p eosio

cleos get table token user1 accounts

cleos create key

cleos create account eosio user2 EOS4wEwB3NdeStjksEeEsw4ZQERCc1y5o4ykBbFrE7TPUDYVpC4D2 EOS4wEwB3NdeStjksEeEsw4ZQERCc1y5o4ykBbFrE7TPUDYVpC4D2

cleos wallet import 5Jcafyx1gYp7RnYoJc8pQ3CnYByGPeRMRB4cQPBmkgT16dTgnCi

cleos push action token issue '[ "user2", "100.0000 EOS", "to user2" ]' -p eosio

get table token user2 accounts

user1给user2 转账

cleos push action token transfer '[ "user1", "user2", "50.0000 EOS", "user1 to user2" ]' -p user1

cleos get table token user1 accounts

cleos get table token user2 accounts

创建user3 ,user2转50给user3

cleos create key

cleos wallet import 5J6TeAZeDb6LMJKXd12kuNDHRszrkRSn7whogEB4YmzpcXHQeEr

cleos create account eosio user3 EOS7GJJ3xZXb864SPi4dEf2Xyd7f7FWTkCQvScCj7AwdTs5Qq3tZF EOS7GJJ3xZXb864SPi4dEf2Xyd7f7FWTkCQvScCj7AwdTs5Qq3tZF

cleos get table token user3 accounts

cleos push action token transfer '[ "user2", "user3", "50.0000 EOS", "user2 to user3" ]' -p user2

cleos get table token user3 accounts

查看合约和钱包个数

问题

合约部署报错

cleos set contract eosio ./eosio.bios  -p eosio 

报错:transaction took too long

解决办法:https://github.com/EOSIO/eos/issues/3150

cleos set contract eosio ./eosio.bios -x "1000" -p eosio

解锁钱包:

cleos wallet unlock -n nano --password PW5JNRAGYyxgADsvqMqA4mdraA9Hi5KZcyfHqJmC87cNc9ZcxVyNP

钱包的一些操作:

cleos wallet create -n wallet_name //创建钱包

cleos wallet import -n wallet_name key //导入私匙

cleos wallet open -n wallet_name // 打开指定名字的钱包

cleos wallet unlock -n wallet_name --password password //锁定钱包 

cleso wallet lock_all //锁定所有钱包

cleos wallet lock -n wallet_name//锁定钱包

cleos create key  //创建密钥对

注:本教程使用的是4.0版本

相关文章

网友评论

    本文标题:EOS4.0 代币发放指南

    本文链接:https://www.haomeiwen.com/subject/nkxodftx.html