# Contract Hash

The contract’s hash is a hash of its definition. The elements defining a contract are:

• API version - The version under which the contract was deployed.

• Array of external functions entry points - An entry point is a pair `(selector, offset)`, where offset is the offset of the instruction that should be called inside the contract’s bytecode.

 Function selector The selector is an identifier through which the function is callable in transactions or in other contracts. The selector is the starknet_keccak hash of the function name, encoded in ASCII.
• Array of L1 handlers entry points.

• Array of constructors entry points - Currently, the compiler allows only one constructor.

• Array of used builtin names - An ASCII-encode array, ordered by declaration.

• Keccak - The starknet_keccak, of the contract’s program. The contract’s program stands for the JSON obtained by executing `starknet-compile` with the `--no_debug_info` flag. To see the exact computation of this field, see our repo.

• Bytecode - Represented by an array of field elements.

The contract’s hash is the chain hash, that is, the Pedersen hash, of the above, computed as follows:

1. Start with $h(0,api\_version)$.

2. For every line in the above, excluding the first, compute $h(h(previous\_line), new\_line)$, where the hash of an array is defined as starknet_keccak.

3. Let $c$ denote the cumulative hash resulting from applying the above process; the contract’s hash is then $h(c, \textrm{number_of_lines})$, where $\text{number_of_lines}$ is 7.

For more details, see the Cairo implementation.