TransactionHashDeclareV3
Calculates the transaction hash for a Declare V3 transaction with resource bounds using the Poseidon hash algorithm.
Function Signature
func TransactionHashDeclareV3(
txn *rpc.DeclareTxnV3,
chainID *felt.Felt,
) (*felt.Felt, error)Parameters
txn- The Declare V3 transaction containing:Version- Transaction version stringSenderAddress- Address of the account declaring the classClassHash- Hash of the Sierra contract classCompiledClassHash- Hash of the compiled (CASM) classNonce- Account nonceResourceBounds- Resource bounds for L1 gas, L2 gas, and L1 data gasTip- Additional fee tipPayMasterData- Optional paymaster dataAccountDeploymentData- Optional account deployment dataFeeMode- Fee data availability modeNonceDataMode- Nonce data availability mode
chainID- The Starknet chain ID
Returns
*felt.Felt- The calculated transaction hasherror- Error if required parameters are missing
Description
This function calculates the transaction hash for Declare V3 transactions using the Poseidon hash algorithm. V3 introduces resource bounds, data availability modes, and paymaster support.
Internally uses:
- TipAndResourcesHash - For tip and resource bounds hashing
- DataAvailabilityModeConc - For DA mode concatenation
Specification
Follows the V3 Declare hash calculation specification and SNIP-8.
Related Functions
- TransactionHashDeclareV1 - Deprecated V1 variant
- TransactionHashDeclareV2 - Deprecated V2 variant
- TransactionHashBroadcastDeclareV3 - Broadcast variant
- CompiledClassHash - Calculate compiled class hashes

