> ## Documentation Index
> Fetch the complete documentation index at: https://docs.predicate.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating from V1

> Changes required to upgrade from V1 to V2

## What's New

* **No contract required to start** — test the API and integrate offchain before deploying contracts
* **Multi-chain support** — deploy to multiple chains and manage them from a single project
* **Offchain policy management** — update policies through the dashboard without onchain transactions
* **BasicPredicateClient** — simpler integration for who-based policies (AML/KYC, allowlist/denylist) without calldata encoding

## Changes

<Tabs>
  <Tab title="Policy Management">
    In V1, `policyID` on your contract selected which policy was enforced. Changing policies required an onchain `setPolicy()` transaction.

    In V2, the onchain `policyID` is set to a `verification_hash` value during [dashboard setup](/v2/applications/dashboard-setup). Policy selection and updates are managed entirely through the dashboard and enforced immediately. The onchain `policyID` remains unchanged.
  </Tab>

  <Tab title="Smart Contracts">
    * Replaces the `ServiceManager` contract with the [Predicate Registry](/v2/applications/quickstart#supported-blockchains)
    * Introduces `BasicPredicateClient` for simpler "Who"-based policies — no calldata encoding required
    * Refactors the `PredicateClient` for consistency with the Predicate Registry

    ### Attestation struct

    `PredicateMessage` is replaced by `Attestation`:

    ```solidity theme={null}
    // V1
    import {PredicateMessage} from "predicate-contracts/interfaces/IPredicateClient.sol";

    // V2
    import {Attestation} from "@predicate/contracts/src/interfaces/IPredicateRegistry.sol";
    ```

    ### \_authorizeTransaction

    <CodeGroup>
      ```solidity V1 theme={null}
      _authorizeTransaction(_message, encodedSigAndArgs, msg.sender, msg.value)
      ```

      ```solidity V2 — BasicPredicateClient theme={null}
      _authorizeTransaction(_attestation, msg.sender)
      ```

      ```solidity V2 — PredicateClient theme={null}
      _authorizeTransaction(_attestation, encodedSigAndArgs, msg.sender, msg.value)
      ```
    </CodeGroup>
  </Tab>

  <Tab title="API">
    ### Request

    |                    | V1                                            | V2                                   |
    | ------------------ | --------------------------------------------- | ------------------------------------ |
    | Endpoint           | `/v1/task`                                    | `/v2/attestation`                    |
    | Chain field        | `chain_id` (numeric)                          | `chain` (string, e.g. `"ethereum"`)  |
    | Project identifier | `to` (contract address)                       | `verification_hash` or `to`          |
    | Required fields    | `from`, `to`, `data`, `msg_value`, `chain_id` | `from`, `verification_hash`, `chain` |

    For onchain enforcement, use `to` (contract address) instead of `verification_hash`.

    `data` and `msg_value` are only required with `PredicateClient`.

    ### Response

    | V1             | V2                                              |
    | -------------- | ----------------------------------------------- |
    | `task_id`      | `attestation.uuid`                              |
    | `expiry_block` | `attestation.expiration`                        |
    | `signers[]`    | `attestation.attester`                          |
    | `signature[]`  | `attestation.signature`                         |
    | —              | `policy_id`, `policy_name`, `verification_hash` |
  </Tab>

  <Tab title="Offchain SDK">
    Using the SDK is optional. V2 introduces the following changes:

    | V1                                       | V2                                               |
    | ---------------------------------------- | ------------------------------------------------ |
    | `import from '@predicate/core'`          | `import from '@predicate/core/v2'`               |
    | `PredicateRequest` with `chain_id`       | `PredicateRequestV2` with `chain`                |
    | `evaluatePolicy()`                       | `requestAttestation()`                           |
    | `signaturesToBytes()` to encode response | Response `attestation` object is passed directly |
    | `packFunctionArgs()` always required     | Only required with `PredicateClient`             |
  </Tab>
</Tabs>

***

## Migration Checklist

<Steps>
  <Step title="Create project on dashboard">
    Create a new project on [app.predicate.io](https://app.predicate.io) and configure your policy. You'll receive a `verification_hash` for your project.
  </Step>

  <Step title="Update offchain integration">
    Point API calls to `/v2/attestation` with `verification_hash` and `chain` (string). If using the SDK, import from `@predicate/core/v2` and replace `evaluatePolicy()` with `requestAttestation()`.
  </Step>

  <Step title="Deploy new contracts (if using onchain enforcement)">
    <Note>If you must upgrade existing contracts instead of deploying new ones, reach out to the Predicate team to coordinate.</Note>

    Implement [`BasicPredicateClient`](/v2/applications/onchain-enforcement) or [`PredicateClient`](/v2/applications/onchain-enforcement) with the Predicate Registry address. Set your `verification_hash` as the `policyID`.
  </Step>

  <Step title="Add contracts to dashboard">
    Register your contract addresses in the dashboard to link them to your project.
  </Step>

  <Step title="Update API calls for onchain">
    Replace `verification_hash` with `to` (your contract address) in API requests. Pass the `Attestation` struct to your contract functions.
  </Step>
</Steps>
