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

# Transaction fields and hash calculations

<Tip>
  To review how transaction appear in the Starknet API, see [starknet\_api\_openrpc.json](https://github.com/starkware-libs/starknet-specs/blob/b5c43955b1868b8e19af6d1736178e02ec84e678/api/starknet_api_openrpc.json).
</Tip>

## `INVOKE` v3

### Transaction fields

| Field name                     | Type                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `chain_id`                     | `FieldElement`                   | The id of the chain to which the transaction is sent.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `fee_data_availability_mode`   | `FieldElement`                   | *For future use.*<br /><br />Currently this value is always `0`.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `nonce`                        | `FieldElement`                   | The transaction nonce.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `nonce_data_availability_mode` | `FieldElement`                   | *For future use.*<br /><br />Currently this value is always `0`.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `paymaster_data`               | `List<FieldElement>`             | *For future use.*<br /><br />Currently this value is always empty.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `resource_bounds`              | `Dict[Resource, ResourceBounds]` | Used for enabling the fee market.<br /><br />A dictionary that maps resource type to resource bounds. The existing resources are L1 gas, L1 data gas, and L2 gas.<br /><br /> ***Resource***<br /><br />A felt. Possible values are the felt representation of the strings `L1_GAS`, `L1_DATA`, or `L2_GAS`.<br /><br />***ResourceBounds***<br /><br />A struct containing the following felts:<br /><br />• `max_amount`: The maximum amount of the resource allowed for usage during the execution.<br /><br />• `max_price_per_unit`: The maximum price the user is willing to pay for the resource. Prices are denominated in fri, where 1 fri = 10<sup>-18</sup> STRK. |
| `signature`                    | `List<FieldElement>`             | Additional information given by the sender, used to validate the transaction. For more information, see [Signature](#signature).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `tip`                          | `FieldElement`                   | Used to determine the priority between transactions where the l2gas max\_price\_per\_unit is enough to fit within the block, according to EIP 1559 which Starknet follows since version 0.14.0.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `version`                      | `FieldElement`                   | The transaction's version. When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases.<br /><br />Transaction version, where `n` specifies version `n` transaction. For example:<br /><br />3 version 3 transaction                                                                                                                                                                                                                                                                                                                                             |

### Hash calculation

The `INVOKE` v3 transaction hash is calculated as a Poseidon hash over the given transaction elements, specifically:

```txt theme={null}
invoke_v3_tx_hash = h(
  "invoke",
  version,
  sender_address,
  h(tip, l1_gas_bounds, l2_gas_bounds, l1_data_gas_bounds),
  h(paymaster_data),
  chain_id,
  nonce,
  data_availability_modes,
  h(account_deployment_data),
  h(calldata)
  h(proof_facts)
)
```

Where:

* `invoke` is a constant prefix string, encoded in ASCII.
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain ID](#chain_id).
* `proof_facts` are included in the hash computation only when present; otherwise, they are omitted.
* `l1_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L1\_GAS}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `l2_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L2\_GAS}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `l1_data_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L1\_DATA}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `data_availability_modes` is a concatenation of `fee_data_availability_mode` and `nonce_data_availability_mode`, as follows:

  $$
  \underbrace{\texttt{0...0}}_{\text{188 bits}} \, | \, \underbrace{\texttt{nonce\_data\_availability\_mode}}_{\text{32 bits}} \, | \, \underbrace{\texttt{fee\_data\_availability\_mode}}_{\text{32 bits}}
  $$
* `h` is the [Poseidon](/learn/protocol/cryptography/#poseidon_hash) hash.

## `DECLARE` v3

The `DECLARE` transaction introduces new contract classes into the state of Starknet, enabling other contracts to deploy instances of those classes or use them in a library call. For more information, see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).

### Transaction fields

| Field name                     | Type                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------ | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_deployment_data`      | `List<FieldElement>`             | *For future use.*<br /><br />Currently this value is always empty.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `chain_id`                     | `FieldElement`                   | The id of the chain to which the transaction is sent.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `compiled_class_hash`          | `FieldElement`                   | The hash of the compiled class. For more information, see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `contract_class`               | `ContractClass`                  | The class definition. For more information, see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `fee_data_availability_mode`   | `FieldElement`                   | *For future use.*<br /><br />Currently this value is always `0`.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `nonce`                        | `FieldElement`                   | The transaction nonce.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `nonce_data_availability_mode` | `FieldElement`                   | *For future use.*<br /><br />Currently this value is always `0`.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `paymaster_data`               | `List<FieldElement>`             | *For future use.*<br /><br />Currently this value is always empty.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `resource_bounds`              | `Dict[Resource, ResourceBounds]` | Used for enabling the fee market.<br /><br />A dictionary that maps resource type to resource bounds. The existing resources are L1 gas, L1 data gas, and L2 gas.<br /><br />`Resource`<br /><br />A felt. Possible values are the felt representation of the strings `L1_GAS`, `L1_DATA`, or `L2_GAS`.<br /><br />`ResourceBounds`<br /><br />A struct containing the following felts:<br /><br />• `max_amount`: The maximum amount of the resource allowed for usage during the execution.<br /><br />• `max_price_per_unit`: The maximum price the user is willing to pay for the resource. Prices are denominated in fri, where 1 fri = 10<sup>-18</sup> STRK. |
| `sender_address`               | `FieldElement`                   | The address of the account initiating the transaction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `signature`                    | `List<FieldElement>`             | Additional information given by the sender, used to validate the transaction. For more information, see [Signature](#signature).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `tip`                          | `FieldElement`                   | For future use. Currently this value is always `0`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `version`                      | `FieldElement`                   | The transaction's version.<br />When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases.<br /><br />Transaction version, where `n` specifies version `n` transaction. For example:<br /><br />3 version 3 transaction                                                                                                                                                                                                                                                                                                                               |

### Hash calculation

The hash of a v3 `DECLARE` transaction is computed as follows:

```txt theme={null}
declare_v3_tx_hash = h(
  "declare",
  version,
  sender_address,
  h(tip, l1_gas_bounds, l2_gas_bounds, l1_data_gas_bounds),
  h(paymaster_data),
  chain_id,
  nonce,
  data_availability_modes,
  h(account_deployment_data),
  class_hash,
  compiled_class_hash
)
```

Where:

* `declare` is a constant prefix string, encoded in ASCII.
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain ID](#chain_id).
* `l1_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L1\_GAS}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `l2_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L2\_GAS}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `l1_data_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L1\_DATA}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `data_availability_modes` is a concatenation of `fee_data_availability_mode` and `nonce_data_availability_mode`, as follows:

  $$
  \underbrace{\texttt{0...0}}_{\text{188 bits}} \, | \, \underbrace{\texttt{nonce\_data\_availability\_mode}}_{\text{32 bits}} \, | \, \underbrace{\texttt{fee\_data\_availability\_mode}}_{\text{32 bits}}
  $$
* `h` is the [Poseidon](/learn/protocol/cryptography/#poseidon_hash) hash.
* `class_hash` is the hash of the contract class. See [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html)] for details about how the hash is computed
* `compiled_class_hash` is the hash of the compiled class generated by the Sierra→Casm compiler that is used in Starknet

## `DEPLOY_ACCOUNT` v3

Since StarkNet v0.10.1 the `DEPLOY_ACCOUNT` transaction replaces the `DEPLOY` transaction for deploying account contracts.

To use it, you should first pre-fund your new account address so that you can pay the transaction fee. You can then send the `DEPLOY_ACCOUNT` transaction.

For more information, see [Deploying a new account](/learn/protocol/accounts/#deploying_a_new_account).

### Transaction fields

| Field name                     | Type                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------ | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_deployment_data`      | `List<FieldElement>`             | *For future use.*<br /><br />Currently this value is always empty.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `chain_id`                     | `FieldElement`                   | The id of the chain to which the transaction is sent.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `class_hash`                   | `FieldElement`                   | The hash of the desired account class. For more information, see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `compiled_class_hash`          | `FieldElement`                   | The hash of the compiled class. For more information, see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `constructor_calldata`         | `List<FieldElement>`             | The arguments to the account constructor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `contract_address_salt`        | `FieldElement`                   | A random salt that determines the account address.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `contract_class`               | `ContractClass`                  | The class definition. For more information, see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `fee_data_availability_mode`   | `FieldElement`                   | *For future use.*<br /><br />Currently this value is always `0`.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `nonce`                        | `FieldElement`                   | The transaction nonce.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `nonce_data_availability_mode` | `FieldElement`                   | *For future use.*<br /><br />Currently this value is always `0`.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `paymaster_data`               | `List<FieldElement>`             | *For future use.*<br /><br />Currently this value is always empty.<br /><br />For more information, see [SNIP 8: Transaction V3 Structure](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-8.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `resource_bounds`              | `Dict[Resource, ResourceBounds]` | Used for enabling the fee market.<br /><br />A dictionary that maps resource type to resource bounds. The existing resources are L1 gas, L1 data gas, and L2 gas.<br /><br />***Resource***<br /><br />A felt. Possible values are the felt representation of the strings `L1_GAS`, `L1_DATA`, or `L2_GAS`.<br /><br />***ResourceBounds***<br /><br />A struct containing the following felts:<br /><br />• `max_amount`: The maximum amount of the resource allowed for usage during the execution.<br /><br />• `max_price_per_unit`: The maximum price the user is willing to pay for the resource. Prices are denominated in fri, where 1 fri = 10<sup>-18</sup> STRK. |
| `sender_address`               | `FieldElement`                   | The address of the account initiating the transaction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `signature`                    | `List<FieldElement>`             | Additional information given by the sender, used to validate the transaction. For more information, see [Signature](#signature).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `tip`                          | `FieldElement`                   | For future use. Currently this value is always `0`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `version`                      | `FieldElement`                   | The transaction's version.<br />When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases.Transaction version, where `n` specifies version `n` transaction. For example:<br />3 version 3 transaction                                                                                                                                                                                                                                                                                                                                                         |

### Hash calculation

The hash of a `DEPLOY_ACCOUNT` transaction is computed as follows:

```txt theme={null}
deploy_account_v3_tx_hash = h(
  "deploy_account",
  version,
  contract_address,
  h(tip, l1_gas_bounds, l2_gas_bounds, l1_data_gas_bounds),
  h(paymaster_data),
  chain_id,
  nonce,
  data_availability_modes,
  h(constructor_calldata),
  class_hash,
  contract_address_salt
)
```

Where:

* `deploy_account` is a constant prefix string, encoded in ASCII.
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain ID](#chain_id).
* `l1_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L1\_GAS}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `l2_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L2\_GAS}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `l1_data_gas_bounds` is constructed as follows:

  $$
  \underbrace{\texttt{L1\_DATA}}_{\text{60 bits}} \, | \, \underbrace{\texttt{max\_amount}}_{\text{64 bits}} \, | \, \underbrace{\texttt{max\_price\_per\_unit}}_{\text{128 bits}}
  $$
* `data_availability_modes` is a concatenation of `fee_data_availability_mode` and `nonce_data_availability_mode`, as follows:

  $$
  \underbrace{\texttt{0...0}}_{\text{188 bits}} \, | \, \underbrace{\texttt{nonce\_data\_availability\_mode}}_{\text{32 bits}} \, | \, \underbrace{\texttt{fee\_data\_availability\_mode}}_{\text{32 bits}}
  $$
* `h` is the [Poseidon](/learn/protocol/cryptography/#poseidon_hash) hash.
* `class_hash` is the hash of the contract class hash. See [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html) for details about how the hash is computed.
* `contract_address` is the address of the newly deployed account. For information on how this address is calculated, see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).

## Additional information

### Signature

While Starknet does not have a specific signature scheme built into the protocol, the Cairo language, in which smart contracts are written, does have an efficient implementation for ECDSA signature with respect to a STARK-friendly curve. For more information, see [Cryptography](/learn/protocol/cryptography/).

### Chain ID

Chain IDs are given as numbers, representing the ASCII encoding of specific constant strings, as illustrated by the following Python snippet:

```python theme={null}
chain_id = int.from_bytes(value, byteorder="big", signed=False)
```

The following constants are currently used. They correspond to the chain IDs that Starknet currently supports:

* `SN_MAIN` for Starknet's main network.
* `SN_SEPOLIA` for Starknet's public testnet on Sepolia.

## Legacy information

### `INVOKE` v1

#### Transaction fields

| Name             | Type                 | Description                                                                                                                                                                                                              |
| ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `sender_address` | `FieldElement`       | The address of the sender of this transaction.                                                                                                                                                                           |
| `calldata`       | `List<FieldElement>` | The arguments that are passed to the `validate` and `execute` functions.                                                                                                                                                 |
| `signature`      | `List<FieldElement>` | Additional information given by the sender, used to validate the transaction. For more information, see [Signature](#signature).                                                                                         |
| `max_fee`        | `FieldElement`       | The maximum fee that the sender is willing to pay for the transaction                                                                                                                                                    |
| `nonce`          | `FieldElement`       | The transaction nonce.                                                                                                                                                                                                   |
| `version`        | `FieldElement`       | The transaction's version.<br />The value is 1. When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases. |

#### Hash calculation

The `INVOKE` v1 transaction hash is calculated as a hash over the given transaction elements, specifically:

```txt theme={null}
invoke_v1_tx_hash = h(
  "invoke",
  version,
  sender_address,
  0,
  h(calldata),
  max_fee,
  chain_id,
  nonce
)
```

Where:

* `invoke` is a constant prefix string, encoded in ASCII.
* The placeholder zero is used to align the hash computation for the different types of transactions.
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain-Id](#chain-id).
* `h` is the [Pedersen](/learn/protocol/cryptography/#pedersen_hash) hash

### `INVOKE` v0

#### Hash calculation

The hash of a v0 `INVOKE` transaction is computed as follows:

```txt theme={null}
invoke_v0_tx_hash = h(
  "invoke",
  version,
  contract_address,
  entry_point_selector,
  h(calldata),
  max_fee,
  chain_id
)
```

Where:

* `invoke` is a constant prefix string, encoded in (ASCII).
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain-Id](#chain-id). v2 and v3
* `h` is the [Pedersen](/learn/protocol/cryptography/#pedersen_hash) hash

### `DECLARE` v2

#### Transaction fields

| Name                  | Type                 | Description                                                                                                                                                                                                              |
| --------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `chain_id`            | `FieldElement`       | The id of the chain to which the transaction is sent.                                                                                                                                                                    |
| `contract_class`      | `ContractClass`      | The contract [class](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).                                                                                                                         |
| `compiled_class_hash` | `FieldElement`       | The hash of the compiled class                                                                                                                                                                                           |
| `sender_address`      | `FieldElement`       | The address of the account initiating the transaction.                                                                                                                                                                   |
| `signature`           | `List<FieldElement>` | Additional information given by the sender, used to validate the transaction. For more information, see [Signature](#signature).                                                                                         |
| `max_fee`             | `FieldElement`       | The maximum fee that the sender is willing to pay for the transaction.                                                                                                                                                   |
| `nonce`               | `FieldElement`       | The transaction nonce.                                                                                                                                                                                                   |
| `version`             | `FieldElement`       | The transaction's version.<br />The value is 2. When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases. |

#### Hash calculation

The hash of a v2 `DECLARE` transaction is computed as follows:

```txt theme={null}
declare_v2_tx_hash = h(
  "declare",
  version,
  sender_address,
  0,
  h(class_hash),
  max_fee,
  chain_id,
  nonce,
  compiled_class_hash
)
```

Where:

* `h` is the [Poseidon hash function](/learn/protocol/cryptography/#poseidon_hash)
* `class_hash` is the hash of the contract class. See [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html) for details about how the hash is computed
* `compiled_class_hash` is the hash of the compiled class generated by the Sierra→Casm compiler that is used in Starknet

### `DECLARE` v1

#### Transaction fields

<Note>
  The `DECLARE` v1 transaction was used to declare Cairo 0 classes.
</Note>

| Name             | Type                 | Description                                                                                                                                                                                                                          |
| ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `contract_class` | `ContractClass`      | The class object.                                                                                                                                                                                                                    |
| `sender_address` | `FieldElement`       | The address of the account initiating the transaction.                                                                                                                                                                               |
| `max_fee`        | `FieldElement`       | The maximum fee that the sender is willing to pay for the transaction.                                                                                                                                                               |
| `signature`      | `List<FieldElement>` | Additional information given by the sender, used to validate the transaction. For more information, see [Signature](#signature).                                                                                                     |
| `nonce`          | `FieldElement`       | The transaction nonce.                                                                                                                                                                                                               |
| `version`        | `FieldElement`       | The transaction's version. Possible values are 1 or 0.<br />When the fields that comprise a transaction change, either with the addition of a new field or the removal of an existing field, then the transaction version increases. |

#### Hash calculation

The hash of a v1 `DECLARE` transaction is computed as follows:

```txt theme={null}
declare_v1_tx_hash = h(
  "declare",
  version,
  sender_address,
  0,
  h(class_hash),
  max_fee,
  chain_id,
  nonce
)
```

Where:

* `declare` is a constant prefix string, encoded in ASCII.
* `class_hash` is the hash of the contract class. See [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html) for details about how the hash is computed.
* The placeholder zero is used to align the hash computation for the different types of transactions.
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain ID](#chain_id).
* `h` is the [Pedersen](/learn/protocol/cryptography/#pedersen_hash) hash

### `DECLARE` v0

#### Hash calculation

<Note>
  The `DECLARE` v0 transaction used to declare Cairo 0 classes.
</Note>

The hash of a v0 `DECLARE` transaction is computed as follows:

```txt theme={null}
declare_v0_tx_hash = h(
  "declare",
  version,
  sender_address,
  0,
  h(),
  max_fee,
  chain_id,
  class_hash
)
```

Where:

* `declare` is a constant prefix string, encoded in ASCII.
* The placeholder zeros are used to align the hash computation for the different types of transactions.
* `h` is the [Pedersen](/learn/protocol/cryptography/#pedersen_hash) hash
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain-Id](#chain-id).
* `class_hash` is the hash of the contract class. See [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html) for details about how the hash is computed.

### `DEPLOY_ACCOUNT` v1

#### Transaction fields

| Name                    | Type                 | Description                                                                                                                                           |
| ----------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `class_hash`            | `FieldElement`       | The hash of the desired account class.                                                                                                                |
| `constructor_calldata`  | `List<FieldElement>` | The arguments to the account constructor.                                                                                                             |
| `contract_address_salt` | `FieldElement`       | A random salt that determines the see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html)\[account address^]. |
| `signature`             | `List<FieldElement>` | Additional information given by the sender, used to validate the transaction. For more information, see [Signature](#signature).                      |
| `max_fee`               | `FieldElement`       | The maximum fee that the sender is willing to pay for the transaction                                                                                 |
| `nonce`                 | `FieldElement`       | The transaction nonce.                                                                                                                                |
| `version`               | `FieldElement`       | The transaction's version. The value is 1.                                                                                                            |

#### Hash calculation

The hash of a `DEPLOY_ACCOUNT` transaction is computed as follows:

```txt theme={null}
deploy_account_v1_tx_hash = h(
  "deploy_account",
  version,
  contract_address,
  0,
  h(class_hash, contract_address_salt, constructor_calldata),
  max_fee,
  chain_id,
  nonce
)
```

Where:

* `deploy_account` is a constant prefix string, encoded in ASCII.
* The placeholder zero is used to align the hash computation for the different types of transactions.
* `h` is the [Pedersen](/learn/protocol/cryptography/#pedersen_hash) hash
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [\[chain-id\]](#chain-id).
* `class_hash` is the hash of the contract class. See [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html) for details about how the hash is computed.

### `DEPLOY` v0

#### Hash calculation

If you need to retrieve the hash of an existing `DEPLOY` transaction, you can use this information to calculate the hash of the transaction.

Before you can calculate the transaction hash, get the deployed contract address. The `DEPLOY` transaction's hash is calculated as shown in the following pseudo code:

```txt theme={null}
deploy_tx_hash = h(
  "deploy",
  version,
  contract_address,
  sn_keccak("constructor"),
  h constructor_calldata),
  0,
  chain_id
)
```

Where:

* The placeholder zero is used to align the hash computation for the different types of transactions.
* `deploy` and `constructor` are constant strings encoded in ASCII.
* `h` is the [Pedersen](/learn/protocol/cryptography/#pedersen_hash) hash and `sn_keccak` is [Starknet Keccak](/learn/protocol/cryptography/#starknet_keccak).
* `chain_id` is a constant value that specifies the network to which this transaction is sent. For more information, see [Chain ID](#chain_id).
* `contract_address` is calculated as described see [the Cairo Book](https://book.cairo-lang.org/ch100-01-contracts-classes-and-instances.html).
