EOS 智能合约 发行货币

今天EOS的WIKI更新了,就试着用mater跑了一下智能合约的流程。

虽然遇到了几个坑,还是跑通了。

下面主要说一些,和318区别的地方

在 ./cloes get account currency的时候

318版本是这样的:

{
  "account_name": "currency",
  "eos_balance": "0.0000 EOS",
  "staked_balance": "0.0001 EOS",
  "unstaking_balance": "0.0000 EOS",
  "last_unstaking_time": "2035-10-29T06:32:22",
...

master版本,是没有balance几个变量的,不过不影响后续操作,大概下面这个样子:

{
  "account_name": "currency",
  "last_unstaking_time": "2035-10-29T06:32:22",
...

然后就是发币的环节,要先创造货币,这一步,之前版本是没有的

cleos push action currency create '{"issuer":"currency", "maximum_supply": "1000000000.0000 CUR", "can_freeze": 1, "can_recall": 1, "can_whitelist": 1}' -p currency@active

然后在发行货币

./cleos push action currency issue '{"to":"currency","quantity":"1000.0000 CUR","memo":""}' --permission currency@active

还有一个坑,就是获取账号信息的时候,这里文档写的是这个样子的

./cleos get table currency currency account
{
  "rows": [{
     "currency": 1381319428,
     "balance": 10000000
     }
  ],
  "more": false
}

而实际操作是这样子的:

feng@feng-B250-HD3P:~/workSpace/eos/build/programs/cleos$ ./cleos get table currency currency accounts
{
  "rows": [{
      "balance": "1000.0000 CUR",
      "frozen": 0,
      "whitelist": 1
    }
  ],
  "more": false
}

区别在哪里呢!??就是他把account换成了accounts,多了一个s!

下面就是正常操作了,转账显示

feng@feng-B250-HD3P:~/workSpace/eos/build/programs/cleos$ ./cleos push action currency transfer '{"from":"currency","to":"eosio","quantity":"20.0000 CUR","memo":"my first transfer"}' --permission currency@active
3158719ms thread-0   main.cpp:964                  operator()           ] Converting argument to binary...
{
  "transaction_id": "018a3451547687c496eba8f6df39b6c8416fa15e1b2567eecafe2fc5c6181941",
  "processed": {
    "status": "executed",
    "id": "018a3451547687c496eba8f6df39b6c8416fa15e1b2567eecafe2fc5c6181941",
    "action_traces": [{
        "receiver": "currency",
        "act": {
          "account": "currency",
          "name": "transfer",
          "authorization": [{
              "actor": "currency",
              "permission": "active"
            }
          ],
          "data": {
            "from": "currency",
            "to": "eosio",
            "quantity": "20.0000 CUR",
            "memo": "my first transfer"
          },
          "hex_data": "0000001e4d75af460000000000ea3055400d0300000000000443555200000000116d79206669727374207472616e73666572"
        },
        "console": "transfer\n",
        "region_id": 0,
        "cycle_index": 1,
        "data_access": [{
            "type": "write",
            "code": "currency",
            "scope": "currency",
            "sequence": 2
          },{
            "type": "write",
            "code": "currency",
            "scope": "eosio",
            "sequence": 0
          },{
            "type": "read",
            "code": "currency",
            "scope": "........edeo3",
            "sequence": 2
          }
        ]
      },{
        "receiver": "eosio",
        "act": {
          "account": "currency",
          "name": "transfer",
          "authorization": [{
              "actor": "currency",
              "permission": "active"
            }
          ],
          "data": {
            "from": "currency",
            "to": "eosio",
            "quantity": "20.0000 CUR",
            "memo": "my first transfer"
          },
          "hex_data": "0000001e4d75af460000000000ea3055400d0300000000000443555200000000116d79206669727374207472616e73666572"
        },
        "console": "",
        "region_id": 0,
        "cycle_index": 1,
        "data_access": []
      }
    ],
    "deferred_transaction_requests": []
  }
}

获取信息的时候要注意eosio的位置。。

feng@feng-B250-HD3P:~/workSpace/eos/build/programs/cleos$ ./cleos get table currency currency accounts
{
  "rows": [{
      "balance": "980.0000 CUR",
      "frozen": 0,
      "whitelist": 1
    }
  ],
  "more": false
}
feng@feng-B250-HD3P:~/workSpace/eos/build/programs/cleos$ ./cleos get table currency eosio accounts
{
  "rows": [{
      "balance": "20.0000 CUR",
      "frozen": 0,
      "whitelist": 1
    }
  ],
  "more": false
}
EOS区块链qq群,欢迎大家多多技术交流:695283188

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值