Menu

How To Submit A Transaction

Goal

Push a transaction

Before you begin

  • Install the currently supported version of cleos
  • Understand the following:

    • What is a transaction
    • How to generate a valid transaction JSON

Steps

  • Create a JSON snippet contains a valid transaction such as the following:
{
  "expiration": "2019-08-01T07:15:49",
  "ref_block_num": 34881,
  "ref_block_prefix": 2972818865,
  "max_net_usage_words": 0,
  "max_cpu_usage_ms": 0,
  "delay_sec": 0,
  "context_free_actions": [],
  "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
          "actor": "han",
          "permission": "active"
        }
      ],
      "data": "000000000000a6690000000000ea305501000000000000000453595300000000016d"
    }
  ],
  "transaction_extensions": [],
  "context_free_data": []
}
  • You can also create a JSON snippet that uses clear text JSON for data field.

Be aware that if a clear text data field is used, cleos need to fetch copies of required ABIs using nodeos API. That operation has a performance overhead on nodeos

{
  "expiration": "2019-08-01T07:15:49",
  "ref_block_num": 34881,
  "ref_block_prefix": 2972818865,
  "max_net_usage_words": 0,
  "max_cpu_usage_ms": 0,
  "delay_sec": 0,
  "context_free_actions": [],
  "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
          "actor": "han",
          "permission": "active"
        }
      ],
      "data": {
        "from": "han",
        "to": "eosio",
        "quantity": "0.0001 SYS",
        "memo": "m"
      }
    }
  ],
  "transaction_extensions": [],
  "context_free_data": []
}
  • Execute the following command:
cleos push transaction TRX_FILE.json
  • Submit a transaction from a JSON:
cleos push transaction JSON