# Watermark Register

## NFT Watermarks

NFT watermarks can be directly embedded into the media asset using three methods: lazy mint, mint, and authorized mint.

### Lazy Mint

Creators can create vouchers without cost to propose derivative IP Assets for the collection. Other users can then use these vouchers to mint NFTs by paying the appropriate fees.

The parameters for the voucher are as follows:

<table><thead><tr><th width="251">Property Name</th><th width="135">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>bytes32</td><td>A unique ID used by the register.sol contract to specify which voucher or NFT the watermark request belongs to</td></tr><tr><td>maximumUse</td><td>number</td><td>How many times the voucher can be used</td></tr><tr><td>tradeToken</td><td>string</td><td>The token that the user pays with if xERC20 not present</td></tr><tr><td>watermarkPaymentToken</td><td>string</td><td>The token that watermark is paid in</td></tr><tr><td>creator</td><td>string</td><td>Address of the creator of the voucher</td></tr><tr><td>collection</td><td>string</td><td>Address of the collection the voucher belongs to</td></tr><tr><td>price</td><td>number</td><td>Price the creator sets for the mint. Must be greater than the minimum price set by the collection</td></tr><tr><td>signature</td><td>bytes32</td><td>Signature of the voucher</td></tr></tbody></table>

The `requestId` is the key variable in this process:

* A random, standardized `requestId` is provided by the sequencer when creating a voucher
* The sequencer maintains the watermark requests queue
* When the register contract emits a register event, it includes the `requestId`
* Xeal nodes listen for this event and provide the watermark
* Upkeep nodes store these watermarks in batch in the upkeep contract

A single voucher can create multiple NFTs using the `maximumUse` variable. NFTs created by the same creator using a single voucher share the same `requestId` but have different `targetId`s.

The `targetId` determines watermark assignment:

* If `targetId` is 0: The sequencer assigns a random watermark with the specified `requestId`
* If `targetId` is greater than 1: The system matches the corresponding `targetId` for watermarking and minting

### Mint

When a collection is marked as permissionless (`isPermissionless` = true), anyone can mint an NFT by paying the minimum fee specified by the xNFT contract, without using lazy mint.

### Authorized Mint

In collections marked as permissioned (`isPermissionless` = false), only the collection owner can mint NFT tokens without fees.

## For pointer watermarks

A NFT token owner can use `requestPointerWatermark` to mint a watermark that points to the NFT. Only the NFT's information and the NFT owner information will be shown in the mobile verification.

## Watermark Registration Process

1. The process begins by calling the `requestWatermarkMap` function from the register.sol contract:

```solidity
function requestWatermarkMap(
    address _nftContract,
    uint256 _tokenId,
    address _watermarkPaymentToken,
    uint256 _watermarkCount,
    bytes32 _watermarkRequestId,
    uint256 _watermarkTargetId
) external payable
```

2. This Register contract can be called from any Xeal-supported chain.
3. Nodes listen for events emitted by this function call.
4. When a partition threshold for the watermark is met, the Register contract emits a `PartitionIdIncremented` event:

```solidity
event PartitionIdIncremented(uint256 newPartitionId, uint256 chainId);
```

5. This event notifies the node to collect all records for the watermark registers and create a Merkle proof.

## Watermark Threshold

The Register.sol contract manages fee collection and event emission for watermark processing by nodes. It enforces a maximum limit on watermark requests per call to maintain atomic operations and prevent node throttling.

### Watermark Tracking

The contract maintains two key counters:

* `currentWatermarkCount`: Tracks the number of watermarks in the current partition
* `partitionId`: Identifies the current partition

The `partitionId` increments when `currentWatermarkCount` reaches the `watermarkThreshold`. The `watermarkThreshold` defines the maximum number of watermarks that can fit in a partition.

### Request Limits

The maximum number of watermarks allowed in a request is calculated as:

```
watermarkThreshold - currentWatermarkCount + nextWatermarkThreshold
```

`nextWatermarkThreshold` is used when the protocol updates the threshold value:

* Changes to threshold only take effect after `partitionId` increment
* When `partitionId` increments, `nextWatermarkThreshold` becomes the new `watermarkThreshold`
* After the increment, `nextWatermarkThreshold` resets to 0


---

# Agent Instructions: 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:

```
GET https://xeal.gitbook.io/xeal/getting-started/invisible-watermarks-blockchain/watermark-register.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
