Send a Transaction with the Flow CLI

How to send a Flow transaction from the command line

The Flow CLI provides a command to sign and send transactions to any Flow Access API.

1
flow transactions send <code filename> [<argument> <argument>...] [flags]

Example Usage

1
> flow transactions send ./tx.cdc "Hello"
2
3
Status ✅ SEALED
4
ID b04b6bcc3164f5ee6b77fa502c3a682e0db57fc47e5b8a8ef3b56aae50ad49c8
5
Payer f8d6e0586b0a20c7
6
Authorizers [f8d6e0586b0a20c7]
7
8
Proposal Key:
9
Address f8d6e0586b0a20c7
10
Index 0
11
Sequence 0
12
13
No Payload Signatures
14
15
Envelope Signature 0: f8d6e0586b0a20c7
16
Signatures (minimized, use --include signatures)
17
18
Events: None
19
20
Code (hidden, use --include code)
21
22
Payload (hidden, use --include payload)

Multiple arguments example:

1
> flow transactions send tx1.cdc Foo 1 2 10.9 0x1 '[123,222]' '["a","b"]'

Transaction code:

1
transaction(a: String, b: Int, c: UInt16, d: UFix64, e: Address, f: [Int], g: [String]) {
2
prepare(authorizer: AuthAccount) {}
3
}

In the above example, the flow.json file would look something like this:

1
{
2
"accounts": {
3
"my-testnet-account": {
4
"address": "a2c4941b5f3c7151",
5
"key": "12c5dfde...bb2e542f1af710bd1d40b2"
6
}
7
}
8
}

JSON arguments from a file example:

1
> flow transactions send tx1.cdc --args-json "$(cat args.json)"

Arguments

Code Filename

  • Name: code filename
  • Valid inputs: Any filename and path valid on the system.

The first argument is a path to a Cadence file containing the transaction to be executed.

Arguments

  • Name: argument
  • Valid inputs: valid cadence values matching argument type in transaction code.

Input arguments values matching corresponding types in the source code and passed in the same order.

Flags

Include Fields

  • Flag: --include
  • Valid inputs: code, payload

Specify fields to include in the result output. Applies only to the text output.

Code

  • Flag: --code

⚠️ No longer supported: use filename argument.

Results

  • Flag: --results

⚠️ No longer supported: all transactions will provide result.

Exclude Fields

  • Flag: --exclude
  • Valid inputs: events

Specify fields to exclude from the result output. Applies only to the text output.

Signer

  • Flag: --signer
  • Valid inputs: the name of an account defined in the configuration (flow.json)

Specify the name of the account that will be used to sign the transaction.

Proposer

  • Flag: --proposer
  • Valid inputs: the name of an account defined in the configuration (flow.json)

Specify the name of the account that will be used as proposer in the transaction.

Payer

  • Flag: --payer
  • Valid inputs: the name of an account defined in the configuration (flow.json)

Specify the name of the account that will be used as payer in the transaction.

Authorizer

  • Flag: --authorizer
  • Valid inputs: the name of a single or multiple comma-separated accounts defined in the configuration (flow.json)

Specify the name of the account(s) that will be used as authorizer(s) in the transaction. If you want to provide multiple authorizers separate them using commas (e.g. alice,bob)

Arguments JSON

  • Flag: --args-json
  • Valid inputs: arguments in JSON-Cadence form.
  • Example: flow transactions send ./tx.cdc '[{"type": "String", "value": "Hello World"}]'

Arguments passed to the Cadence transaction in Cadence JSON format. Cadence JSON format contains type and value keys and is documented here.

Gas Limit

  • Flag: --gas-limit
  • Valid inputs: an integer greater than zero.
  • Default: 1000

Specify the gas limit for this transaction.

Host

  • Flag: --host
  • Valid inputs: an IP address or hostname.
  • Default: 127.0.0.1:3569 (Flow Emulator)

Specify the hostname of the Access API that will be used to execute the command. This flag overrides any host defined by the --network flag.

Network Key

  • Flag: --network-key
  • Valid inputs: A valid network public key of the host in hex string format

Specify the network public key of the Access API that will be used to create a secure GRPC client when executing the command.

Network

  • Flag: --network
  • Short Flag: -n
  • Valid inputs: the name of a network defined in the configuration (flow.json)
  • Default: emulator

Specify which network you want the command to use for execution.

Filter

  • Flag: --filter
  • Short Flag: -x
  • Valid inputs: a case-sensitive name of the result property.

Specify any property name from the result you want to return as the only value.

Output

  • Flag: --output
  • Short Flag: -o
  • Valid inputs: json, inline

Specify the format of the command results.

Save

  • Flag: --save
  • Short Flag: -s
  • Valid inputs: a path in the current filesystem.

Specify the filename where you want the result to be saved

Log

  • Flag: --log
  • Short Flag: -l
  • Valid inputs: none, error, debug
  • Default: info

Specify the log level. Control how much output you want to see during command execution.

Configuration

  • Flag: --config-path
  • Short Flag: -f
  • Valid inputs: a path in the current filesystem.
  • Default: flow.json

Specify the path to the flow.json configuration file. You can use the -f flag multiple times to merge several configuration files.

Version Check

  • Flag: --skip-version-check
  • Default: false

Skip version check during start up to speed up process for slow connections.