> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allium.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Token Transfers 🌱

### Table Details

| Property          | Value                               |
| ----------------- | ----------------------------------- |
| Table Name        | `spark.raw.token_transfers`         |
| Table Status      | Beta 🌱                             |
| Unique Key        | `block_timestamp_unix`, `unique_id` |
| Clustering Key(s) | `to_date("block_timestamp")`        |

### Table Columns

| Column Name             | Data Type         | Description                                                                                                                                                                                                                                                                      |
| ----------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| block\_timestamp        | TIMESTAMP\_NTZ(9) | UTC timestamp of the block containing this transfer.                                                                                                                                                                                                                             |
| block\_number           | NUMBER(38,0)      | Height of the block containing this transfer.                                                                                                                                                                                                                                    |
| id                      | VARCHAR(16777216) | Identifier of the parent transaction (transaction hash) this transfer belongs to. Joins to `transactions.id`.                                                                                                                                                                    |
| orchestra\_id           | VARCHAR(16777216) | Identifier of the Orchestra operation this transfer belongs to, when applicable.                                                                                                                                                                                                 |
| output\_index           | NUMBER(38,0)      | Index of the output leg within the parent transaction (UTXO output ordinal).                                                                                                                                                                                                     |
| swap\_id                | VARCHAR(16777216) | Identifier of the swap this transfer is part of, when applicable.                                                                                                                                                                                                                |
| transfer\_index         | NUMBER(38,0)      | Sequential index of this transfer within its block.                                                                                                                                                                                                                              |
| unique\_id              | VARCHAR(16777216) | Stable primary key of the transfer (derived from transaction id + output index). Key on this to de-duplicate: the same transfer may be re-emitted as its status advances (e.g. `sent` → `confirmed`); keep the latest version.                                                   |
| asset\_type             | VARCHAR(16777216) | Asset moved: `native` (BTC) or `token`.                                                                                                                                                                                                                                          |
| status                  | VARCHAR(16777216) | Lifecycle state of the transfer, e.g. `sent` (pending) or `confirmed` (final). Treat only `confirmed` as settled.                                                                                                                                                                |
| type                    | VARCHAR(16777216) | Transfer type, e.g. `spark_transfer`, `lightning_payment`, `token_transfer`, `token_multi_transfer`, `token_mint`, `token_burn`, `bitcoin_deposit`.                                                                                                                              |
| transfer\_from\_address | VARCHAR(16777216) | Canonical sender address. Populated for every transfer type (including multi-transfers) — prefer this over `from_address_details` for address filters. For Lightning legs this is the sentinel label `Lightning Network` rather than a Spark address (see `transfer_from_type`). |
| transfer\_from\_pubkey  | VARCHAR(16777216) | Sender public key, when the sender is a Spark-type endpoint.                                                                                                                                                                                                                     |
| transfer\_from\_type    | VARCHAR(16777216) | Sender endpoint type, e.g. `spark`, `lightning`, `issuer`.                                                                                                                                                                                                                       |
| transfer\_to\_address   | VARCHAR(16777216) | Canonical recipient address. Populated for every transfer type — prefer this over `to_address_details` for address filters.                                                                                                                                                      |
| transfer\_to\_pubkey    | VARCHAR(16777216) | Recipient public key, when the recipient is a Spark-type endpoint.                                                                                                                                                                                                               |
| transfer\_to\_type      | VARCHAR(16777216) | Recipient endpoint type, e.g. `spark`, `lightning`, `burn_address`.                                                                                                                                                                                                              |
| raw\_amount\_str        | VARCHAR(16777216) | Unscaled integer amount in the token's smallest unit, as a string. Canonical, precision-safe amount — use this for exact math (values can exceed float precision).                                                                                                               |
| raw\_amount             | FLOAT             | Unscaled integer amount as a floating-point number. Convenient but lossy for large values; use `raw_amount_str` when precision matters.                                                                                                                                          |
| amount\_str             | VARCHAR(16777216) | Decimal-scaled amount (`raw_amount_str` / 10^`token_decimals`) as a string. Precision-safe, ready to display.                                                                                                                                                                    |
| amount                  | FLOAT             | Decimal-scaled amount as a floating-point number. Convenient but lossy; use `amount_str` when precision matters.                                                                                                                                                                 |
| token\_decimals         | NUMBER(38,0)      | Number of decimal places for the transferred token (8 for native BTC). Used to scale `raw_amount` into `amount`.                                                                                                                                                                 |
| amount\_sats            | NUMBER(38,0)      | Native BTC amount in satoshis, when the transfer is native.                                                                                                                                                                                                                      |
| token\_amount           | NUMBER(38,0)      | Token amount in the token's smallest unit, when the transfer is a token.                                                                                                                                                                                                         |
| usd\_amount             | FLOAT             | Indicative USD value of the transfer at scrape time (Sparkscan `valueUsd`); recomputed per scrape, so treat as approximate rather than a settled value.                                                                                                                          |
| bitcoin\_txid           | VARCHAR(16777216) | Underlying Bitcoin L1 transaction id, for transfers that settle on-chain.                                                                                                                                                                                                        |
| created\_at             | TIMESTAMP\_NTZ(9) | Timestamp when the transfer was first observed by the indexer.                                                                                                                                                                                                                   |
| updated\_at             | TIMESTAMP\_NTZ(9) | Timestamp of the most recent indexer update to this transfer (e.g. a `sent` → `confirmed` transition).                                                                                                                                                                           |
| expired\_time           | TIMESTAMP\_NTZ(9) | Expiry timestamp for time-bound transfers (e.g. pending Lightning payments), when applicable.                                                                                                                                                                                    |
| block\_timestamp\_unix  | NUMBER(38,0)      | Unix timestamp (seconds) of the block containing this transfer.                                                                                                                                                                                                                  |
| from\_address\_details  | VARIANT           | Structured sender detail (`identifier`, `pubkey`, `type`). Null for `token_multi_transfer` legs (the API omits a top-level sender there); use `transfer_from_address` as the canonical sender in all cases.                                                                      |
| to\_address\_details    | VARIANT           | Structured recipient detail (`identifier`, `pubkey`, `type`). Null where the API omits a top-level recipient; use `transfer_to_address` as the canonical recipient.                                                                                                              |
| multi\_io\_details      | VARIANT           | Raw UTXO input/output breakdown (`inputs[]`, `outputs[]`, totals) for the parent multi-transfer transaction.                                                                                                                                                                     |
| token\_metadata         | VARIANT           | Token metadata (name, ticker, decimals, token address/identifier) for token transfers.                                                                                                                                                                                           |
| \_created\_at           | TIMESTAMP\_NTZ(9) | Timestamp of when the entry was created in the database.                                                                                                                                                                                                                         |
| \_updated\_at           | TIMESTAMP\_NTZ(9) | Timestamp of when the entry was last updated in the database.                                                                                                                                                                                                                    |
