import CodeBlock from "@theme/CodeBlock";
import a_get_address_outputs from "!!raw-loader!./../../../../../bindings/python/examples/05a_get_address_outputs.py";
import b_get_output from "!!raw-loader!./../../../../../bindings/python/examples/05b_get_output.py";
import c_find_outputs from "!!raw-loader!./../../../../../bindings/python/examples/05c_find_outputs.py";
- [`Client.get_address_outputs(str)`](#clientget_address_outputsaddress-options-optionall)
- [`Client.get_output(str)`](#clientget_outputoutput_id)
- [`Client.find_outputs(output_ids (optional), addresses (optional))`](#clientfind_outputsoutput_ids-optional-addresses-optional)
## Client.get_address_outputs(address, options (optional))
The [`Client.get_address_outputs(str)`](./../libraries/python/api_reference#get_address_outputsaddress-options-optional-listutxoinput) function expects an address in Bech32 format and returns a `str[]` of
`output_ids`.
{a_get_address_outputs}
**Output example**:
```plaintext
Output index: 0; raw transaction id: [162, 44, 186, 6, 103, 201, 34, 203, 177, 248, 189, 202, 249, 112, 178, 168, 129, 204, 214, 232, 142, 47, 204, 229, 3, 116, 222, 42, 172, 124, 55, 114]
`output_id` encoded in hex: a22cba0667c922cbb1f8bdcaf970b2a881ccd6e88e2fcce50374de2aac7c37720000
```
- The `UTXO` output is represented by output `index` and `transaction_id`. `transaction_id` is basically a list of 32
`bytes`. `index` is 2-bytes (16bits) `uint`.
- The `index` and `transaction_id` are usually combined into single hex string of 68 characters = 32 \* 2 chars
(`transaction_id`; 32 bytes in hex) + 4 chars (`index`; 2 bytes in hex).
The resulting `output_id` is the unique id of the given `output`.
## Client.get_output(output_id)
You can use the [`Client.get_output(output_id)`](./../libraries/python/api_reference#get_outputoutput_id-outputresponse) function to get metadata about the an `output_id`:
{b_get_output}
**Output example**:
```json
{
"message_id": "f303bc90a5ed3ef15af5fc6aa81a739978c59458a71e68ce8e380f1f534da1e6",
"transaction_id": "0f2d5d2651f8061a9f5417d0658009f32b2e3f77f9706b0be3b4b3f466171f36",
"output_index": 0,
"is_spent": false,
"address": "atoi1qzt0nhsf38nh6rs4p6zs5knqp6psgha9wsv74uajqgjmwc75ugupx3y7x0r",
"amount": 1000000
}
```
## Client.find_outputs(output_ids (optional), addresses (optional))
The function [`Client.find_outputs(output_ids (optional), addresses (optional))`](./../libraries/python/api_reference#find_outputsoutput_ids-optional-addresses-optional-listoutputresponse) is a convenient shortcut combining both
`Client.get_address_outputs(str)` and `Client.get_output(str)` methods in a single call. It supports two arguments, a
list of `output_ids` or a list of `addresses`.
{c_find_outputs}
**Output example**:
```json
[
{
"message_id": "f303bc90a5ed3ef15af5fc6aa81a739978c59458a71e68ce8e380f1f534da1e6",
"transaction_id": "0f2d5d2651f8061a9f5417d0658009f32b2e3f77f9706b0be3b4b3f466171f36",
"output_index": 0,
"is_spent": false,
"address": "atoi1qzt0nhsf38nh6rs4p6zs5knqp6psgha9wsv74uajqgjmwc75ugupx3y7x0r",
"amount": 1000000
},
{
"message_id": "825266a79c0ffb6001ed263eb150357863b7d0052627c5766e8ef5acd6fed533",
"transaction_id": "768c20c15a290e02a43b83263a98501b9d7eb0b57da40a9247289c672de63ea6",
"output_index": 0,
"is_spent": false,
"address": "atoi1qzt0nhsf38nh6rs4p6zs5knqp6psgha9wsv74uajqgjmwc75ugupx3y7x0r",
"amount": 1000000
}
]
```
- `message_id`: Refers to the encapsulating message in which the transaction was sent.
- `transaction_id`, `output_index`: Refers to the output within the `SignedTransaction` payload. There may be several
`outputs` involved in a single transaction, so the `transaction_id` by itself would not be enough.
- `output`: This section provides details about the iota address to which the given
[unspent transaction output](../../../explanations/messages_payloads_and_transactions.md#unspent-transaction-output-utxo)
is coupled with.
- `amount`: States an amount of tokens related to the `output`.
- `is_spent`: Indicates whether the given `output` is a part of the actual ledger state or not. As mentioned in the
[Messages, Payloads, and Transactions section](../../../explanations/messages_payloads_and_transactions.md#unspent-transaction-output-utxo),
if an output was already spent it is not part of the ledger state any more and is replaced by some other `output(s)`
in the process.
Notice that the `output_id` that was used in a function call to get output details is the same as a combination of the
`transaction_id` and `output index`. This way a transaction is tightly coupled with `outputs` since the
`SignedTransaction` payload is a main vehicle to create and spend `outputs`, and everything is encapsulated in a
[`message`](../../../explanations/messages_payloads_and_transactions.md#messages).