1
votes

So, first of all, I made a post request "get_info" to check the last irreversible block: here is a screenshot

then I checked info about this block by "get_block" post request: here is a screenshot

and then I tried to create "push_transaction" by post request: here is a screenshot

And as you can see, there is the error. So, how to do this correctly? Sorry for my English:)

1

1 Answers

1
votes

Before you push a transaction you first need to sign it. To do so you'll need to assemble your transaction object like so:

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

Then call the abi_json_to_bin endpoint with the above payload which will return a json object like this:

{
    "binargs": "0000000000ea305500000000487a2b9d102700000000000004454f53000000001163726561746564206279206e6f70726f6d"
}

With that you can construct your push_transaction object, it'll look something like this:

{
    "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"]
}

You can read more in-depth about it here.