eos:智能合约

1. 创建钱包

$ cleos wallet create --to-console
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5JuBXoXJ8JHiCTXf...."

2. 钱包解锁、上锁

$ cleos wallet unlock
password:
cleos wallet lock
Locked: default

 3. 导入私钥到钱包

$ cleos wallet import --private-key 5KQw......
imported private key for: EOS6MRy....

4. 创建账号

$ cleos create key --to-console
Private key: 5Jmsawgs...
Public key: EOS7ijWC...
$ cleos wallet import --private-key 5Jmsawgsp1t....
imported private key for: EOS7i...
$ cleos create account eosio user EOS7ijWC.... EOS7i.....
executed transaction: 8aedb926cc1ca31642ada8daf4350833c95cbe98b869230f44da76d70f6d6242  364 bytes  1000 cycles
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"user","owner":{"threshold":1,"keys":[{"key":"EOS7ijWCBmoXBi3CgtK7DJxentZZ...

$ cleos create account eosio tester EOS7ijWCB... EOS7ijW....
executed transaction: 414cf0dc7740d22474992779b2416b0eabdbc91522c16521307dd682051af083 366 bytes  1000 cycles
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"tester","owner":{"threshold":1,"keys":[{"key":"EOS7ijWCBmoXBi3CgtK7DJxentZZ...

5. 编译合约(EOS笔记四 合约工具eosio.cdt使用(转载):https://www.jianshu.com/p/f2f58eafa595

    a. 安装(https://github.com/EOSIO/eosio.cdt)

    $ wget https://github.com/eosio/eosio.cdt/releases/download/v1.4.1/eosio.cdt-1.4.1.x86_64.deb
    $ sudo apt install ./eosio.cdt-1.4.1.x86_64.deb

     b. 编译

// 1 在手动变异wasm文件的同时加上--abigen flag可以同时编译abi文件
$ eosio-cpp hello.cpp -o hello.wasm --abigen

6. 部署合约

$ cleos set contract eosio contracts/eosio.bios -p eosio@active
Reading WAST...
Assembling WASM...
Publishing contract...
executed transaction: 414cf0dc7740d22474992779b2416b0eabdbc91522c16521307dd682051af083  4068 bytes  10000 cycles
#         eosio <= eosio::setcode               {"account":"eosio","vmtype":0,"vmversion":0,"code":"0061736d0100000001ab011960037f7e7f0060057f7e7e7e...
#         eosio <= eosio::setabi                {"account":"eosio","abi":{"types":[],"structs":[{"name":"set_account_limits","base":"","fields":[{"n...

 7. 执行合约

# cleos push action eosio.token create '{"issuer":"eosio", "maximum_supply":"1000000000.0000 EOS", "can_freeze":0, "can_recall":0, "can_whitelist":0}' -j -p eosio.token

猜你喜欢

转载自blog.csdn.net/lzt20007/article/details/84789077
今日推荐