Overview

The pcl (Phylax Credible Layer) is a command-line interface for interacting with the Credible Layer. It allows developers to authenticate, test, and submit assertions to the Credible Layer dApp.

Project Structure

The pcl command expects the following directory structure:

root-dir/
  assertions-dir/
    src/      # Assertion source files (.a.sol)
    test/     # Test files (.t.sol)

Commands

auth

Manage authentication with your Credible Layer dApp account.

pcl auth [OPTIONS] <COMMAND>

Commands:
  login   Login to PCL using your wallet
  logout  Logout from PCL
  status  Check current authentication status

Options:
      --base-url <BASE_URL>  Base URL for authentication service [env: AUTH_BASE_URL=] [default: https://credible-layer-dapp.pages.dev]
  -h, --help                 Print help

When logging in:

  1. A URL and authentication code will be displayed
  2. Visit the URL in your browser
  3. Connect your wallet and approve the authentication
  4. CLI will automatically detect successful authentication

config

Manage your PCL configuration:

pcl config [COMMAND]

Commands:
  show    Display the current configuration
  delete  Delete the current configuration

Configuration is stored in ~/.pcl/config.toml and includes:

  • Authentication token
  • Pending assertions for submission
  • Project settings

test

Run tests for your assertions.

pcl test -h
Run tests

Usage: pcl test [OPTIONS] [PATH]

Options:
  -h, --help  Print help (see more with '--help')

Display options:
  -v, --verbosity...                Verbosity level of the log messages.
  -q, --quiet                       Do not print log messages
      --json                        Format log messages as JSON
      --color <COLOR>               The color of the log messages [possible values: auto, always, never]
  -s, --suppress-successful-traces  Suppress successful test traces and show only traces for failures [env: FORGE_SUPPRESS_SUCCESSFUL_TRACES=]
      --junit                       Output test results as JUnit XML report
  -l, --list                        List tests instead of running them
      --show-progress               Show test execution progress
      --summary                     Print test summary table
      --detailed                    Print detailed test summary table

Note: The pcl test command is a fork of Forge’s test command so all functionality is available.

store

Submit Assertion bytecode and source code to the Assertion DA.

Be aware that if your assertion contract has constructor arguments, you need to pass them to the pcl store command.

pcl store [OPTIONS] <ASSERTION_CONTRACT> [CONSTRUCTOR_ARGS]...

Arguments:
  <ASSERTION_CONTRACT>   Name of the assertion contract to build and flatten
  [CONSTRUCTOR_ARGS]...  Constructor arguments for the assertion contract

Options:
  -u, --url <URL>        URL of the assertion-DA server [default: http://localhost:5001]
  -r, --root <ROOT>      Root directory of the project
  -h, --help             Print help (see a summary with '-h')

Example of an assertion contract that takes the address of the smart contract it protects as a constructor argument:

pcl store MyAssertion 0xADDRESS_OF_SMART_CONTRACT

You can also hardcode the address of the smart contract it protects in the assertion contract, but you lose the flexibility of being able to use the same assertion for different smart contracts.

submit

Submit assertions to the Credible Layer dApp.

If you have provided a constructor argument when storing the assertion, you need to provide it when submitting the assertion.

If no options are provided, the command will prompt interactively to select the project and assertion(s).

pcl submit [OPTIONS]

Options:
  -u, --dapp-url <DAPP_URL>                 Base URL for the Credible Layer dApp API [default: http://localhost:3003/api/v1]
  -p, --project-name <PROJECT_NAME>         Optional project name to skip interactive selection
  -a, --assertion-keys <ASSERTION_KEYS>     Optional list of assertion name and constructor args to skip interactive selection
                                            Format: assertion_name OR 'assertion_name(constructor_arg0,constructor_arg1)'
  -h, --help                                Print help

Example:

pcl submit -a 'MyAssertion(0xADDRESS_OF_SMART_CONTRACT)' -p my-project

Examples

Complete Authentication Flow

# Login
pcl auth login

# Verify status
pcl auth status

# Store assertion
pcl store my_assertion 0xADDRESS_OF_SMART_CONTRACT

# Submit to dApp
pcl submit -a 'my_assertion(0xADDRESS_OF_SMART_CONTRACT)' -p my_project

# Logout when done
pcl auth logout

Troubleshooting

Authentication Issues

  • Error: Not authenticated: Run pcl auth login to authenticate
  • Error: Authentication expired: Run pcl auth login to refresh your authentication
  • Browser doesn’t open: Manually visit the URL displayed in the terminal

Submission Issues

  • Error: Failed to submit: Ensure you’re authenticated and have network connectivity
  • Error: Project not found: Create a project in the Credible Layer dApp first
  • Error: Assertion not found: Ensure the assertion name is correct and exists in your project
  • Make sure to provide constructor arguments when storing the assertion if it has any