> For the complete documentation index, see [llms.txt](https://gabriel-j-shapiro.gitbook.io/metalex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-how-to-guides/sign-a-cyberagreement.md).

# Sign a cyberAgreement

**cyberSign** is the protocol's agreement layer: the `CyberAgreementRegistry` holds agreement **templates** and executed, multi-party-signed **contracts**. Deals and rounds reference it for their underlying agreements.

## 1. Register a template

A template is a reusable legal document with a field schema.

```solidity
ICyberAgreementRegistry(registry).createTemplate(
    templateId,        // bytes32 — chosen id
    "Series A Stockholder Consent v1",  // title
    "ipfs://...",      // legalContractUri (canonical text)
    globalFields,      // string[] — fields common to the contract
    partyFields        // string[] — fields filled per signing party
);
```

## 2. Create a contract from the template

```solidity
bytes32 contractId = ICyberAgreementRegistry(registry).createContract(
    templateId,
    salt,           // uint256
    globalValues,   // string[]
    parties,        // address[]
    partyValues,    // string[][] — per-party values
    secretHash,     // bytes32
    finalizer,      // address allowed to finalise
    expiry          // uint256
);
```

## 3. Parties sign

Each party signs. Three entry points:

* `signContract(contractId, partyValues, fillUnallocated, secret)` — the caller signs for itself.
* `signContractFor(signer, contractId, partyValues, signature, fillUnallocated, secret)` — relayed, with the signer's EIP-712 signature.
* `signContractWithEscrow(escrowSigner, contractId, partyValues, signature, fillUnallocated, secret)` — using a pre-escrowed signature.

When every party has signed, the registry emits `ContractFullySigned`.

## 4. Finalise

```solidity
ICyberAgreementRegistry(registry).finalizeContract(contractId);
```

## Checking status

`hasSigned`, `allPartiesSigned`, `isFinalized`, `isVoided`, `getContractDetails`, `getAgreementsForParty`.

## Related

* [CyberAgreementRegistry](/metalex-docs/protocol-reference/contracts/cyberagreementregistry.md), [Agreement templates](/metalex-docs/protocol-reference/templates.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-how-to-guides/sign-a-cyberagreement.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
