My goal is to get a list of account names of human users of a dApp, from the output of

cleos get actions <dApp account name> -j

Is there any way to determine, from a transaction's initial action's authorization and auth_sequence fields, whether the transaction was initiated by the account user(by signing the transaction with the active private key) or as a deferred action by the account's contract code?

The closest answer I can find details the authorization difference between contract-initiated and user-initiated transactions but I still have no idea of how to differentiate these by looking at a transaction JSON.

I thought of checking whether or not an account has non-0 code hash, but I'd be missing out on accounts that have contract code as well as being used by their owner to interact with the dApp.

  • Can you post an example transaction that displays the "authorization" and "auth_sequence" fields? From there, I think I'll be able to answer the question.
    – Nat
    Sep 6, 2018 at 9:33
  • When I run the command you have written above, I always get: { "actions": [], "last_irreversible_block": LAST_BLOCK_NUMBER }. Regardless of whether I do it on an account with or without a contract attached./ Sep 11, 2018 at 8:55
  • What is the use case for it? The action' result should not be different if it is executed by a contract or account. How would you write that into a ricardian contract?
    – friedger
    Sep 13, 2018 at 7:20

1 Answer 1


If an action is initiated by user account, it will be included in the trx.trx.actions array of a transaction. Follow this idea, we could do:

  1. We have a output actions list from your cleos get actions <dApp account name> -j command. We would like to know that, for each action in the list, is it a user action or an inline action. So we should iterate over the list and take one action a time.
  2. Find the trx_id field of current action. This would be the transaction ID that this action belongs to.
  3. Use cleos get transaction <trx_id> to get the transaction data. It should look like:

        block_num: 30285537,
        block_time: "2018-12-04T06:19:54.500",
        id: "404f599bc56f16692313e9308e78276ccc5be1e873153088a2d08908af492fbe",
        last_irreversible_block: 30392225,
        traces: [{…}, {…}, {…}],
        trx: {
            receipt: {…}, 
            trx: {
                actions: [{…}]
  4. Look for current action in the transaction data. If it is in trx.trx.actions, it is a user action. Otherwise, if it's not in trx.trx.actions but in traces, it is an inline action. Or, you could also traverse over items in traces, testing if your current action's global_action_seq matches receipt.global_sequence of any child item inside of inline_traces.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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