INVOKE
v3Field 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. Currently this value is always 0 .For more information, see SNIP 8: Transaction V3 Structure |
nonce | FieldElement | The transaction nonce. |
nonce_data_availability_mode | FieldElement | For future use. Currently this value is always 0 .For more information, see SNIP 8: Transaction V3 Structure |
paymaster_data | List<FieldElement> | For future use. Currently this value is always empty. For more information, see SNIP 8: Transaction V3 Structure |
resource_bounds | Dict[Resource, ResourceBounds] | Used for enabling the fee market. A dictionary that maps resource type to resource bounds. The existing resources are L1 gas, L1 data gas, and L2 gas. Resource A felt. Possible values are the felt representation of the strings L1_GAS , L1_DATA , or L2_GAS .ResourceBounds A struct containing the following felts: • max_amount : The maximum amount of the resource allowed for usage during the execution.• 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-18 STRK. |
signature | List<FieldElement> | Additional information given by the sender, used to validate the transaction. For more information, see Signature. |
tip | FieldElement | For future use. Currently this value is always 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. Transaction version, where n specifies version n transaction. For example:3 version 3 transaction |
INVOKE
v3 transaction hash is calculated as a Poseidon hash over the given transaction elements, specifically:
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.
l1_gas_bounds
is constructed as follows:
l2_gas_bounds
is constructed as follows:
l1_data_gas_bounds
is constructed as follows:
data_availability_modes
is a concatenation of fee_data_availability_mode
and nonce_data_availability_mode
, as follows:
h
is the Poseidon hash.
DECLARE
v3DECLARE
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.
Field name | Type | Description |
---|---|---|
account_deployment_data | List<FieldElement> | For future use. Currently this value is always empty. For more information, see SNIP 8: Transaction V3 Structure |
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. |
contract_class | ContractClass | The class definition. For more information, see the Cairo Book. |
fee_data_availability_mode | FieldElement | For future use. Currently this value is always 0 .For more information, see SNIP 8: Transaction V3 Structure |
nonce | FieldElement | The transaction nonce. |
nonce_data_availability_mode | FieldElement | For future use. Currently this value is always 0 .For more information, see SNIP 8: Transaction V3 Structure |
paymaster_data | List<FieldElement> | For future use. Currently this value is always empty. For more information, see SNIP 8: Transaction V3 Structure |
resource_bounds | Dict[Resource, ResourceBounds] | Used for enabling the fee market. A dictionary that maps resource type to resource bounds. The existing resources are L1 gas, L1 data gas, and L2 gas. Resource A felt. Possible values are the felt representation of the strings L1_GAS , L1_DATA , or L2_GAS .ResourceBounds A struct containing the following felts: • max_amount : The maximum amount of the resource allowed for usage during the execution.• 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-18 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. |
tip | FieldElement | For future use. Currently this value is always 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. Transaction version, where n specifies version n transaction. For example:3 version 3 transaction |
DECLARE
transaction is computed as follows:
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.
l1_gas_bounds
is constructed as follows:
l2_gas_bounds
is constructed as follows:
l1_data_gas_bounds
is constructed as follows:
data_availability_modes
is a concatenation of fee_data_availability_mode
and nonce_data_availability_mode
, as follows:
h
is the Poseidon hash.
class_hash
is the hash of the contract class. See the Cairo Book] 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
v3DEPLOY_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.
Field name | Type | Description |
---|---|---|
account_deployment_data | List<FieldElement> | For future use. Currently this value is always empty. For more information, see SNIP 8: Transaction V3 Structure |
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. |
compiled_class_hash | FieldElement | The hash of the compiled class. For more information, see the Cairo Book. |
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. |
fee_data_availability_mode | FieldElement | For future use. Currently this value is always 0 .For more information, see SNIP 8: Transaction V3 Structure |
nonce | FieldElement | The transaction nonce. |
nonce_data_availability_mode | FieldElement | For future use. Currently this value is always 0 .For more information, see SNIP 8: Transaction V3 Structure |
paymaster_data | List<FieldElement> | For future use. Currently this value is always empty. For more information, see SNIP 8: Transaction V3 Structure |
resource_bounds | Dict[Resource, ResourceBounds] | Used for enabling the fee market. A dictionary that maps resource type to resource bounds. The existing resources are L1 gas, L1 data gas, and L2 gas. Resource A felt. Possible values are the felt representation of the strings L1_GAS , L1_DATA , or L2_GAS .ResourceBounds A struct containing the following felts: • max_amount : The maximum amount of the resource allowed for usage during the execution.• 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-18 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. |
tip | FieldElement | For future use. Currently this value is always 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.Transaction version, where n specifies version n transaction. For example:3 version 3 transaction |
DEPLOY_ACCOUNT
transaction is computed as follows:
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.
l1_gas_bounds
is constructed as follows:
l2_gas_bounds
is constructed as follows:
l1_data_gas_bounds
is constructed as follows:
data_availability_modes
is a concatenation of fee_data_availability_mode
and nonce_data_availability_mode
, as follows:
h
is the Poseidon hash.
class_hash
is the hash of the contract class hash. See the Cairo Book 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.
SN_MAIN
for Starknet’s main network.SN_SEPOLIA
for Starknet’s public testnet on Sepolia.INVOKE
v1Name | 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. |
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. 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. |
INVOKE
v1 transaction hash is calculated as a hash over the given transaction elements, specifically:
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.h
is the Pedersen hashINVOKE
v0INVOKE
transaction is computed as follows:
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. v2 and v3h
is the Pedersen hashDECLARE
v2Name | Type | Description |
---|---|---|
chain_id | FieldElement | The id of the chain to which the transaction is sent. |
contract_class | ContractClass | The contract class. |
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. |
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 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. |
DECLARE
transaction is computed as follows:
h
is the Poseidon hash functionclass_hash
is the hash of the contract class. See the Cairo Book for details about how the hash is computedcompiled_class_hash
is the hash of the compiled class generated by the Sierra→Casm compiler that is used in StarknetDECLARE
v1DECLARE
v1 transaction was used to declare Cairo 0 classes.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. |
nonce | FieldElement | The transaction nonce. |
version | FieldElement | The transaction’s version. Possible values are 1 or 0. 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. |
DECLARE
transaction is computed as follows:
declare
is a constant prefix string, encoded in ASCII.class_hash
is the hash of the contract class. See the Cairo Book for details about how the hash is computed.chain_id
is a constant value that specifies the network to which this transaction is sent. For more information, see Chain ID.h
is the Pedersen hashDECLARE
v0DECLARE
v0 transaction used to declare Cairo 0 classes.DECLARE
transaction is computed as follows:
declare
is a constant prefix string, encoded in ASCII.h
is the Pedersen hashchain_id
is a constant value that specifies the network to which this transaction is sent. For more information, see Chain-Id.class_hash
is the hash of the contract class. See the Cairo Book for details about how the hash is computed.DEPLOY_ACCOUNT
v1Name | 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[account address^]. |
signature | List<FieldElement> | Additional information given by the sender, used to validate the transaction. For more information, see 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. |
DEPLOY_ACCOUNT
transaction is computed as follows:
deploy_account
is a constant prefix string, encoded in ASCII.h
is the Pedersen hashchain_id
is a constant value that specifies the network to which this transaction is sent. For more information, see [chain-id].class_hash
is the hash of the contract class. See the Cairo Book for details about how the hash is computed.DEPLOY
v0DEPLOY
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:
deploy
and constructor
are constant strings encoded in ASCII.h
is the Pedersen hash and sn_keccak
is Starknet Keccak.chain_id
is a constant value that specifies the network to which this transaction is sent. For more information, see Chain ID.contract_address
is calculated as described see the Cairo Book.