# xy_to_pubkey · Rell standard library · Chromia Docs (concept)

> pure function xy_ to_ pubkey(x: big_integer , y: big_integer , [compressed: boolean ]): byte_array Construct a public key from EC point x and y coordinates

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/crypto/xy_to_pubkey/

FUNCTION

# xy\_to\_pubkey

```signature
pure function xy_to_pubkey(x: big_integer, y: big_integer, [compressed: boolean]): byte_array
```

Construct a public key from EC point `x` and `y` coordinates. The given `x` and `y` coordinates must
encode a point on the secp256k1 elliptic curve in order to constitute a public key.

Inverse of `crypto.pubkey_to_xy()`.

The optional boolean flag `compressed` determines whether a compressed (33-byte), or uncompressed
(65-byte) public key, is returned. Defaults to false (uncompressed) if not provided.

**Parameters**

* **x** — the x-coordinate
* **y** — the y-coordinate
* **compressed** — whether the returned public key should be compressed, defaults to false

**Returns**

a 65-byte public key if uncompressed mode is used, or an equivalent 33-byte public key if
compressed mode is used

**Throws**

* `exception` — if the given `x` and `y` coordinates do not encode a point on the secp256k1 elliptic curve (and therefore do not constitute a valid public key)

Since 0.13.5

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/crypto/xy_to_pubkey.html)Generated API reference, mirrored from the live docs
