Skip to content

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 string
    • SenderAddress - Address of the account declaring the class
    • ClassHash - Hash of the Sierra contract class
    • CompiledClassHash - Hash of the compiled (CASM) class
    • Nonce - Account nonce
    • ResourceBounds - Resource bounds for L1 gas, L2 gas, and L1 data gas
    • Tip - Additional fee tip
    • PayMasterData - Optional paymaster data
    • AccountDeploymentData - Optional account deployment data
    • FeeMode - Fee data availability mode
    • NonceDataMode - Nonce data availability mode
  • chainID - The Starknet chain ID

Returns

  • *felt.Felt - The calculated transaction hash
  • error - 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:

Specification

Follows the V3 Declare hash calculation specification and SNIP-8.

Related Functions