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

# Apply Assertions

> Configure assertions and create a release on the platform using `pcl apply`

This guide shows you how to configure your assertions in `credible.toml` and create a release on the platform with `pcl apply`.

**Prerequisites**:

* [pcl installed](/credible/credible-install)
* An assertion [written](/credible/write-first-assertion) and [tested](/credible/testing-assertions)
* A [project created](/credible/deploy-assertions-dapp#step-2-create-a-project) in the platform

**What you'll do**: Authenticate, declare the desired assertion state in `credible.toml`, and create a release. Then review and deploy that release in the platform.

## Step 1: Authenticate

Before deploying, authenticate with the Credible Layer:

```bash theme={null}
pcl auth login
```

`pcl` displays a device code and verification URL. Press Enter to open the URL in your browser, authenticate with your wallet, email, Google, or GitHub, and approve the request. `pcl` then detects the completed authentication.

<Note>
  Your account must be linked to the wallet address that owns the contracts listed in `credible.toml`. The platform verifies on-chain ownership (via the admin verifier, typically `owner()`) before allowing assertion deployment. See [Ownership Verification](/credible/ownership-verification) for details.
</Note>

Check your status anytime:

```bash theme={null}
pcl auth status
```

## Step 2: Configure `credible.toml`

Create a `credible.toml` file at `assertions/credible.toml` in your project root. This file declares the desired release state for your project: which contracts are in scope and which assertion files should protect them.

```toml theme={null}
environment = "production"

[contracts.my_contract]
address = "0xYOUR_CONTRACT_ADDRESS"
name = "MyContract"

[[contracts.my_contract.assertions]]
file = "assertions/src/MyAssertion.a.sol"
```

To protect multiple contracts, add more entries:

```toml theme={null}
environment = "production"

[contracts.vault]
address = "0xVAULT_ADDRESS"
name = "Vault"

[[contracts.vault.assertions]]
file = "assertions/src/VaultAssertion.a.sol"

[contracts.token]
address = "0xTOKEN_ADDRESS"
name = "Token"

[[contracts.token.assertions]]
file = "assertions/src/TokenDrainAssertion.a.sol"
```

<Note>
  Each contract address must be unique within the configuration. See the [pcl Reference](/credible/cli-reference#credibletoml-configuration) for all available fields.
</Note>

<Tip>
  Set `project_id` in your `credible.toml` to skip the interactive project selection prompt. This is especially useful for CI/CD pipelines.
</Tip>

<Note>
  `credible.toml` is declarative. If a later release removes a contract or assertion from the manifest, the platform treats that as a requested removal from the project when the release is reviewed, deployed, and the State Oracle timelock expires.
</Note>

## Step 3: Apply Your Assertions

Create a release on the platform:

```bash theme={null}
pcl apply
```

This command:

1. Reads your `credible.toml` configuration
2. Builds and compiles the referenced assertion contracts
3. Previews the release changes against the current project state
4. Creates a pending release on the platform after you confirm

You'll be prompted to confirm before applying. Use `--yes` to skip the confirmation prompt:

```bash theme={null}
pcl apply --yes
```

<Note>
  `pcl apply` automatically builds your project. You can also run `pcl build` separately to check for compilation errors before applying.
</Note>

## Step 4: Review and Deploy in the Platform

After applying, complete deployment in the [Phylax platform](https://app.phylax.systems) using the [Deploy Assertions guide](/credible/deploy-assertions-dapp#step-4-deploy-the-assertion):

1. Navigate to your project
2. Select **Releases**
3. Choose the release created by `pcl apply`
4. Review the release diff and selected target contracts
5. Review **Assertion verification**, **Source code**, and **Backtesting**. See [Release Review Checks](./release-review-checks) for details.
6. Confirm the target environment declared in `credible.toml`
7. Connect the protocol manager wallet, select **Deploy to Staging** or **Deploy to Production**, and sign the transaction

<Note>
  Creating a release through `pcl apply` does not make the assertion active by itself. The release is pending until an authorized protocol admin, also called a manager, signs the deployment transaction in the platform. The assertion becomes active only after that transaction is accepted on-chain and the configured timelock in the State Oracle contracts expires. Removals follow the same State Oracle timelock flow.
</Note>

## Troubleshooting

### Authentication Issues

| Error                    | Solution                                 |
| ------------------------ | ---------------------------------------- |
| "Not authenticated"      | Run `pcl auth login`                     |
| "Authentication expired" | Run `pcl auth login` to refresh          |
| Browser doesn't open     | Manually visit the URL shown in terminal |

### Apply Issues

| Error                        | Solution                                                                               |
| ---------------------------- | -------------------------------------------------------------------------------------- |
| "credible.toml not found"    | Check that the file exists at `assertions/credible.toml` or specify the path with `-c` |
| "duplicate contract address" | Each contract address must be unique in `credible.toml`                                |
| "Project not found"          | Create the project in the platform first, or set `project_id` in `credible.toml`       |
| Build failures               | Run `pcl build` separately to diagnose compilation errors                              |

## Next Steps

<CardGroup cols={2}>
  <Card title="Deploy with the Platform" icon="rocket" href="/credible/deploy-assertions-dapp">
    Complete deployment in the platform
  </Card>

  <Card title="pcl Reference" icon="book" href="/credible/cli-reference">
    Full command reference
  </Card>

  <Card title="Testing Assertions" icon="flask" href="/credible/testing-assertions">
    Test before deployment
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/credible/troubleshooting">
    Common issues and solutions
  </Card>
</CardGroup>
