【问题标题】:How to push transaction in EOS?如何在 EOS 中推送交易?
【发布时间】:2018-12-27 15:56:56
【问题描述】:

所以,首先,我发了一个帖子请求“get_info”来检查最后一个不可逆块:here is a screenshot

然后我通过“get_block”发布请求检查了有关此块的信息:here is a screenshot

然后我尝试通过 post 请求创建“push_transaction”:here is a screenshot

如您所见,存在错误。 那么,如何正确地做到这一点呢? 对不起我的英语:)

【问题讨论】:

    标签: request blockchain eos


    【解决方案1】:

    在推送交易之前,您首先需要对其进行签名。为此,您需要像这样组装您的事务对象:

    {
      "code": "eosio.token",
      "action": "transfer",
      "args": {
        "from": "fromaccount",
        "to": "toaccount",
        "quantity": "1.0000 EOS",
        "memo": "memo"
      }
    }
    

    然后使用上述负载调用abi_json_to_bin 端点,它将返回一个像这样的 json 对象:

    {
        "binargs": "0000000000ea305500000000487a2b9d102700000000000004454f53000000001163726561746564206279206e6f70726f6d"
    }
    

    你可以构造你的push_transaction对象,它看起来像这样:

    {
        "compression": "none",
        "transaction": {
            "expiration": "2018-08-01T06:11:23",
            "ref_block_num": 10855,
            "ref_block_prefix": 473148127,
            "max_net_usage_words": 0,
            "max_cpu_usage_ms": 0,
            "delay_sec": 0,
            "context_free_actions": [],
            "actions": [{
                "account": "eosio.token",
                "name": "transfer",
                "authorization": [{
                    "actor": "fromaccount",
                    "permission": "active"
                }],
                "data": "0000000000ea305500000000487a2b9d102700000000000004454f53000000001163726561746564206279206e6f70726f6d"
            }],
            "transaction_extensions": [],
            "signatures": null,
            "context_free_data": []
        },
        "signatures": ["SIG_K1_JwLVG5pRdhvLfJGWkDEBPa7wdLbNeqeRFdvFrKDEryahSwCRpPb75m4auZh8frq6cXsm3dHit8GMbmuuBWxEjH"]
    }
    

    您可以更深入地阅读它here.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-31
      • 2019-08-02
      • 2020-01-17
      • 2020-09-30
      • 2018-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多