# EcdsaLib

## EcdsaLib

### compressPublicKey

```solidity
function compressPublicKey(bytes32 x, bytes32 y) internal pure returns (bytes)
```

Converts public key X and Y coordinates (32-byte each) to a compressed public key (33-byte). Compressed public key is X coordinate prefixed with `02` or `03` based on the Y coordinate parity. It is expected that the uncompressed public key is stripped (i.e. it is not prefixed with `04`).

#### Parameters

| Name | Type    | Description                         |
| ---- | ------- | ----------------------------------- |
| x    | bytes32 | Wallet's public key's X coordinate. |
| y    | bytes32 | Wallet's public key's Y coordinate. |

#### Return Values

| Name | Type  | Description                                                  |
| ---- | ----- | ------------------------------------------------------------ |
| \[0] | bytes | Compressed public key (33-byte), prefixed with `02` or `03`. |


---

# 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://docs.threshold.network/app-development/tbtc-contracts-api/tbtc-v2-api/ecdsalib.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.
