> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Struct ContractInstance

Module: `protocol_types::contract_instance`

```rust
pub struct ContractInstance {
    pub salt: Field,
    pub deployer: AztecAddress,
    pub original_contract_class_id: ContractClassId,
    pub initialization_hash: Field,
    pub immutables_hash: Field,
    pub public_keys: PublicKeys,
}
```

The complete preimage of an [`AztecAddress`](/aztec-nr-api/v6.0.0/protocol_types/address/aztec_address/struct.AztecAddress.md).

All of these values are hashed into the contract's `AztecAddress` (see [`Self::to_address`](/aztec-nr-api/v6.0.0/protocol_types/contract_instance/struct.ContractInstance.md#to_address)), so they are fixed at deployment time and never change.

In particular, `original_contract_class_id` is the class the contract was *deployed* with. For upgradeable contracts which utilize the `ContractInstanceRegistry` this is NOT the class currently executing i.e. the 'current' class.

## Fields

```rust
salt: Field
```

```rust
deployer: AztecAddress
```

```rust
original_contract_class_id: ContractClassId
```

```rust
initialization_hash: Field
```

```rust
immutables_hash: Field
```

```rust
public_keys: PublicKeys
```

## Implementations

```rust
impl ContractInstance
```

```rust
pub fn to_address(self) -> AztecAddress
```

## Trait implementations

```rust
impl Deserialize for ContractInstance
```

```rust
pub fn deserialize(fields: [Field; 12]) -> Self
```

```rust
pub fn stream_deserialize<let K: u32>(reader: &mut Reader<K>) -> Self
```

```rust
impl Eq for ContractInstance
```

```rust
pub fn eq(_self: Self, _other: Self) -> bool
```

```rust
impl Hash for ContractInstance
```

```rust
pub fn hash(self) -> Field
```

```rust
impl Serialize for ContractInstance
```

```rust
pub fn serialize(self) -> [Field; 12]
```

```rust
pub fn stream_serialize<let K: u32>(self, writer: &mut Writer<K>)
```
