# Keeper Registration and Update

## Overview

$$
\cdot \cdot \cdot
$$

## Specification

### Keeper registration

The caller provides worker address (which is used in the off-chain keeper software configuration) and initial CVP deposit for stake.&#x20;

Each new keeper is assigned an id (id of the previous registered keeper, incremented by 1, starting from 0).&#x20;

{% code overflow="wrap" %}

```solidity
function registerAsKeeper(
    
    //address of the keeper worker account
    address worker_,
    
    //initial CVP deposit amount to stake for this worker
    uint256 initialDepositAmount
    
    //returns id of the newly registered keeper
    ) public virtual returns (uint256 keeperId)
{
    //worker address is not already assigned to any registered keeper in the Agent contract
    _assertWorkerNotAssigned();
    
    //CVP is not less than the minimal allowed CVP stake
    _minKeeperCvpAssertion();
}
```

{% endcode %}

A single keeper address can have multiple workers assigned to the same Admin contract.&#x20;

Once the registration is complete, the keeper is assumed to be up and running. It will start participating in the network as soon as the off-chain software is configured and launched.

### Worker address update

If for any reason the keeper wants to change their worker address, a function [`setWorkerAddress` ](https://docs.powerpool.finance/powerpool-and-poweragent-network/power-agent/old-pages/keeper-old/..#setworkeraddress)is used.

The [mappings ](https://docs.powerpool.finance/powerpool-and-poweragent-network/power-agent/old-pages/keeper-old/..#mappings)`workerKeeperIds` and `keepers` are updated accordingly.

Upon successful change of the worker address the function emits

{% code overflow="wrap" %}

```solidity
event SetWorkerAddress(
    //id of the keeper for which the worker address was changed
    keeperId_,
    
    //previous worker address
    prev,
    
    //new worker address
    worker
)
```

{% endcode %}
