4

In bitcoin and ethereum blockchain, I can get transactions's details that not included in blockchain yet via api. but in EOS blockchain ,it seems that there were no such api to get those information.

is there something detail I didn't get ? or do someone know how to get transactions that already sent but not included in EOS blockchain yet?

4

Yes, this is more involved in EOS. You need to connect to a node which implements the history_api_plugin.

Then you can use cleos, the command line tool to check for the status of the transaction, response will be a JSON with info on the transaction:

$ cleos get transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703
{
  "transaction_id": "eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703",
  "processed": {
    "refBlockNum": 2206,
    "refBlockPrefix": 221394282,
    "expiration": "2017-09-05T08:03:58",
    "scope": [
      "inita",
      "tester"
    ],
    "signatures": [
      "1f22e64240e1e479eee6ccbbd79a29f1a6eb6020384b4cca1a958e7c708d3e562009ae6e60afac96f9a3b89d729a50cd5a7b5a7a647540ba1678831bf970e83312"
    ],
    "messages": [{
        "code": "eos",
        "type": "transfer",
        "authorization": [{
            "account": "inita",
            "permission": "active"
          }
        ],
        "data": {
          "from": "inita",
          "to": "tester",
          "amount": 1000,
          "memo": ""
        },
        "hex_data": "000000008040934b00000000c84267a1e80300000000000000"
      }
    ],
    "output": [{
        "notify": [{
            "name": "tester",
            "output": {
              "notify": [],
              "sync_transactions": [],
              "async_transactions": []
            }
          },{
            "name": "inita",
            "output": {
              "notify": [],
              "sync_transactions": [],
              "async_transactions": []
            }
          }
        ],
        "sync_transactions": [],
        "async_transactions": []
      }
    ]
  }
}

Look for the details in the processed item in the response.

For more info, go to the wiki for cleos

  • The history plugin only records transactions when they appear in blocks. It doesn't record transactions which are waiting to be included. This part of the question isn't answered: "or do someone know how to get transactions that already sent but not included in EOS blockchain yet?" – Todd Fleming Jun 10 '18 at 16:18
  • thanks, I can check the "block_num" in transaction detail to configure where it is included. But if i want to know how many transactions appear in block but not included in block yet and details of those transactions, is there any way? – xj zhao Jun 11 '18 at 13:23
  • I'm not sure if there is support for that. Probably need to interact with the net_plugin since it has the code to handle pending transactions. I don't know if there is an api exposing this info. If there is none, then someone can develop this as an extension to the current api as a plugin. – Ami Heines Jun 12 '18 at 12:01
  • I searched around the code base and found the mongo plugin. It tracks changes to the state of the transactions and updates a mongodb collection with the status of the transactions. – Ami Heines Jun 14 '18 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.