Overview
This node, named "Flow Query," is designed to execute query scripts on the Flow blockchain (Testnet). It allows users to run predefined templates containing Cadence scripts (Flow's smart contract language) with optional arguments. This is useful for retrieving data from the Flow blockchain without modifying its state.
Common scenarios include:
- Fetching account information or balances.
- Querying smart contract states.
- Retrieving transaction or event details.
Practical example: A user wants to get the current balance of a Flow account by providing a Cadence script template that queries the balance and optionally passing the account address as an argument.
Properties
| Name | Meaning |
|---|---|
| Template | The Cadence script template to be executed as a query on the Flow blockchain. Must be valid JSON or stringified JSON. |
| Options | Additional options to customize the query execution: |
| Arguments (argsList) | A list of argument values to pass to the Cadence script. The order and number must match the template definition. Each argument is a string value. |
| Arguments Field (argsField) | Specifies the name of the field in the previous node's output JSON that contains an array of argument values. If provided, these arguments override the explicit Arguments list. |
Output
The node outputs an array of items where each item's json property contains the result of the Flow blockchain query. The structure of this JSON depends on the Cadence script executed but typically includes the queried data such as account info, balances, or other blockchain state data.
No binary data output is produced by this node.
Example output item:
{
"json": {
"balance": 1000,
"address": "0x123456789abcdef"
}
}
Dependencies
- Requires access to the Flow blockchain Testnet.
- Needs an API key credential configured in n8n to authenticate requests to the Flow blockchain service.
- Uses internal utility functions (
flowQuery) to perform the actual query call.
Troubleshooting
- Invalid Template JSON: If the template property is not valid JSON or a parsable string, the node will throw a parsing error. Ensure the template is correctly formatted.
- Argument Mismatch: The number and order of arguments must match the template's expected parameters. Otherwise, the query may fail or return unexpected results.
- Missing Arguments Field: If using the Arguments Field option, ensure the specified field exists in the previous node's output and contains a plain array of strings.
- API Authentication Errors: If the API key credential is missing or invalid, the node will fail to connect to the Flow blockchain.
- Continue On Fail Behavior: When enabled, errors for individual items are captured in the output with an
errorproperty instead of stopping the entire workflow.