## [blockchain.scripthash.get\_first\_spend](site:/protocol/blockchain/blockchain-scripthash-get_first_spend)

Returns the first transaction that spends outputs from the given scripthash.
The returned transaction is the earliest (lowest height) that spends any output
from this scripthash.

If there are no matching transactions in the blockchain, but there are in the
mempool, one of these are returned instead. In this case, the block hash
returned is the hex representation of `0` and block height the numeric value
`0`

If there are no matching transactions in the blockchain or in the mempool,
`null` is returned.

**Signature**

>  Function: blockchain.scripthash.get\_first\_spend(scripthash, { "include_tokens": true, ...})
>
>  Version added: Rostrum 13.0
>
> -  *scripthash*
>
>    The script hash as a hexadecimal string.
>
> --8<-- "doc/protocol/param_filter.ext"


**Result**

>  A dictionary with the following keys, or `null` if no spends found.
>
>  * *height*
>
>    The block height of the block containing the first spend.
>
>    Block height is 0 if the first spend is in the mempool.
>
>  * *block_hash*
>
>    The block hash of the block containing the first spend.
>
>    Block hash is hex of 0 if the first spend is in the mempool.
>
>  * *tx_hash*
>
>   A hash of the transaction that spends outputs from the scripthash.

**Example Result**

With *scripthash*
`273139c9327743dccc1030fc8d009e63e41e147c6b0449913d2dea5b71eef230` on the
Bitcoin Cash chain:

```
 {
    'block_hash': '000000000000000002a04f56505ef459e1edd21fb3725524116fdaedf3a4d0ab',
    'block_height': 597843,
    'tx_hash': 'cef9c1485f166e92adf0b5d42e4ad202e4f5f9e2e7a072d0a6864c61c2cd6fa0'
  }
```