docs/02_cleos/02_how-to-guides/how-to-submit-a-transaction.md
This how-to guide provides instructions on how to submit, or push, a transaction using the cleos CLI tool.
Install the currently supported version of cleos
Understand the following:
-d and -j.See the following reference guides for command line usage and related options for the cleos command:
The following steps show how to:
You can create the JSON snippet defining the transaction in two ways:
data field.{
"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": []
}
data field.[[info]]
| Be aware that if a clear text data field is used, cleos needs to fetch the smart contract's ABI using nodeos API. This operation has an overall performance overhead for both cleos and nodeos. On the other hand if hex data is used in the data field then the ABI fetching is not executed and thus the total time to send and execute the transaction is faster.
{
"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": []
}
You can send the transaction you created as JSON snippet in two ways:
TRX_FILE.json file:cleos push transaction TRX_FILE.json
cleos push transaction '{"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": []}'
In conclusion, the above instructions show how to submit, or push, a transaction using the cleos CLI tool.